conditional method

Expr conditional()

Implementation

Expr conditional() {
  Expr expr = or();
  Expr? thenExpr;
  Expr? elseExpr;
  if (match([TokenType.QUESTION])) {
    thenExpr = conditional();
    consume(TokenType.COLON, "Expected ':' after true branch.");
    elseExpr = conditional();
    return Conditional(expr, thenExpr, elseExpr);
  }
  return expr;
}