Clears the chevrotain internal cache. This should not be used in regular work flows, This is intended for unique use cases for example: online playground where the a parser with the same name is initialized with different implementations multiple times.
utility to help the poor souls who are still stuck writing pure javascript 5.1 extend and create Token subclasses in a less verbose manner
the name of the new TokenClass
RegExp Pattern or Parent Token Constructor
the Token class to be extended
This can be used to improve the quality/readability of error messages or syntax diagrams.
A constructor for a Token subclass
the Human readable label a Token if it exists.
Generated using TypeDoc
convenience used to express an empty alternative in an OR (alternation). can be used to more clearly describe the intent in a case of empty alternation.
for example:
without using EMPTY_ALT:
this.OR([ {ALT: () => {
this.CONSUME1(OneTok) return "1"
}}, {ALT: () => {
this.CONSUME1(TwoTok) return "2"
}}, {ALT: () => { // implicitly empty because there are no invoked grammar rules (OR/MANY/CONSUME...) inside this alternative.
return "666"
}}, ])
using EMPTY_ALT:
this.OR([ {ALT: () => { this.CONSUME1(OneTok) return "1" }}, {ALT: () => { this.CONSUME1(TwoTok) return "2" }}, {ALT: EMPTY_ALT("666")}, // explicitly empty, clearer intent ])