[antlr-interest] Syntactic predicates: ignore the rule

Terence Parr parrt at jguru.com
Wed Nov 13 11:41:26 PST 2002


On Wednesday, November 13, 2002, at 10:50  AM, Paul J. Lucas wrote:

> ANTLR insists on having an alternate for a rule with a syntactic 
> predicate in the lexer.  Why?  If the syntactic predicate fails, why 
> can't the entire rule not be considered at all?
>
Because ANTLR uses predicates to distinguish between alternatives not 
rules.  ANTLR doesn't know how to "hoist" the syntactic predicate into 
nextToken().  Try combining the rules, which usually works.

Ter
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list