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

TokenRef() public method

public TokenRef ( GrammarAST ID, GrammarAST labelAST, GrammarAST args ) : IList
ID Antlr4.Tool.Ast.GrammarAST
labelAST Antlr4.Tool.Ast.GrammarAST
args Antlr4.Tool.Ast.GrammarAST
return IList
        public override IList<SrcOp> TokenRef(GrammarAST ID, GrammarAST labelAST, GrammarAST args)
        {
            MatchToken matchOp = new MatchToken(this, (TerminalAST)ID);
            if (labelAST != null)
            {
                string label = labelAST.Text;
                RuleFunction rf = GetCurrentRuleFunction();
                if (labelAST.Parent.Type == ANTLRParser.PLUS_ASSIGN)
                {
                    // add Token _X and List<Token> X decls
                    DefineImplicitLabel(ID, matchOp); // adds _X
                    TokenListDecl l = GetTokenListLabelDecl(label);
                    rf.AddContextDecl(ID.GetAltLabel(), l);
                }
                else
                {
                    Decl d = GetTokenLabelDecl(label);
                    matchOp.labels.Add(d);
                    rf.AddContextDecl(ID.GetAltLabel(), d);
                }

                //			Decl d = getTokenLabelDecl(label);
                //			((MatchToken)matchOp).labels.add(d);
                //			getCurrentRuleFunction().addContextDecl(ID.getAltLabel(), d);
                //			if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) {
                //				TokenListDecl l = getTokenListLabelDecl(label);
                //				getCurrentRuleFunction().addContextDecl(ID.getAltLabel(), l);
                //			}
            }
            if (controller.NeedsImplicitLabel(ID, matchOp))
                DefineImplicitLabel(ID, matchOp);
            AddToLabelList listLabelOp = GetAddToListOpIfListLabelPresent(matchOp, labelAST);
            return List(matchOp, listLabelOp);
        }