[antlr-interest] java.lang.ArrayIndexOutOfBoundsException: 0

Diane Nkonyereza nkodidi at hotmail.com
Thu Mar 27 05:02:47 PDT 2008


I got this while testing my grammar. The grammar is an alteration of the java grammar.
Could anyone please help me to understand what's happening.



Exception in thread 'main' java.lang.ArrayIndexOutOfBoundsException: 0
        at org.antlr.runtime.DFA.predict(DFA.java:59)
        at JackXMLLexer.mTokens(JackXMLLexer.java:3911)
        at org.antlr.runtime.Lexer.nextToken(Lexer.java:109)
        at org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenStream.java
:95)
        at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:238)
        at org.antlr.runtime.debug.DebugTokenStream.<init>(DebugTokenStream.java
:45)
        at org.antlr.runtime.debug.DebugParser.<init>(DebugParser.java:56)
        at classes.classesRules.JackXMLParser.<init>(JackXMLParser.java:103)
        at classes.classesRules.JackXMLParser.<init>(JackXMLParser.java:115)
        at TestJackXML.main(TestJackXML.java:9)

The  lines in the parser (103 - 105) are:

 switch (alt2) {
                case 1 :
                    // JackXML.g:0:0: importDeclaration
                    {
                    pushFollow(FOLLOW_importDeclaration_in_compilationUnit74);
                    importDeclaration();
                    _fsp--;
                    if (failed) return ;

                    }
                    break;

                default :
                    break loop2;
                }

If it helps to understand the error by looking at the whole grammar, please let me know.

Cheers,
D.

_________________________________________________________________
Win 100’s of Virgin Experience days with BigSnapSearch.com
http://www.bigsnapsearch.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080327/b4d9b586/attachment.html 


More information about the antlr-interest mailing list