#include #include #include #include #include #include #include #include "../prettyprint.h" #include "struct.h" #include "prettyprint.h" struct stringtree* lambda_expression_prettyprint( int *out_chosen_color, struct expression* super, struct color_factory* cfactory, bool with_color) { ENTER; struct lambda_expression* const this = (void*) super; int chosen_color; struct stringtree* tree = new_stringtree(); stringtree_append_cstr(tree, L"λ"); stringtree_append_string(tree, this->variable_name); stringtree_append_cstr(tree, L": "); struct stringtree* subtree = expression_prettyprint( &chosen_color, this->body, cfactory, with_color); if (with_color) { int my_color = (chosen_color + 1) % (int) N(cfactory->colors); stringtree_prepend_string(tree, cfactory->colors[my_color]); stringtree_append_string(tree, cfactory->reset); if (out_chosen_color) *out_chosen_color = my_color; } stringtree_append_stringtree(tree, subtree); free_stringtree(subtree); EXIT; return tree; }