[antlr-interest] ANTLR 3.4 version Jul 19, 2011 Incorrectly transforms test grammar.

The Researcher researcher0x00 at gmail.com
Fri Sep 23 05:19:16 PDT 2011


The following demo grammar causes ANTLR 3.4 to generate an invalid parser.
The conditional for the if statement is empty.

grammar Demo002;
number  : '0'..'9';

java -classpath /usr/local/lib/antlr-3.4-complete.jar  org.antlr.Tool
Demo002

In Demo002Parser.java

            // Demo002.g:3:9: ( '0' .. '9' )
            // Demo002.g:
            {
            if (  ) {
                input.consume();
                state.errorRecovery=false;
            }
            else {
                MismatchedSetException mse = new
MismatchedSetException(null,input);
                throw mse;
            }

            }

java -classpath /usr/local/lib/antlr-3.3-complete.jar  org.antlr.Tool
Demo002.g

            // Demo002.g:3:9: ( '0' .. '9' )
            // Demo002.g:3:11: '0' .. '9'
            {
            matchRange('0','9');
            }


More information about the antlr-interest mailing list