Example #1
0
        public override AstNode VisitCommands(ALangParser.CommandsContext context)
        {
            AstNode node = ExtractCommandTypeNode(context);

            if (context.commands() != null)
            {
                node.MakeSiblings(context.commands().Accept(this));
            }

            return(node);
        }
Example #2
0
 private AstNode ExtractCommandTypeNode(ALangParser.CommandsContext context)
 {
     if (context.dcl() != null)
     {
         return(context.dcl().Accept(this));
     }
     if (context.imports() != null)
     {
         return(context.imports().Accept(this));
     }
     if (context.function() != null)
     {
         return(context.function().Accept(this));
     }
     return(null);
 }
Example #3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="ALangParser.commands"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitCommands([NotNull] ALangParser.CommandsContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by <see cref="ALangParser.commands"/>.
 /// <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 VisitCommands([NotNull] ALangParser.CommandsContext context)
 {
     return(VisitChildren(context));
 }