-
Notifications
You must be signed in to change notification settings - Fork 0
Type annotations
Dima Chechetkin edited this page Sep 11, 2019
·
2 revisions
This annotation can be used for two purposes:
- To adjust priority of a token so that
VariantToken
tests this specific implementation later (bigger priority) or earlier (lower priority) than other implementations - To adjust priority of a rotatable token or parent rotatable token so that it propagates down (bigger priority) to the AST root or up (lower priority) to AST leaves.
It takes two parameters:
-
int value()
- a positive or negative priority adjustment value -
boolean propagate()
- a flag that, when set to true, will cause this adjustment to affect the parent token as well. This can be used, for example, on tokens that represent binary math operators to propagate them in AST according to their priorities.
This annotation can be used on an interface Rule to manually list all its implementations. Implementations will be tested by VariantToken
in the same order as they're provided in annotation's value
parameter.
This annotation can be used on Rule tokens to instruct the parser to ignore any leading characters found in value
parameter of the annotation.
This annotation can be used on interface implementation tokens to instruct the parser to ignore this implementation and not match it during parsing. It is useful for implementations that are supposed to be created in runtime only and should not be populated from parser's input.