[antlr-interest] Problem with matching a keyword and a generic identifier

rradh rradh at yahoo.com
Mon Aug 26 12:14:35 PDT 2002


Hi,

I want the lexer to distinguish between:

rule:
      skip_rule | ARRAY_REF
    ;


skip_rule: "skip" '[' <digits> ']'

Inside the Lexer:

ARRAY_REF
options{ testLiterals=true; }
 : ('a'..'z')+ '[' <digitis> ']';


Currently for an input: skip[20] is being matched to ARRAY_REF and 
not 'skip_rule'.

I know I can check in ARRAY_REF if "skip" is in the input string but 
I don't want to do that. Is there any way to force the lexer to 
recognize the "skip" keyword?

Thanks
Rajesh



 

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



More information about the antlr-interest mailing list