[antlr-interest] Ignoring lexer rules

Silvain Piree s.piree at enneya.com
Thu Oct 24 00:14:32 PDT 2002


Paul,

your first solution won't work; use the second one,
but don't forget to make the BAR rule a private rule.

(What I usually do in such cases is to define a
new rule CONFLICTING_TOKENS that contains
references to all conflicting token rules and use setType
to set the appropriate token type).

Silvain

> > -----Original Message-----
> > From: Paul J. Lucas [mailto:dude at darkfigure.org]
> > Sent: Wednesday, October 23, 2002 10:05 AM
> > To: antlr-interest at yahoogroups.com
> > Subject: [antlr-interest] Ignoring lexer rules
> >
> >
> > If I have the following in a lexer:
> >
> > FOO
> > : { isFoo() }? "foo"
> > ;
> >
> > BAR
> > : ('a'..'z')+
> > ;
> >
> > What I want is that if isFoo() is false, then the more
> > generic rule BAR to be used.  Is the above sufficient or must
> > I do something like:
> >
> > FOO
> > : { isFoo() }? "foo"
> > | BAR { $setType( BAR ); }
> > ;
> >
> > BAR
> > : ('a'..'z')+
> > ;
> >
> > that?
> >
> > - Paul
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>



 

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



More information about the antlr-interest mailing list