lambda-calc-1/expression/variable/prettyprint.c

53 lines
834 B
C

#include <debug.h>
#include <globals/terminalcolors.h>
#include <stringtree/new.h>
#include <stringtree/prepend.h>
#include <stringtree/append.h>
#include <value/prettyprint.h>
#include "struct.h"
#include "prettyprint.h"
struct stringtree* variable_expression_prettyprint(
int *out_chosen_color,
struct expression* super,
bool with_color)
{
ENTER;
struct variable_expression* const this = (void*) super;
struct stringtree* tree = new_stringtree();
stringtree_append_string(tree, this->name);
if (with_color)
{
stringtree_prepend_cstr(tree, terminalcolors.variable);
stringtree_append_cstr(tree, terminalcolors.reset);
if (out_chosen_color)
*out_chosen_color = -1;
}
EXIT;
return tree;
}