public override ASTNode VisitS([NotNull] p4Parser.SContext context) { StatementAstNode Root = null; if (context.importStmt() != null) { foreach (IParseTree importstmt in context.importStmt()) { if (Root == null) { Root = new StatementAstNode(Visit(importstmt), null); } else { Root.Push(new StatementAstNode(Visit(importstmt), null)); } } } if (context.global() != null) { foreach (IParseTree globalDcl in context.global()) { if (Root == null) { Root = new StatementAstNode(Visit(globalDcl), null); } else { Root.Push(new StatementAstNode(Visit(globalDcl), null)); } } } if (context.main() != null) { if (Root == null) { Root = new StatementAstNode(Visit(context.main()), null); } else { Root.Push(new StatementAstNode(Visit(context.main()), null)); } } return(Root); }
/// <summary> /// Visit a parse tree produced by <see cref="p4Parser.s"/>. /// <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 VisitS([NotNull] p4Parser.SContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="p4Parser.s"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitS([NotNull] p4Parser.SContext context) { }