I need help with my ANTLR 4 grammar after deciding to switch to v4 from v3. I am not very experienced with ANTLR so I am really sorry if my question is dumb ;)
In v3 I used the following code to detect Java-style comments:
COMMENT
: '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
| '/*' ( options {greedy=false;} : . )* '*/' {$channel=HIDDEN;}
;
In v4 there are no rule-specific options. The actions (move to hidden channel) are also invalid.
Could somebody please give me a hint how to do it in ANTLR v4?
->command in lexer rule 'COMMENT' must be last element of single outermost alt
What's the problem? – Holiday