[antlr-interest] Selectively disabling lexer rules

Martin Traverso mtraverso at gmail.com
Mon Jan 2 18:04:03 PST 2006


>
> You could use a simple sem pred after the '?' to look at the next
> chars, looking for ':' I suppose.


The question is how far "the next chars" is. There's no way to tell, and it
could potentially mean looking ahead up to the EOF.

If you want to gate out a rule, use {...}?=> on the front of it. :)



Ok, so I did try to gate out the character literal token with a flag that
gets set in the conditional expression rule. Unfortunately, it does not
work, since the parser needs to do LAs before it even goes into the rule.
Thus, while the rule might match if the parser ever gets to it, the LA is
preventing it from ever getting there.

Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060102/7ca339ea/attachment.html


More information about the antlr-interest mailing list