how to add keyword without quotes #1081
-
If I have the following langium grammar:
Using
That's why I thought of this:
Which restricts that there shouldn't be a non-whitespace letter after Is there a way to redefine it as keyword? Or another way to force |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I'm unsure what to recommend here. Mostly due to the question: What constitutes a keyword if not a well-known word that is separated from other words using a non-word character? I.e. either whitespace or other symbols such als brackets, braces or parenthesis. So, in theory, you can just declare the keyword as normal and override the pattern in the token builder. That would probably accomplish what you're looking for the best. You could also keep the regex terminal and then add the corresponding parts to the completion provider. Note that there's very little difference between keywords and other terminals during the language server runtime. It's basically only the completion that is provided for keywords. Non cross reference terminals don't get completion support. |
Beta Was this translation helpful? Give feedback.
I'm unsure what to recommend here. Mostly due to the question: What constitutes a keyword if not a well-known word that is separated from other words using a non-word character? I.e. either whitespace or other symbols such als brackets, braces or parenthesis.
So, in theory, you can just declare the keyword as normal and override the pattern in the token builder. That would probably accomplish what you're looking for the best.
You could also keep the regex terminal and then add the corresponding parts to the completion provider. Note that there's very little difference between keywords and other terminals during the language server runtime. It's basically only the completion that is provid…