Skip to content

Commit c2a0090

Browse files
committed
add a formatter for function applications
This adds the obvious formatter for applications of mathematical functions.
1 parent 24fbf7d commit c2a0090

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/util/format_expr.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,23 @@ void format_expr_configt::setup()
474474
return os << '"' << expr.get_string(ID_value) << '"';
475475
};
476476

477+
expr_map[ID_function_application] =
478+
[](std::ostream &os, const exprt &expr) -> std::ostream & {
479+
const auto &function_application_expr = to_function_application_expr(expr);
480+
os << format(function_application_expr.function()) << '(';
481+
bool first = true;
482+
for(auto &argument : function_application_expr.arguments())
483+
{
484+
if(first)
485+
first = false;
486+
else
487+
os << ", ";
488+
os << format(argument);
489+
}
490+
os << ')';
491+
return os;
492+
};
493+
477494
fallback = [](std::ostream &os, const exprt &expr) -> std::ostream & {
478495
return fallback_format_rec(os, expr);
479496
};

0 commit comments

Comments
 (0)