[antlr-interest] Using lexer rules properly
spoulson at explodingcoder.com
spoulson at explodingcoder.com
Thu Jun 19 09:09:31 PDT 2008
>---- Original Message ----
>Adding CRON_TERM results in eating up all those UINT tokens. Try the following:
>
>cron_term: '!'? (UINT | '-' | '/' | '*' | '>' | '<')+;
>
>Johannes
I tried that as well, but because I use the WS rule with $channel=hidden, this term eats up all the cron fields as one, then balks when it can't find more.
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?
Thanks.
Shawn Poulson
spoulson at explodingcoder.com
More information about the antlr-interest
mailing list