[antlr-interest] lexing expression ('a'..'z')+ not matching single character input

Loring Craymer lgcraymer at yahoo.com
Thu Dec 14 09:55:45 PST 2006


--- Matt Harrison <matt at ebi.ac.uk> wrote:

 
> Indeed it has :-) Now that we've identified the
> problem, I'm fearful  
> of what the correct solution to my problem will be
> ;-)

What you need are another ANTLR feature:  semantic
predicates.

In the appropriate place in your parser grammar,
recognize 'n' as:

{ input.LT(1).equals("n") }? IDENTIFIER

(I may have the wrong java code here).  This will also
work in ANTLR 2, but not always (no hoisting of
predicates).

--Loring


> 
> cheers,
> Matt
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the antlr-interest mailing list