[antlr-interest] internal error

Olivier Lefevre lefevrol at yahoo.com
Fri Feb 1 14:02:14 PST 2008


> NEWLINE: ('\r'? '\n')+
> 
>> WS: (' '|'\t'|'\n'|'\r')+ {skip();} ;
> 
> If you want to use newlines as statement terminators then you can't
> skip the characters that make them up.

My understanding is that in the grammar in question NEWLINE will be
matched first, so it is OK to have a skip instruction in WS. But
it's true it is a contradiction (in intent, not in practice) to both
skip and process newlines. That is what the example from the book
does, though.

-- O.L.



More information about the antlr-interest mailing list