public object VisitLogicalExpr(Logical expr) { object left = Evaluate(expr.Left); if (expr.Op.Type == TokenType.LOG_OR) { if (IsTruthy(left)) { return(left); } } else { if (!IsTruthy(left)) { return(left); } } return(Evaluate(expr.Right)); }
public string VisitLogicalExpr(Logical expr) { return(Parenthesize(expr.Op.Lexeme, expr.Left, expr.Right)); }