Appendix C: Modifiers
Tokay allows to use the following modifiers for calls to consumable values. Modifiers are used to describe repetitions or optional occurences of consumables.
Modifier | Description | Examples |
---|---|---|
+ | Positive repetition (one or many) | `'t'+, P(n=3)+` |
? | Optional (one or none) | `'t'?, P(n=3)?` |
* | Kleene star (none or many) | `'t'*, P(n=3)*` |
Redudancy with expressional operators
You might have noticed that the operators +
and *
are used as operators for add and multiply as well. To clarify meaning, all modifiers stick to the token they belong to, and no whitespace is accepted between them. Modifiers are only allowed on tokens and parselet calls, and nowhere else, as it makes no sense.
Here are some examples for clarification:
't' * 3 # match 't' and repeat the result 3 times
't'* * 3 # match 't' one or multiple times and repeat the result 3 times
't' * * 3 # syntax error