Antlr4.Codegen.ParserFactory.DefineImplicitLabel C# (CSharp) Method

DefineImplicitLabel() public method

public DefineImplicitLabel ( GrammarAST ast, LabeledOp op ) : void
ast Antlr4.Tool.Ast.GrammarAST
op LabeledOp
return void
        public virtual void DefineImplicitLabel(GrammarAST ast, LabeledOp op)
        {
            Decl d;
            if (ast.Type == ANTLRParser.SET || ast.Type == ANTLRParser.WILDCARD)
            {
                string implLabel =
                    GetTarget().GetImplicitSetLabel(ast.Token.TokenIndex.ToString());
                d = GetTokenLabelDecl(implLabel);
                ((TokenDecl)d).isImplicit = true;
            }
            else if (ast.Type == ANTLRParser.RULE_REF)
            { // a rule reference?
                Rule r = g.GetRule(ast.Text);
                string implLabel = GetTarget().GetImplicitRuleLabel(ast.Text);
                string ctxName =
                    GetTarget().GetRuleFunctionContextStructName(r);
                d = new RuleContextDecl(this, implLabel, ctxName);
                ((RuleContextDecl)d).isImplicit = true;
            }
            else
            {
                string implLabel = GetTarget().GetImplicitTokenLabel(ast.Text);
                d = GetTokenLabelDecl(implLabel);
                ((TokenDecl)d).isImplicit = true;
            }
            op.GetLabels().Add(d);
            // all labels must be in scope struct in case we exec action out of context
            GetCurrentRuleFunction().AddContextDecl(ast.GetAltLabel(), d);
        }