/// <summary> /// Visit a parse tree produced by the <c>unary_exp</c> /// labeled alternative in <see cref="coolgrammarParser.expr"/>. /// <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 VisitUnary_exp([NotNull] coolgrammarParser.Unary_expContext context) { return(VisitChildren(context)); }
public override Node VisitUnary_exp([NotNull] coolgrammarParser.Unary_expContext context) { Expr exp = (Expr)Visit(context.expr()); return(new UnaryExpr(exp, context.op.Text)); }