Antlr4.Codegen.Model.RuleFunction.GetDeclForAltElement C# (CSharp) Метод

GetDeclForAltElement() публичный Метод

public GetDeclForAltElement ( GrammarAST t, string refLabelName, bool needList, bool optional ) : IList
t Antlr4.Tool.Ast.GrammarAST
refLabelName string
needList bool
optional bool
Результат IList
        public virtual IList<Decl.Decl> GetDeclForAltElement(GrammarAST t, string refLabelName, bool needList, bool optional)
        {
            int lfIndex = refLabelName.IndexOf(ATNSimulator.RuleVariantDelimiter);
            if (lfIndex >= 0)
            {
                refLabelName = refLabelName.Substring(0, lfIndex);
            }

            IList<Decl.Decl> decls = new List<Decl.Decl>();
            if (t.Type == ANTLRParser.RULE_REF)
            {
                Rule rref = factory.GetGrammar().GetRule(t.Text);
                string ctxName = factory.GetTarget()
                                 .GetRuleFunctionContextStructName(rref);
                if (needList)
                {
                    if (factory.GetTarget().SupportsOverloadedMethods())
                        decls.Add(new ContextRuleListGetterDecl(factory, refLabelName, ctxName));
                    decls.Add(new ContextRuleListIndexedGetterDecl(factory, refLabelName, ctxName));
                }
                else
                {
                    decls.Add(new ContextRuleGetterDecl(factory, refLabelName, ctxName, optional));
                }
            }
            else
            {
                if (needList)
                {
                    if (factory.GetTarget().SupportsOverloadedMethods())
                        decls.Add(new ContextTokenListGetterDecl(factory, refLabelName));
                    decls.Add(new ContextTokenListIndexedGetterDecl(factory, refLabelName));
                }
                else
                {
                    decls.Add(new ContextTokenGetterDecl(factory, refLabelName, optional));
                }
            }
            return decls;
        }