@Override public void discoverLexerRule(RuleAST rule, GrammarAST ID, List<GrammarAST> modifiers, GrammarAST block) { int numAlts = block.getChildCount(); Rule r = new Rule(g, ID.getText(), rule, numAlts); r.mode = currentModeName; if ( !modifiers.isEmpty() ) r.modifiers = modifiers; rules.put(r.name, r); } }
@Override public void discoverLexerRule(RuleAST rule, GrammarAST ID, List<GrammarAST> modifiers, GrammarAST block) { int numAlts = block.getChildCount(); Rule r = new Rule(g, ID.getText(), rule, numAlts); r.mode = currentModeName; if ( !modifiers.isEmpty() ) r.modifiers = modifiers; rules.put(r.name, r); } }
@Override public void discoverLexerRule(RuleAST rule, GrammarAST ID, List<GrammarAST> modifiers, GrammarAST block) { int numAlts = block.getChildCount(); Rule r = new Rule(g, ID.getText(), rule, numAlts); r.mode = currentModeName; if ( !modifiers.isEmpty() ) r.modifiers = modifiers; rules.put(r.name, r); } }
@Override public void discoverLexerRule(RuleAST rule, GrammarAST ID, List<GrammarAST> modifiers, GrammarAST block) { int numAlts = block.getChildCount(); Rule r = new Rule(g, ID.getText(), rule, numAlts); r.mode = currentModeName; if ( !modifiers.isEmpty() ) r.modifiers = modifiers; rules.put(r.name, r); } }
@Override public void discoverLexerRule(RuleAST rule, GrammarAST ID, List<GrammarAST> modifiers, GrammarAST block) { int numAlts = block.getChildCount(); Rule r = new Rule(g, ID.getText(), rule, numAlts); r.mode = currentModeName; if ( !modifiers.isEmpty() ) r.modifiers = modifiers; rules.put(r.name, r); } }
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); } }
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 defineAction(GrammarAST atAST) { if ( atAST.getChildCount()==2 ) { String name = atAST.getChild(0).getText(); namedActions.put(name, (ActionAST)atAST.getChild(1)); } else { String scope = atAST.getChild(0).getText(); String gtype = getTypeString(); if ( scope.equals(gtype) || (scope.equals("parser")&>ype.equals("combined")) ) { String name = atAST.getChild(1).getText(); namedActions.put(name, (ActionAST)atAST.getChild(2)); } } }
public void defineAction(GrammarAST atAST) { if ( atAST.getChildCount()==2 ) { String name = atAST.getChild(0).getText(); namedActions.put(name, (ActionAST)atAST.getChild(1)); } else { String scope = atAST.getChild(0).getText(); String gtype = getTypeString(); if ( scope.equals(gtype) || (scope.equals("parser")&>ype.equals("combined")) ) { String name = atAST.getChild(1).getText(); namedActions.put(name, (ActionAST)atAST.getChild(2)); } } }
public void defineAction(GrammarAST atAST) { if ( atAST.getChildCount()==2 ) { String name = atAST.getChild(0).getText(); namedActions.put(name, (ActionAST)atAST.getChild(1)); } else { String scope = atAST.getChild(0).getText(); String gtype = getTypeString(); if ( scope.equals(gtype) || (scope.equals("parser")&>ype.equals("combined")) ) { String name = atAST.getChild(1).getText(); namedActions.put(name, (ActionAST)atAST.getChild(2)); } } }
void checkNumRules(GrammarAST rulesNode) { if ( rulesNode.getChildCount()==0 ) { GrammarAST root = (GrammarAST)rulesNode.getParent(); GrammarAST IDNode = (GrammarAST)root.getChild(0); g.tool.errMgr.grammarError(ErrorType.NO_RULES, g.fileName, null, IDNode.getText(), g); } }
void checkNumRules(GrammarAST rulesNode) { if ( rulesNode.getChildCount()==0 ) { GrammarAST root = (GrammarAST)rulesNode.getParent(); GrammarAST IDNode = (GrammarAST)root.getChild(0); g.tool.errMgr.grammarError(ErrorType.NO_RULES, g.fileName, null, IDNode.getText(), g); } }
void checkNumRules(GrammarAST rulesNode) { if ( rulesNode.getChildCount()==0 ) { GrammarAST root = (GrammarAST)rulesNode.getParent(); GrammarAST IDNode = (GrammarAST)root.getChild(0); g.tool.errMgr.grammarError(ErrorType.NO_RULES, g.fileName, null, IDNode.getText(), g); } }
void checkNumRules(GrammarAST rulesNode) { if ( rulesNode.getChildCount()==0 ) { GrammarAST root = (GrammarAST)rulesNode.getParent(); GrammarAST IDNode = (GrammarAST)root.getChild(0); g.tool.errMgr.grammarError(ErrorType.NO_RULES, g.fileName, null, IDNode.getText(), g); } }
void checkNumRules(GrammarAST rulesNode) { if ( rulesNode.getChildCount()==0 ) { GrammarAST root = (GrammarAST)rulesNode.getParent(); GrammarAST IDNode = (GrammarAST)root.getChild(0); g.tool.errMgr.grammarError(ErrorType.NO_RULES, g.fileName, null, IDNode.getText(), g); } }
public GrammarAST getNodeWithTokenIndex(int index) { if ( this.getToken()!=null && this.getToken().getTokenIndex()==index ) { return this; } // walk all children of root. for (int i= 0; i < getChildCount(); i++) { GrammarAST child = (GrammarAST)getChild(i); GrammarAST result = child.getNodeWithTokenIndex(index); if ( result!=null ) { return result; } } return null; }
public GrammarAST getNodeWithTokenIndex(int index) { if ( this.getToken()!=null && this.getToken().getTokenIndex()==index ) { return this; } // walk all children of root. for (int i= 0; i < getChildCount(); i++) { GrammarAST child = (GrammarAST)getChild(i); GrammarAST result = child.getNodeWithTokenIndex(index); if ( result!=null ) { return result; } } return null; }