public ActionAST getLexerAction() { Tree blk = getFirstChildWithType(ANTLRParser.BLOCK); if ( blk.getChildCount()==1 ) { Tree onlyAlt = blk.getChild(0); Tree lastChild = onlyAlt.getChild(onlyAlt.getChildCount()-1); if ( lastChild.getType()==ANTLRParser.ACTION ) { return (ActionAST)lastChild; } } return null; }
public ActionAST getLexerAction() { Tree blk = getFirstChildWithType(ANTLRParser.BLOCK); if ( blk.getChildCount()==1 ) { Tree onlyAlt = blk.getChild(0); Tree lastChild = onlyAlt.getChild(onlyAlt.getChildCount()-1); if ( lastChild.getType()==ANTLRParser.ACTION ) { return (ActionAST)lastChild; } } return null; }
public ActionAST getLexerAction() { Tree blk = getFirstChildWithType(ANTLRParser.BLOCK); if ( blk.getChildCount()==1 ) { Tree onlyAlt = blk.getChild(0); Tree lastChild = onlyAlt.getChild(onlyAlt.getChildCount()-1); if ( lastChild.getType()==ANTLRParser.ACTION ) { return (ActionAST)lastChild; } } return null; }
public ActionAST getLexerAction() { Tree blk = getFirstChildWithType(ANTLRParser.BLOCK); if ( blk.getChildCount()==1 ) { Tree onlyAlt = blk.getChild(0); Tree lastChild = onlyAlt.getChild(onlyAlt.getChildCount()-1); if ( lastChild.getType()==ANTLRParser.ACTION ) { return (ActionAST)lastChild; } } return null; }
public ActionAST getLexerAction() { Tree blk = getFirstChildWithType(ANTLRParser.BLOCK); if ( blk.getChildCount()==1 ) { Tree onlyAlt = blk.getChild(0); Tree lastChild = onlyAlt.getChild(onlyAlt.getChildCount()-1); if ( lastChild.getType()==ANTLRParser.ACTION ) { return (ActionAST)lastChild; } } return null; }
BlockAST ruleBlk = (BlockAST)t.getFirstChildWithType(ANTLRParser.BLOCK); AltAST mainAlt = (AltAST)ruleBlk.getChild(0); BlockAST primaryBlk = (BlockAST)mainAlt.getChild(0);
BlockAST ruleBlk = (BlockAST)t.getFirstChildWithType(ANTLRParser.BLOCK); AltAST mainAlt = (AltAST)ruleBlk.getChild(0); BlockAST primaryBlk = (BlockAST)mainAlt.getChild(0);
BlockAST ruleBlk = (BlockAST)t.getFirstChildWithType(ANTLRParser.BLOCK); AltAST mainAlt = (AltAST)ruleBlk.getChild(0); BlockAST primaryBlk = (BlockAST)mainAlt.getChild(0);
protected void _createATN(Collection<Rule> rules) { createRuleStartAndStopATNStates(); GrammarASTAdaptor adaptor = new GrammarASTAdaptor(); for (Rule r : rules) { // find rule's block GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); ATNBuilder b = new ATNBuilder(nodes,this); try { setCurrentRuleName(r.name); Handle h = b.ruleBlock(null); rule(r.ast, r.name, h); } catch (RecognitionException re) { ErrorManager.fatalInternalError("bad grammar AST structure", re); } } }
protected void _createATN(Collection<Rule> rules) { createRuleStartAndStopATNStates(); GrammarASTAdaptor adaptor = new GrammarASTAdaptor(); for (Rule r : rules) { // find rule's block GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); ATNBuilder b = new ATNBuilder(nodes,this); try { setCurrentRuleName(r.name); Handle h = b.ruleBlock(null); rule(r.ast, r.name, h); } catch (RecognitionException re) { ErrorManager.fatalInternalError("bad grammar AST structure", re); } } }
protected void _createATN(Collection<Rule> rules) { createRuleStartAndStopATNStates(); GrammarASTAdaptor adaptor = new GrammarASTAdaptor(); for (Rule r : rules) { // find rule's block GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); ATNBuilder b = new ATNBuilder(nodes,this); try { setCurrentRuleName(r.name); Handle h = b.ruleBlock(null); rule(r.ast, r.name, h); } catch (RecognitionException re) { ErrorManager.fatalInternalError("bad grammar AST structure", re); } } }
protected void _createATN(Collection<Rule> rules) { createRuleStartAndStopATNStates(); GrammarASTAdaptor adaptor = new GrammarASTAdaptor(); for (Rule r : rules) { // find rule's block GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); ATNBuilder b = new ATNBuilder(nodes,this); try { setCurrentRuleName(r.name); Handle h = b.ruleBlock(null); rule(r.ast, r.name, h); } catch (RecognitionException re) { ErrorManager.fatalInternalError("bad grammar AST structure", re); } } }
@Override public void finishRule(RuleAST rule, GrammarAST ID, GrammarAST block) { if ( rule.isLexerRule() ) return; BlockAST blk = (BlockAST)rule.getFirstChildWithType(BLOCK); int nalts = blk.getChildCount(); GrammarAST idAST = (GrammarAST)rule.getChild(0);
@Override public void finishRule(RuleAST rule, GrammarAST ID, GrammarAST block) { if ( rule.isLexerRule() ) return; BlockAST blk = (BlockAST)rule.getFirstChildWithType(BLOCK); int nalts = blk.getChildCount(); GrammarAST idAST = (GrammarAST)rule.getChild(0);
protected void _createATN(@NotNull Collection<Rule> rules) { createRuleStartAndStopATNStates(); GrammarASTAdaptor adaptor = new GrammarASTAdaptor(); for (Rule r : rules) { // find rule's block GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); ATNBuilder b = new ATNBuilder(nodes,this); try { setCurrentRuleName(r.name); Handle h = b.ruleBlock(null); rule(r.ast, r.name, h); } catch (RecognitionException re) { ErrorManager.fatalInternalError("bad grammar AST structure", re); } } }
public void buildNormalRuleFunction(Rule r, RuleFunction function) { CodeGenerator gen = delegate.getGenerator(); // TRIGGER factory functions for rule alts, elements GrammarASTAdaptor adaptor = new GrammarASTAdaptor(r.ast.token.getInputStream()); GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); walker = new SourceGenTriggers(nodes, this); try { // walk AST of rule alts/elements function.code = DefaultOutputModelFactory.list(walker.block(null, null)); function.hasLookaheadBlock = walker.hasLookaheadBlock; } catch (org.antlr.runtime.RecognitionException e){ e.printStackTrace(System.err); } function.ctxType = gen.getTarget().getRuleFunctionContextStructName(function); function.postamble = rulePostamble(function, r); }
public void buildNormalRuleFunction(Rule r, RuleFunction function) { CodeGenerator gen = delegate.getGenerator(); // TRIGGER factory functions for rule alts, elements GrammarASTAdaptor adaptor = new GrammarASTAdaptor(r.ast.token.getInputStream()); GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); walker = new SourceGenTriggers(nodes, this); try { // walk AST of rule alts/elements function.code = DefaultOutputModelFactory.list(walker.block(null, null)); function.hasLookaheadBlock = walker.hasLookaheadBlock; } catch (org.antlr.runtime.RecognitionException e){ e.printStackTrace(System.err); } function.ctxType = gen.getTarget().getRuleFunctionContextStructName(function); function.postamble = rulePostamble(function, r); }
public void buildNormalRuleFunction(Rule r, RuleFunction function) { CodeGenerator gen = delegate.getGenerator(); // TRIGGER factory functions for rule alts, elements GrammarASTAdaptor adaptor = new GrammarASTAdaptor(r.ast.token.getInputStream()); GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); walker = new SourceGenTriggers(nodes, this); try { // walk AST of rule alts/elements function.code = DefaultOutputModelFactory.list(walker.block(null, null)); function.hasLookaheadBlock = walker.hasLookaheadBlock; } catch (org.antlr.runtime.RecognitionException e){ e.printStackTrace(System.err); } function.ctxType = gen.getTarget().getRuleFunctionContextStructName(function); function.postamble = rulePostamble(function, r); }
public void buildNormalRuleFunction(Rule r, RuleFunction function) { CodeGenerator gen = delegate.getGenerator(); // TRIGGER factory functions for rule alts, elements GrammarASTAdaptor adaptor = new GrammarASTAdaptor(r.ast.token.getInputStream()); GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); walker = new SourceGenTriggers(nodes, this); try { // walk AST of rule alts/elements function.code = DefaultOutputModelFactory.list(walker.block(null, null)); function.hasLookaheadBlock = walker.hasLookaheadBlock; } catch (org.antlr.runtime.RecognitionException e){ e.printStackTrace(System.err); } function.ctxType = delegate.getTarget().getRuleFunctionContextStructName(function); function.postamble = rulePostamble(function, r); }
public void buildNormalRuleFunction(Rule r, RuleFunction function) { CodeGenerator gen = delegate.getGenerator(); // TRIGGER factory functions for rule alts, elements GrammarASTAdaptor adaptor = new GrammarASTAdaptor(r.ast.token.getInputStream()); GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK); CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk); walker = new SourceGenTriggers(nodes, this); try { // walk AST of rule alts/elements function.code = DefaultOutputModelFactory.list(walker.block(null, null)); function.hasLookaheadBlock = walker.hasLookaheadBlock; } catch (org.antlr.runtime.RecognitionException e){ e.printStackTrace(System.err); } function.ctxType = gen.getTarget().getRuleFunctionContextStructName(function); function.postamble = rulePostamble(function, r); }