I am trying to port Chris Lambro's ANTLR3
Javascript Grammar to ANTLR4
I am getting the following error,
Rule reference 'LT' is not currently supported in a set
in the following code ~(LT)*
LineComment
: '//' ~(LT)* -> skip
;
LT : '\n' // Line feed.
| '\r' // Carriage return.
| '\u2028' // Line separator.
| '\u2029' // Paragraph separator.
;
I need help understanding why I am getting this error, and how I can solve it .
The ~
operator in ANTLR inverts a set of symbols (characters in the lexer, or tokens in the parser). Inside the set, you have a reference to the LT
lexer rule, which is not currently supported in ANTLR 4. To resolve the problem, you need to inline the rule reference:
LineComment
: '//' ~([\n\r\u2028\u2029])* -> skip
;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With