public IfNode(CoolParser.IfExpContext context, Node s) : base(s.Childs) { this.s = s; this.context = context; IfExp = s.Childs[0]; ThenExp = s.Childs[1]; ElseExp = s.Childs[2]; }
public override object VisitIfExp([NotNull] CoolParser.IfExpContext context) { Expression ifExp = (Expression)Visit(context.expresion()[0]); Expression thenExp = (Expression)Visit(context.expresion()[1]); Expression elseExp = null; if (context.expresion().Length > 2) { elseExp = (Expression)Visit(context.expresion()[2]); } return(new Conditional(ifExp, thenExp, elseExp, GetCoord(context))); }
public override Node VisitIfExp([NotNull] CoolParser.IfExpContext context) { var s = VisitChildren(context); return(new IfNode(context, s)); }
public override object VisitIfExp([NotNull] CoolParser.IfExpContext context) { VisitExpr(context); return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by the <c>ifExp</c> /// labeled alternative in <see cref="CoolParser.expresion"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitIfExp([NotNull] CoolParser.IfExpContext context) { }
/// <summary> /// Visit a parse tree produced by the <c>ifExp</c> /// labeled alternative in <see cref="CoolParser.expresion"/>. /// <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 VisitIfExp([NotNull] CoolParser.IfExpContext context) { return(VisitChildren(context)); }
public override bool VisitIfExp([NotNull] CoolParser.IfExpContext context) { return(VisitChildren(context)); }