How can I prevent whitespaces in one parser rule when I already have hidden terminal WS? #1126
-
Hi team, I'd like to define a rule
Now since I have hidden terminal My expectation is the annotation body must be followed '@' without whitespaces, and semantic model should only contains annotation body without '@' sign. How could I achieve it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @jindong-zhannng, basically you have two options:
Note that I would recommend the first approach, as it makes parsing more error tolerant, and custom validations usually lead to better error messages for end users. |
Beta Was this translation helpful? Give feedback.
Hey @jindong-zhannng, basically you have two options:
@
keyword and thename
property.terminal AnnotationName: '@' ID;
and use it as thename
property. Make sure to override theDefaultValueConverter
to remove the@
character from the parsed value.Note that I would recommend the first approach, as it makes parsing more error tolerant, and custom validations usually lead to better error messages for end users.