-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: expose semicolons, remove generation warnings #159
Conversation
Thanks for the PR. Currently semicolons are parsed as a single token because it's more convenient for multidimentional arrays. Though I don't see any problem with parsing it as multiple tokens. Is there a specific reason to make it visible? |
Basically just so that, e.g. in nvim-treesitter, the semicolons can be given a highlight. Currently they cannot be queried since grammar regexes are not exposed |
Also I should mention that in other nodes in the grammar, there exists anonymous |
Yeah. It's very annoying that some places require a single semicolon and other don't. One thing I noticed is that this would allow non-consecutive semicolons like |
Ah, good point. Is |
It's valid when delimiting expressions but not valid when delimiting matrix rows, and we're using I'd keep whichever rule produces less states (not that it makes a difference in our huge parser). |
This change gives 19334, 9490 for state count and large state count (respectively), and prior to this change it was 19618, 9476 |
Writing just |
Ah apologies, I thought that was a mistake |
This commit exposes semicolon terminators as anonymous nodes that can be queried, and removes the following warnings upon generating the parser: Warning: rule _pair_operator is just a `seq` or `choice` rule with a single element. This is unnecessary. Warning: rule _lazy_or_operator is just a `seq` or `choice` rule with a single element. This is unnecessary. Warning: rule _lazy_and_operator is just a `seq` or `choice` rule with a single element. This is unnecessary. Warning: rule _pipe_right_operator is just a `seq` or `choice` rule with a single element. This is unnecessary. Warning: rule _pipe_left_operator is just a `seq` or `choice` rule with a single element. This is unnecessary. Warning: rule _rational_operator is just a `seq` or `choice` rule with a single element. This is unnecessary. Warning: rule _tilde_operator is just a `seq` or `choice` rule with a single element. This is unnecessary.
This commit exposes semicolon terminators as anonymous nodes that can be queried, and removes the following warnings upon generating the parser:
Warning: rule _pair_operator is just a
seq
orchoice
rule with a single element. This is unnecessary.Warning: rule _lazy_or_operator is just a
seq
orchoice
rule with a single element. This is unnecessary.Warning: rule _lazy_and_operator is just a
seq
orchoice
rule with a single element. This is unnecessary.Warning: rule _pipe_right_operator is just a
seq
orchoice
rule with a single element. This is unnecessary.Warning: rule _pipe_left_operator is just a
seq
orchoice
rule with a single element. This is unnecessary.Warning: rule _rational_operator is just a
seq
orchoice
rule with a single element. This is unnecessary.Warning: rule _tilde_operator is just a
seq
orchoice
rule with a single element. This is unnecessary.