Ejemplo n.º 1
0
        public override ASTNode VisitIfstmt([NotNull] llangParser.IfstmtContext context)
        {
            Expression cond = (Expression)Visit(context.expr());

            Statement ifbody = (Statement)Visit(context.stmt(0)), elsebody = null;

            if (context.stmt().Length > 1)
            {
                elsebody = (Statement)Visit(context.stmt(1));
            }

            return(new IfNode(cond, ifbody, elsebody, MakeSourceLoc(context)));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="llangParser.ifstmt"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitIfstmt([NotNull] llangParser.IfstmtContext context)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="llangParser.ifstmt"/>.
 /// <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 VisitIfstmt([NotNull] llangParser.IfstmtContext context)
 {
     return(VisitChildren(context));
 }