Commit a04fce53 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

change expr_inspect to only print the first expression by default

parent 72b940db
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -143,7 +143,6 @@ ExprStorage expr_clone(const Expr* e, int count /* =-1 */) {
std::string expr_inspect(const Expr* expr) {
  std::stringstream s;

  for (; expr; expr = expr_next(expr)) {
  switch (expr->type) {
    case ExprType::VALUE:
    case ExprType::VALUE_LITERAL:
@@ -151,11 +150,20 @@ std::string expr_inspect(const Expr* expr) {
      break;
    case ExprType::LIST:
      s << "(";
        s << expr_inspect(expr_get_list(expr));
      s << expr_inspect_list(expr_get_list(expr));
      s << ")";
      break;
  }

  return s.str();
}

std::string expr_inspect_list(const Expr* expr) {
  std::stringstream s;

  for (; expr; expr = expr_next(expr)) {
    s << expr_inspect(expr);

    if (expr_next(expr)) {
      s << " ";
    }
+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ const std::string& expr_get_value(const Expr* expr);
ExprStorage expr_clone(const Expr* e, int count=-1);

std::string expr_inspect(const Expr* expr);
std::string expr_inspect_list(const Expr* expr);

} // namespace fviz