[antlr-interest] Has anyone seen this kind of stack trace?

Alan D. Cabrera list at toolazydogs.com
Tue Nov 29 17:43:01 PST 2011


On Nov 29, 2011, at 3:54 PM, Terence Parr wrote:

> Ok, i see it now too:
> 
> /tmp $ a3.4 LuaWalker.g 
> error(10):  internal error: LuaWalker.g : java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 64
> java.util.Vector.set(Vector.java:712)
> org.antlr.analysis.DFA.createMinMaxTables(DFA.java:535)
> 
> damn.
> 
> Alan: did you modify the grammars in any way? that might give me a clue. added to the list.
> 
> http://www.antlr.org/jira/browse/ANTLR-457
> 
> is this something you can workaround for now?
> 
> Ter

Ok, I removed some lines, file attached, and it generates fine but now I get errors for the following code

        String chunk = "g()[i], i, a.b = 1, 2, f()\ndo\nlocal line, foo = \"Hello world!\", 2\nprint(line)\nend\nreturn nil";
        System.out.println(chunk);
        LuaParser p = generateParser(chunk);

        RuleReturnScope r = print(p.chunk());

        CommonTree tree = (CommonTree)r.getTree();

        CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree);
        LuaWalker tp = new LuaWalker(nodes);
        tp.chunk();



g()[i], i, a.b = 1, 2, f()
do
local line, foo = "Hello world!", 2
print(line)
end
return nil
(CHUNK (ASSIGN (VARLIST (INDEX (FUNCALL (VAR g) (ARGS EXPLIST)) (VAR i)) (VAR i) (INDEX (VAR a) (STRING b))) (EXPLIST 1 2 (FUNCALL (VAR f) (ARGS EXPLIST)))) (CHUNK (LOCAL (NAMELIST line foo) (EXPLIST (STRING Hello world!) 2)) (FUNCALL (VAR print) (ARGS (EXPLIST (VAR line))))) (RETURN (EXPLIST nil)))

java.util.NoSuchElementException: can't look backwards more than one token in this stream
	at org.antlr.runtime.misc.LookaheadStream.LB(LookaheadStream.java:159)
	at org.antlr.runtime.misc.LookaheadStream.LT(LookaheadStream.java:120)
	at org.antlr.runtime.RecognitionException.extractInformationFromTreeNodeStream(RecognitionException.java:144)
	at org.antlr.runtime.RecognitionException.<init>(RecognitionException.java:111)
	at org.antlr.runtime.MismatchedTreeNodeException.<init>(MismatchedTreeNodeException.java:42)
	at org.antlr.runtime.tree.TreeParser.recoverFromMismatchedToken(TreeParser.java:135)
	at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115)
	at com.toolazydogs.lua4j.LuaWalker.chunk(LuaWalker.java:178)
	at com.toolazydogs.lua4j.LuaWalkerTest.odd(LuaWalkerTest.java:96)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at com.toolazydogs.aunit.internal.RunBefores.evaluate(RunBefores.java:43)
	at com.toolazydogs.aunit.internal.RunAfters.evaluate(RunAfters.java:47)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:71)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:199)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)




-------------- next part --------------
A non-text attachment was scrubbed...
Name: LuaWalkerGenerates.g
Type: application/octet-stream
Size: 3643 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20111129/15e9b2b2/attachment.obj 


More information about the antlr-interest mailing list