public static IParsingResultExtended Parse(ParsingContext context)
        {
            IParsingResultExtended name = UnscopedName.Parse(context);

            if (name != null)
            {
                context.SubstitutionTable.Add(name);
                return(name);
            }

            return(Substitution.Parse(context));
        }
Example #2
0
        public static IParsingResultExtended Parse(ParsingContext context)
        {
            RewindState            rewind = context.RewindState;
            IParsingResultExtended name   = NestedName.Parse(context);

            if (name != null)
            {
                return(name);
            }

            name = UnscopedName.Parse(context);
            if (name != null)
            {
                if (context.Parser.Peek == 'I')
                {
                    context.SubstitutionTable.Add(name);
                    TemplateArgs args = TemplateArgs.Parse(context);

                    if (args == null)
                    {
                        context.Rewind(rewind);
                        return(null);
                    }

                    return(new UnscopedTemplate(name, args));
                }
                else
                {
                    return(name);
                }
            }

            name = UnscopedTemplateName.Parse(context);
            if (name != null)
            {
                TemplateArgs args = TemplateArgs.Parse(context);

                if (args == null)
                {
                    context.Rewind(rewind);
                    return(null);
                }

                return(new UnscopedTemplate(name, args));
            }

            return(LocalName.Parse(context));
        }