[antlr-interest] Bug in ANTLRv3.g

Víctor Manuel Sánchez Cartagena vitaka at gmail.com
Tue Jul 29 10:53:28 PDT 2008


I think I have found a bug in the ANTLRv3.g grammar.
I build the lexer and the parser with ANTLR, and when I try to parse the
following grammar, it fails, although the grammar is correct.

grammar plp2;
@members {
  public String refactor_rename_this;
  public String refactor_rename_to;
}
s returns [String value]
    :
                // It doesn't fail:
                 c["aa"]
                // It fails:
                //c[""]
    ;
c[String ambito] returns [String value]
    :    'class' ID
        {
                     // It doesn't fail:
                      $value= "class " + $ID.text + " n;" + "{}n";
                     // It fails:
                     // $value= "class " + $ID.text + " n;" + "}n";
                }
    ;
ID    :    ('a'..'z'|'A'..'Z')('a'..'z'|'A'..'Z'|'0'..'9')*
    ;
ENTERO    :    ('0'..'9')+
    ;

Could anyone help me to find out what's wrong in ANTLRv3.g?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080729/180c1b28/attachment.html 


More information about the antlr-interest mailing list