Hi!

FYI,

I've ran into a problem with the LL1Analyzer:
Upon adding a syntactic predicate to resolve an ambiguous function  
prototype in SQL both 3.1b1 and b2 crashed:

classdump:sqlparser kroepke$ antlr312 MySQL51.g
ANTLR Parser Generator  Version 3.1b2 (July 17, 2008)  1989-2008
error(10):  internal error: MySQL51.g :  
java.lang.IndexOutOfBoundsException: Index: 32, Size: 32
java.util.ArrayList.RangeCheck(ArrayList.java:546)
java.util.ArrayList.get(ArrayList.java:321)
org.antlr.misc.IntervalSet.addAll(IntervalSet.java:197)
org.antlr.analysis.LookaheadSet.orInPlace(LookaheadSet.java:56)
org.antlr.analysis.LL1Analyzer._FIRST(LL1Analyzer.java:270)
org.antlr.analysis.LL1Analyzer._FIRST(LL1Analyzer.java:268)
org.antlr.analysis.LL1Analyzer._FIRST(LL1Analyzer.java:239)
org.antlr.analysis.LL1Analyzer.FIRST(LL1Analyzer.java:150)
org.antlr.tool.Grammar.FIRST(Grammar.java:2924)
org.antlr.codegen.CodeGenerator.generateLocalFOLLOW(CodeGenerator.java: 
572)
org.antlr.codegen.CodeGenTreeWalker.atom(CodeGenTreeWalker.java:2075)
org.antlr.codegen.CodeGenTreeWalker.element(CodeGenTreeWalker.java:1684)
org.antlr.codegen.CodeGenTreeWalker.alternative(CodeGenTreeWalker.java: 
1288)
org.antlr.codegen.CodeGenTreeWalker.block(CodeGenTreeWalker.java:1063)
org.antlr.codegen.CodeGenTreeWalker.rule(CodeGenTreeWalker.java:779)
org.antlr.codegen.CodeGenTreeWalker.rules(CodeGenTreeWalker.java:570)
org.antlr.codegen.CodeGenTreeWalker.grammarSpec(CodeGenTreeWalker.java: 
512)
org.antlr.codegen.CodeGenTreeWalker.grammar(CodeGenTreeWalker.java:330)
org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:426)
org.antlr.Tool.generateRecognizer(Tool.java:419)
org.antlr.Tool.process(Tool.java:286)
org.antlr.Tool.main(Tool.java:71)

The code in question (addAll) looked fine, so I spent a bit time in  
the debugger.
In the end the problem was that an IntervalSet was added to itself,  
which resulted in that odd exception.
Adding a check for that in LookaheadSet seems to duct-tape the issue,  
but of course there's an underlying problem which needs solving.

Of course, I was unable to reproduce it with a smaller grammar (and  
also of course I can't release this big one yet) :(

cheers,
-k
-- 
Kay Röpke
http://classdump.org/






_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org:8080/mailman/listinfo/antlr-dev

Reply via email to