Currently I am using the Java8.g4 of java 8 from this repo: https://github.com/antlr/grammars-v4
However, I was wondering how can I modify the Java8.g4 file to make sure if I encounter multiple new lines I only tokenize one of them?
Refer to: Parsing Newlines, EOF as End-of-Statement Marker with ANTLR3, I can add new line to the parse tree (by adding NEWLINE: ('\r\n'|'\n'|'\r')
to the .g4 file. However, if I have multiple new lines, multiple lines will be parsed and added to the tree which is not what I want.
Hope someone can help me out!
Thanks