Replies: 6 comments 5 replies
-
lookahead/behind/around is not supported. The word rule is not for keywords, but for identifiers or the like |
Beta Was this translation helpful? Give feedback.
-
Okay.... I've set it to the identifier rule and it still says it can't be used as a word token (even though I rewrote the entire rule to solely use a regex). |
Beta Was this translation helpful? Give feedback.
-
post your grammar |
Beta Was this translation helpful? Give feedback.
-
Uh..... Alright, but it's quite a long file, so I've uploaded it. |
Beta Was this translation helpful? Give feedback.
-
Identifier as your first rule makes that the top-level rule... There seems to be a few misunderstandings of how to write a tree-sitter grammar there, I would look at upstream grammars for examples of good grammars, and note that your first rule must be the "program" or "source_file" (or whatever) rule that signifies how to parse an entire file. |
Beta Was this translation helpful? Give feedback.
-
So order of the rules does matter? Or is there a way I can explicitly specify the top-level one? (I'd prefer not to reorder all the rules, that'd be a PITA given the shear number of them.) Could I just move the top-level rule to the first rule? |
Beta Was this translation helpful? Give feedback.
-
So I'm trying to use the keyword extraction feature, but tree-sitter is claiming that I can't use a non-terminal symbol. (The rule is solely a regex.) I used the grex tool to create a regular expression for all the keywords in the language:
I've tried just a
choice(...)
over all keywords and it (still) doesn't like it. And there doesn't seem to be a negative/positive lookahead function for me to say "identifiers can be this but they shouldn't match these words". How do I use this feature properly?Beta Was this translation helpful? Give feedback.
All reactions