public virtual void BuildNormalRuleFunction(Rule r, RuleFunction function) { CodeGenerator gen = @delegate.GetGenerator(); // TRIGGER factory functions for rule alts, elements GrammarASTAdaptor adaptor = new GrammarASTAdaptor(r.ast.Token.InputStream); 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 (Antlr.Runtime.RecognitionException e) { @delegate.GetGenerator().tool.ConsoleError.WriteLine(e.Message); @delegate.GetGenerator().tool.ConsoleError.WriteLine(e.StackTrace); } function.ctxType = @delegate.GetTarget().GetRuleFunctionContextStructName(function); function.postamble = RulePostamble(function, r); }
public virtual void BuildNormalRuleFunction(Rule r, RuleFunction function) { CodeGenerator gen = @delegate.GetGenerator(); // TRIGGER factory functions for rule alts, elements GrammarASTAdaptor adaptor = new GrammarASTAdaptor(r.ast.Token.InputStream); 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 (Antlr.Runtime.RecognitionException e) { Console.Error.WriteLine(e.Message); Console.Error.WriteLine(e.StackTrace); } function.ctxType = @delegate.GetTarget().GetRuleFunctionContextStructName(function); function.postamble = RulePostamble(function, r); }