[antlr-interest] Unable to make a single token to match

ycmichelid michel_cedric at hotmail.com
Fri Feb 8 09:11:02 PST 2002

I'm unable to make a single token to match with ANTLR 2.7.1 (java).
I get an exception during the recognition of the first token of my
I've got one file for the parser and one for the lexer.

-rules from the parser (all java code is removed here):

options {
  k = 2;

-rules from the lexer (rule to skip whitespaces is present but not
reproduced here):

options {
  exportVocab = L;
  k =6;
  caseSensitive = true;
  testLiterals = true;
  caseSensitiveLiterals = true;
ALERT: "Alert";
OPENPAR      : "(" ;
FUNCNAME : ('A'..'Z')( 'a'..'z' |  'A'..'Z' | '0'..'9' | '_' )+ ;

The data to parse(without double quotes:
"Alert NFSMount ("

Results of execution (functions consume() & consumeUntil() removed
from the generated java code):

> debut;  > lexer mALERT; c==A
 < lexer mALERT; c==
line 1: expecting ALERT, found 'Alert'
        at antlr.Parser.match(Parser.java:180)
        at AdeleParser.debut(AdeleParser.java:113)
        at AdeleParser.parseFile(AdeleParser.java:66)
        at AdeleParser.main(AdeleParser.java:39)
 < debut; LA(1)==Alert

If I remove the ALERT rule from the lexer and replace it with the
literal "Alert" in the parser, the error message is:

line 1: expecting "Alert", found 'Alert'

Does anybody have an idea of why it's going wrong?


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

More information about the antlr-interest mailing list