private Expression connective_and() { Expression higher_precedence = bitwise_or(); while (expect(Token.Type.ConnectiveAnd)) { Token op = consume(); Expression right = bitwise_or(); higher_precedence = new ConnectiveExpr(higher_precedence, op, right); } return(higher_precedence); }
public object visit_connective(ConnectiveExpr connective_expr) { object left = evaluate(connective_expr.left); if (connective_expr.op.type == Token.Type.ConnectiveOr) { // If left is truthy, return it if (get_truth(left)) { return(left); } } else if (connective_expr.op.type == Token.Type.ConnectiveAnd) { // If we are on an and, and left is false, then return false if (!get_truth(left)) { return(left); } } return(get_truth(evaluate(connective_expr.right))); }
public override Value Visit(ConnectiveExpr visitee) => this.VisitBinary(visitee, (lhs, rhs) => lhs.Then(rhs));
public virtual Result Visit(ConnectiveExpr visitee) { return(default);
public object visit_connective(ConnectiveExpr connective_expr) { resolve(connective_expr.left); resolve(connective_expr.right); return(null); }