[antlr-interest] Re: Premature lexer matching

Terence Parr parrt at jguru.com
Wed Nov 13 11:20:06 PST 2002


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

> --- In antlr-interest at y..., "Silvain Piree" <s.piree at e...> wrote:
>> You should merge rules FOO and BAR, e.g.
>>
>> FOO
>> : ("foo" "::") => "foo" { $setType( FOO_1 ); }
>> | ("foo" '(') => "foo" { $setType( FOO_2 ); }
>> | BAR { $setType( BAR ); }
>> ;
>>
>> private BAR
>> : ('a'..'z')+
>> ;
>
> But BAR is a valid token in the grammar; hence it can not be private.

Yes, but all BAR's will be match properly by entering rule FOO, right?

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