[antlr-interest] EOF token insertion, ArrayIndexOutOfBounds

Felix Dorner felix_do at web.de
Sat May 24 04:50:45 PDT 2008


Hey,

I have this rule:

body    
    : statement* EOF -> ^(SLIST["BODY"] statement*)
    ;

If no statement is matched, but the next token isn't EOF either, 
eventuall this operation is called, with expectedTokenType = -1,

protected Object getMissingSymbol(IntStream input,
                                      RecognitionException e,
                                      int expectedTokenType,
                                      BitSet follow)
    {
        String tokenText =
            "<missing "+getTokenNames()[expectedTokenType]+">";
    ...
}

Which obviously explodes with an ArrayIndexOutOfBounds exception.

Something I can do against this?





More information about the antlr-interest mailing list