[antlr-interest] Bug in multiple rule parameters

Olivier Lefevre lefevrol at yahoo.com
Sun Feb 24 07:56:53 PST 2008


I hit a subtle bug in the syntax of multiple rules parameters. Run ANTLR 
against the following grammar:

    grammar Bug1;
    top : name='?' sub["XX", $name.text];
    sub[String x, String y] : ;

and the sub call in Bug1Parser will read

    sub("XX",  , name.getText());

i.e., there is a spurious comma. This is a fragile bug in the sense that 
other forms of sub call, e.g., sub["XX", "XX"] and sub[$name.text, "XX"] do 
not trigger it.

-- O.L.




More information about the antlr-interest mailing list