private Expr Unary() { if (Match(out Token op, BANG, MINUS)) { Expr right = Unary(); Expr expr = new Expr.Unary(op, right); return(expr); } return(Call()); }
public object visitUnaryExpr(Expr.Unary expr) { object right = evaluate(expr.right); switch (expr.op.type) { case TokenType.MINUS: checkNumberOperand(expr.op, right); return(-(double)right); case TokenType.BANG: return(!isTruthy(right)); } // Unreachable. return(null); }
public object VisitUnaryExpr(Expr.Unary expr) { var right = Evaluate(expr.Right); switch (expr.Operator.Type) { case BANG: return(!IsTruthy(right)); case MINUS: CheckNumberOperand(expr.Operator, right); return(-(double)right); } // Unreachable return(null); }
public object VisitUnaryExpr(Expr.Unary expr) { object right = Evaluate(expr.right); switch (expr.op.type) { case BANG: return(!IsTruthy(right)); case MINUS: TypeCheckNumberOperand(expr.op, right); return(-(double)right); } // Unreachable. return(null); }
public string VisitUnaryExpr(Expr.Unary expr) => Parenthesize(expr.Operator.Lexeme, expr.Right);
public string VisitUnaryExpr(Expr.Unary expr) { return(Parenthesize([email protected], expr.right)); }
public string visitUnaryExpr(Expr.Unary expr) { return(parenthesize(expr.op.lexeme, expr.right)); }
public object VisitUnaryExpr(Expr.Unary expr) { Resolve(expr.right); return(null); }
public Void VisitUnaryExpr(Expr.Unary expr) { Resolve(expr.Right); return(null); }