[antlr-interest] Bug Report: AST operators not working when a file has the backtrack=true option

Alexandre Porcelli porcelli at uol.com.br
Thu May 10 07:18:42 PDT 2007


Hi All,

  I think I found a bug... when I try to add AST operators in my
grammar, I got the following error:

[11:12:44] error(100): Expr.g:0:0: syntax error: assign.types:
<AST>:0:0: unexpected end of subtree
[11:12:44] java.lang.ClassCastException: antlr.ASTNULLType cannot be
cast to org.antlr.tool.GrammarAST
	at org.antlr.tool.AssignTokenTypesWalker.block(AssignTokenTypesWalker.java:1215)
	at org.antlr.tool.AssignTokenTypesWalker.rule(AssignTokenTypesWalker.java:1030)
	at org.antlr.tool.AssignTokenTypesWalker.rules(AssignTokenTypesWalker.java:610)
	at org.antlr.tool.AssignTokenTypesWalker.grammarSpec(AssignTokenTypesWalker.java:492)
	at org.antlr.tool.AssignTokenTypesWalker.grammar(AssignTokenTypesWalker.java:363)
	at org.antlr.tool.Grammar.setGrammarContent(Grammar.java:540)
	at org.antlr.tool.Grammar.setGrammarContent(Grammar.java:490)
	at org.antlr.works.grammar.EngineGrammar.createNewGrammar(Unknown Source)
	at org.antlr.works.grammar.EngineGrammar.createCombinedGrammar(Unknown Source)
	at org.antlr.works.grammar.EngineGrammar.createGrammars(Unknown Source)
	at org.antlr.works.grammar.EngineGrammar.analyze(Unknown Source)
	at org.antlr.works.grammar.CheckGrammar.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

  I could isolate the problem and I checked that it occurs just when
you have the backtrack option set to true and it happens just with
tree operators (it works with rewrite rules).
  Attached there is a sample grammar.

Best Regards,
Alexandre Porcelli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Expr.g
Type: application/octet-stream
Size: 594 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20070510/e0720da5/attachment.obj 


More information about the antlr-interest mailing list