[antlr-interest] Using lexer rules properly

Gavin Lambert antlr at mirality.co.nz
Fri Jun 20 02:26:17 PDT 2008


At 04:09 20/06/2008, spoulson at explodingcoder.com wrote:
 >e.g. It parses "cron * * * * *" with all the *'s as a single
 >cron_term match then fails on NoViableAltException on the next
 >cron_term in the parser rule.
 >
 >The solution, which I haven't been able to figure out, is to 
make
 >cron_term disallow the WS rule to interfere between 
terminals.  I
 >don't expect spaces between any of the matches within cron_term.
 >
 >Is this possible without changing the WS rule?

Why don't you want to change the WS rule?  Doing that would make 
this problem significantly easier.

There's nothing magical about skipping whitespace, and in many 
cases it's actually counterproductive to do so.  I don't know why 
people in general seem so anti-WS :)



More information about the antlr-interest mailing list