[antlr-interest] .* consuming all input

George Soom george.soom at siria.cc
Thu Jun 3 01:52:18 PDT 2010


Hi,
according to documentation wildcards are non-greedy in ANTLR, so rule '
comment: '//' a+=.* NEWLINE -> comment(a={a}) ' should match anything until
newline, construct list 'a' and send it to template 'comment'.
Somehow .* will consume everything up to the end of input file so I get
error 'line 0:-1 mismatched input '<EOF>' expecting NEWLINE'. NEWLINE is
defined as NEWLINE: ('\r'? '\n')+; and is not sent to hidden channel or
skipped. Where is the problem? I need to send everything to template
comment, so I can not send comments to trashbin through lexer rule.
Thank You
Georg




More information about the antlr-interest mailing list