public override AstNode VisitExternal_declaration_list([NotNull] GLSL_ES300Parser.External_declaration_listContext context)
        {
            var result = new Root();

            List <Declaration> declaratorList = new List <Declaration>();
            var currentContext = context;

            while (currentContext != null)
            {
                var exdec = currentContext.external_declaration();
                if (exdec != null)
                {
                    var dec = exdec.declaration();
                    if (dec != null)
                    {
                        declaratorList.Add((Declaration)this.Visit(dec));
                    }
                    else
                    {
                        var func = exdec.function_definition();
                        if (func != null)
                        {
                            declaratorList.Add((Declaration)this.Visit(func));
                        }
                    }
                }

                currentContext = currentContext.external_declaration_list();
            }

            declaratorList.Reverse();
            result.Declarations.AddRange(declaratorList);

            return(result);
        }
Пример #2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="GLSL_ES300Parser.external_declaration_list"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitExternal_declaration_list([NotNull] GLSL_ES300Parser.External_declaration_listContext context)
 {
     return(VisitChildren(context));
 }