public void addRulesForSyntacticPredicates() { // Get syn pred rules and add to existing tree List<? extends GrammarAST> synpredRules = getArtificialRulesForSyntacticPredicates(nameToSynpredASTMap); for (int i = 0; i < synpredRules.size(); i++) { GrammarAST rAST = (GrammarAST) synpredRules.get(i); grammarTree.addChild(rAST); } }
public void addRulesForSyntacticPredicates() { // Get syn pred rules and add to existing tree List<? extends GrammarAST> synpredRules = getArtificialRulesForSyntacticPredicates(nameToSynpredASTMap); for (int i = 0; i < synpredRules.size(); i++) { GrammarAST rAST = (GrammarAST) synpredRules.get(i); grammarTree.addChild(rAST); } }
/**Duplicate a tree, assuming this is a root node of a tree-- * duplicate that node and what's below; ignore siblings of root node. */ public static GrammarAST dupTreeNoActions(GrammarAST t, GrammarAST parent) { if ( t==null ) { return null; } GrammarAST result = (GrammarAST)t.dupNode(); for (GrammarAST subchild : getChildrenForDupTree(t)) { result.addChild(dupTreeNoActions(subchild, result)); } return result; }
/**Duplicate a tree, assuming this is a root node of a tree-- * duplicate that node and what's below; ignore siblings of root node. */ public static GrammarAST dupTreeNoActions(GrammarAST t, GrammarAST parent) { if ( t==null ) { return null; } GrammarAST result = (GrammarAST)t.dupNode(); for (GrammarAST subchild : getChildrenForDupTree(t)) { result.addChild(dupTreeNoActions(subchild, result)); } return result; }
public static GrammarAST dupTree(GrammarAST t) { if ( t==null ) { return null; } GrammarAST root = dup(t); // make copy of root // copy all children of root. for (int i= 0; i < t.getChildCount(); i++) { GrammarAST child = (GrammarAST)t.getChild(i); root.addChild(dupTree(child)); } return root; }
public void addRule(GrammarAST grammarTree, GrammarAST t) { GrammarAST p = null; for (int i = 0; i < grammarTree.getChildCount(); i++ ) { p = (GrammarAST)grammarTree.getChild(i); if (p == null || p.getType() == ANTLRParser.RULE || p.getType() == ANTLRParser.PREC_RULE) { break; } } if (p != null) { grammarTree.addChild(t); } }
public static GrammarAST dupTree(GrammarAST t) { if ( t==null ) { return null; } GrammarAST root = dup(t); // make copy of root // copy all children of root. for (int i= 0; i < t.getChildCount(); i++) { GrammarAST child = (GrammarAST)t.getChild(i); root.addChild(dupTree(child)); } return root; }
public void addRule(GrammarAST grammarTree, GrammarAST t) { GrammarAST p = null; for (int i = 0; i < grammarTree.getChildCount(); i++ ) { p = (GrammarAST)grammarTree.getChild(i); if (p == null || p.getType() == ANTLRParser.RULE || p.getType() == ANTLRParser.PREC_RULE) { break; } } if (p != null) { grammarTree.addChild(t); } }
p = (GrammarAST)p.getNextSibling(); p.addChild(parser.getAST());
p = (GrammarAST)p.getNextSibling(); p.addChild(parser.getAST());
for (int i = 0; i < synpredRules.size(); i++) { GrammarAST rAST = (GrammarAST) synpredRules.get(i); grammarTree.addChild(rAST);
for (int i = 0; i < synpredRules.size(); i++) { GrammarAST rAST = (GrammarAST) synpredRules.get(i); grammarTree.addChild(rAST);