Exemplo n.º 1
0
 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)));
        }
Exemplo n.º 3
0
        public override Node VisitIfExp([NotNull] CoolParser.IfExpContext context)
        {
            var s = VisitChildren(context);

            return(new IfNode(context, s));
        }
Exemplo n.º 4
0
 public override object VisitIfExp([NotNull] CoolParser.IfExpContext context)
 {
     VisitExpr(context);
     return(VisitChildren(context));
 }
Exemplo n.º 5
0
 /// <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));
 }
Exemplo n.º 7
0
 public override bool VisitIfExp([NotNull] CoolParser.IfExpContext context)
 {
     return(VisitChildren(context));
 }