Add booleans
This commit is contained in:
13
tree.cpp
13
tree.cpp
@@ -16,6 +16,11 @@ std::string label<const char*>(const char* v) {
|
||||
return v;
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string label<bool>(bool v) {
|
||||
return v ? "TRUE" : "FALSE";
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string label<binop>(binop op) {
|
||||
switch(op) {
|
||||
@@ -67,12 +72,16 @@ void expr_id::print_dot(dot& into, std::string prefix) {
|
||||
into.push_back(prefix + wrap_label(std::string("identifier: ") + id, true));
|
||||
}
|
||||
|
||||
void expr_bool::print_dot(dot& into, std::string prefix) {
|
||||
into.push_back(prefix + wrap_label(std::string("Boolean: ") + label(val), true));
|
||||
}
|
||||
|
||||
void expr_int::print_dot(dot& into, std::string prefix) {
|
||||
into.push_back(prefix + wrap_label(std::string("integer: ") + label(val), true));
|
||||
into.push_back(prefix + wrap_label(std::string("Integer: ") + label(val), true));
|
||||
}
|
||||
|
||||
void expr_float::print_dot(dot& into, std::string prefix) {
|
||||
into.push_back(prefix + wrap_label(std::string("float: ") + label(val), true));
|
||||
into.push_back(prefix + wrap_label(std::string("Float: ") + label(val), true));
|
||||
}
|
||||
|
||||
void expr_binop::print_dot(dot& into, std::string prefix) {
|
||||
|
||||
Reference in New Issue
Block a user