Antlr4.Codegen.ActionTranslator.TranslateActionChunk C# (CSharp) Method

TranslateActionChunk() public static method

public static TranslateActionChunk ( OutputModelFactory factory, RuleFunction rf, string action, ActionAST node ) : IList
factory OutputModelFactory
rf Antlr4.Codegen.Model.RuleFunction
action string
node Antlr4.Tool.Ast.ActionAST
return IList
        public static IList<ActionChunk> TranslateActionChunk(OutputModelFactory factory,
                                                             RuleFunction rf,
                                                             string action,
                                                             ActionAST node)
        {
            IToken tokenWithinAction = node.Token;
            ActionTranslator translator = new ActionTranslator(factory, node);
            translator.rf = rf;
            factory.GetGrammar().tool.Log("action-translator", "translate " + action);
            string altLabel = node.GetAltLabel();
            if (rf != null)
            {
                translator.nodeContext = rf.ruleCtx;
                if (altLabel != null)
                {
                    AltLabelStructDecl decl;
                    rf.altLabelCtxs.TryGetValue(altLabel, out decl);
                    translator.nodeContext = decl;
                }
            }
            ANTLRStringStream @in = new ANTLRStringStream(action);
            @in.Line = tokenWithinAction.Line;
            @in.CharPositionInLine = tokenWithinAction.CharPositionInLine;
            ActionSplitter trigger = new ActionSplitter(@in, translator);
            // forces eval, triggers listener methods
            trigger.GetActionTokens();
            return translator.chunks;
        }