Just beginning with ANTLR4. Found that lexer rules can be recursive https://github.com/antlr/antlr4/blob/master/doc/lexer-rules.md#recursive-lexer-rules. What is the use case to use recursive lexer rules instead of recursive parser rules? Dont you loose all the information when using lexer recursive rules?
As mentioned in the comments by sepp2k: besides nested string literals, nested comments are 1 of the use cases:
COMMENT
: '/*' ( COMMENT | . )*? '*/'
;
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