public CommonTree getFirstDescendantWithType(int type) { if ( getType()==type ) return this; if ( children==null ) return null; for (Object c : children) { GrammarAST t = (GrammarAST)c; if ( t.getType()==type ) return t; CommonTree d = t.getFirstDescendantWithType(type); if ( d!=null ) return d; } return null; }
public CommonTree getFirstDescendantWithType(int type) { if ( getType()==type ) return this; if ( children==null ) return null; for (Object c : children) { GrammarAST t = (GrammarAST)c; if ( t.getType()==type ) return t; CommonTree d = t.getFirstDescendantWithType(type); if ( d!=null ) return d; } return null; }
public CommonTree getFirstDescendantWithType(int type) { if ( getType()==type ) return this; if ( children==null ) return null; for (Object c : children) { GrammarAST t = (GrammarAST)c; if ( t.getType()==type ) return t; CommonTree d = t.getFirstDescendantWithType(type); if ( d!=null ) return d; } return null; }
@Override protected void exitSubrule(GrammarAST tree) { if (tree.getType() == CLOSURE || tree.getType() == POSITIVE_CLOSURE) { for (Map.Entry<String, MutableInt> entry : frequencies.peek().entrySet()) { entry.getValue().v = 2; } } if (tree.getType() == CLOSURE || tree.getType() == OPTIONAL) { // Everything inside a closure is optional, so the minimum // number of occurrences for all elements is 0. minFrequencies.peek().clear(); } }
@Override public Object pre(Object t) { if ( ((GrammarAST)t).getType() == 3 ) { return expandParameterizedLoop((GrammarAST)t); } return t; } @Override
@Override public Object pre(Object t) { if ( ((GrammarAST)t).getType() == 3 ) { return expandParameterizedLoop((GrammarAST)t); } return t; } @Override
@Override public Object pre(Object t) { if ( ((GrammarAST)t).getType() == 3 ) { return expandParameterizedLoop((GrammarAST)t); } return t; } @Override
public CommonTree getFirstDescendantWithType(org.antlr.runtime.BitSet types) { if ( types.member(getType()) ) return this; if ( children==null ) return null; for (Object c : children) { GrammarAST t = (GrammarAST)c; if ( types.member(t.getType()) ) return t; CommonTree d = t.getFirstDescendantWithType(types); if ( d!=null ) return d; } return null; }
public CommonTree getFirstDescendantWithType(org.antlr.runtime.BitSet types) { if ( types.member(getType()) ) return this; if ( children==null ) return null; for (Object c : children) { GrammarAST t = (GrammarAST)c; if ( types.member(t.getType()) ) return t; CommonTree d = t.getFirstDescendantWithType(types); if ( d!=null ) return d; } return null; }
public CommonTree getFirstDescendantWithType(org.antlr.runtime.BitSet types) { if ( types.member(getType()) ) return this; if ( children==null ) return null; for (Object c : children) { GrammarAST t = (GrammarAST)c; if ( types.member(t.getType()) ) return t; CommonTree d = t.getFirstDescendantWithType(types); if ( d!=null ) return d; } return null; }
private String getName(GrammarAST token) { String tokenText = token.getText(); String tokenName = token.getType() != STRING_LITERAL ? tokenText : token.g.getTokenName(tokenText); return tokenName == null || tokenName.startsWith("T__") ? null : tokenName; // Do not include tokens with auto generated names }
@Override public void label(GrammarAST op, GrammarAST ID, GrammarAST element) { LabelElementPair lp = new LabelElementPair(g, ID, element, op.getType()); currentRule.alt[currentOuterAltNumber].labelDefs.map(ID.getText(), lp); }
public void getNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types) { if ( types.contains(this.getType()) ) nodes.add(this); // walk all children of root. for (int i= 0; i < getChildCount(); i++) { GrammarAST child = (GrammarAST)getChild(i); child.getNodesWithTypePreorderDFS_(nodes, types); } }
public void getNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types) { if ( types.contains(this.getType()) ) nodes.add(this); // walk all children of root. for (int i= 0; i < getChildCount(); i++) { GrammarAST child = (GrammarAST)getChild(i); child.getNodesWithTypePreorderDFS_(nodes, types); } }
public void getNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types) { if ( types.contains(this.getType()) ) nodes.add(this); // walk all children of root. for (int i= 0; i < getChildCount(); i++) { GrammarAST child = (GrammarAST)getChild(i); child.getNodesWithTypePreorderDFS_(nodes, types); } }
@Override public void label(GrammarAST op, GrammarAST ID, GrammarAST element) { LabelElementPair lp = new LabelElementPair(g, ID, element, op.getType()); currentRule.alt[currentOuterAltNumber].labelDefs.map(ID.getText(), lp); }
public void getNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types) { if ( types.contains(this.getType()) ) nodes.add(this); // walk all children of root. for (int i= 0; i < getChildCount(); i++) { GrammarAST child = (GrammarAST)getChild(i); child.getNodesWithTypePreorderDFS_(nodes, types); } }