Fix else ifs
This commit is contained in:
34
tree.cpp
34
tree.cpp
@@ -20,29 +20,29 @@ template <>
|
||||
std::string label<binop>(binop op) {
|
||||
switch(op) {
|
||||
case binop::plus:
|
||||
return "+";
|
||||
return "PLUS";
|
||||
case binop::minus:
|
||||
return "-";
|
||||
return "MINUS";
|
||||
case binop::times:
|
||||
return "*";
|
||||
return "TIMES";
|
||||
case binop::divide:
|
||||
return "/";
|
||||
return "DIVIDEBY";
|
||||
case binop::land:
|
||||
return "&&";
|
||||
return "AND";
|
||||
case binop::lor:
|
||||
return "||";
|
||||
return "OR";
|
||||
case binop::eq:
|
||||
return "==";
|
||||
return "EQ";
|
||||
case binop::neq:
|
||||
return "!=";
|
||||
return "NEQ";
|
||||
case binop::lt:
|
||||
return "<";
|
||||
return "LT";
|
||||
case binop::lte:
|
||||
return "<=";
|
||||
return "LTE";
|
||||
case binop::gt:
|
||||
return ">";
|
||||
return "GT";
|
||||
case binop::gte:
|
||||
return ">=";
|
||||
return "GTE";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -59,20 +59,20 @@ std::string label<unop>(unop op) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string wrap_label(T v) {
|
||||
return std::string(" [label=\"") + label(v) + "\"]";
|
||||
std::string wrap_label(T v, bool box = false) {
|
||||
return std::string(" [label=\"") + label(v) + "\" " + (box ? "shape=\"box\"" : "") + "]";
|
||||
}
|
||||
|
||||
void expr_id::print_dot(dot& into, std::string prefix) {
|
||||
into.push_back(prefix + wrap_label(id));
|
||||
into.push_back(prefix + wrap_label(std::string("identifier: ") + id, true));
|
||||
}
|
||||
|
||||
void expr_int::print_dot(dot& into, std::string prefix) {
|
||||
into.push_back(prefix + wrap_label(val));
|
||||
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(val));
|
||||
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