diff --git a/tool/src/org/antlr/v4/parse/GrammarTreeVisitor.g b/tool/src/org/antlr/v4/parse/GrammarTreeVisitor.g index f41ac29e8..2c5fb4545 100644 --- a/tool/src/org/antlr/v4/parse/GrammarTreeVisitor.g +++ b/tool/src/org/antlr/v4/parse/GrammarTreeVisitor.g @@ -96,7 +96,7 @@ public ErrorManager getErrorManager() { return null; } public void visitGrammar(GrammarAST t) { visit(t, "grammarSpec"); } public void visit(GrammarAST t, String ruleName) { - CommonTreeNodeStream nodes = new CommonTreeNodeStream(t); + CommonTreeNodeStream nodes = new CommonTreeNodeStream(new GrammarASTAdaptor(), t); setTreeNodeStream(nodes); try { Method m = getClass().getMethod(ruleName); diff --git a/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java b/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java index 69dc0f0ae..19360914e 100644 --- a/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java +++ b/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java @@ -30,6 +30,7 @@ package org.antlr.v4.tool; import org.antlr.runtime.CommonToken; +import org.antlr.runtime.tree.CommonTreeNodeStream; import org.antlr.runtime.tree.Tree; import org.antlr.runtime.tree.TreeVisitor; import org.antlr.runtime.tree.TreeVisitorAction; @@ -76,8 +77,7 @@ public class GrammarTransformPipeline { } public void reduceBlocksToSets(GrammarAST root) { - org.antlr.runtime.tree.CommonTreeNodeStream nodes = - new org.antlr.runtime.tree.CommonTreeNodeStream(root); + CommonTreeNodeStream nodes = new CommonTreeNodeStream(new GrammarASTAdaptor(), root); GrammarASTAdaptor adaptor = new GrammarASTAdaptor(); BlockSetTransformer transformer = new BlockSetTransformer(nodes, g); transformer.setTreeAdaptor(adaptor);