Antlr4.Codegen.DefaultOutputModelFactory.RulePostamble C# (CSharp) Method

RulePostamble() public method

public RulePostamble ( RuleFunction function, Rule r ) : IList
function Antlr4.Codegen.Model.RuleFunction
r Antlr4.Tool.Rule
return IList
        public override IList<SrcOp> RulePostamble(RuleFunction function, Rule r)
        {
            if (r.namedActions.ContainsKey("after") || r.namedActions.ContainsKey("finally"))
            {
                // See OutputModelController.buildLeftRecursiveRuleFunction
                // and Parser.exitRule for other places which set stop.
                CodeGenerator gen = GetGenerator();
                TemplateGroup codegenTemplates = gen.GetTemplates();
                Template setStopTokenAST = codegenTemplates.GetInstanceOf("recRuleSetStopToken");
                Action setStopTokenAction = new Action(this, function.ruleCtx, setStopTokenAST);
                IList<SrcOp> ops = new List<SrcOp>(1);
                ops.Add(setStopTokenAction);
                return ops;
            }

            return base.RulePostamble(function, r);
        }