summaryrefslogtreecommitdiff
path: root/src/expr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/expr.cc')
-rw-r--r--src/expr.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/expr.cc b/src/expr.cc
index 1381c24..2e069f0 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -172,23 +172,27 @@ std::string Expression::toString() const
if (this->type == "*" || this->type == "/" || this->type == "%" || this->type == "+" ||
this->type == "-" || this->type == "<" || this->type == "<=" || this->type == "==" ||
- this->type == "!=" || this->type == ">=" || this->type == ">") {
+ this->type == "!=" || this->type == ">=" || this->type == ">" ||
+ this->type == "&&" || this->type == "||") {
stream << "(" << *this->children[0] << " " << this->type << " " << *this->children[1] << ")";
}
else if (this->type == "?:") {
- stream << "(" << *this->children[0] << " ? " << this->type << " : " << *this->children[1] << ")";
+ stream << "(" << *this->children[0] << " ? " << *this->children[1] << " : " << *this->children[2] << ")";
}
else if (this->type == "[]") {
- stream << "(" << *this->children[0] << "[" << *this->children[1] << "])";
+ stream << *this->children[0] << "[" << *this->children[1] << "]";
}
else if (this->type == "I") {
- stream << "(-" << *this->children[0] << ")";
+ stream << "-" << *this->children[0];
+ }
+ else if (this->type == "!") {
+ stream << "!" << *this->children[0];
}
else if (this->type == "C") {
stream << this->const_value;
}
else if (this->type == "R") {
- stream << "[" << *this->children[0] << " : " << *this->children[1] << " : " << this->children[2] << "]";
+ stream << "[" << *this->children[0] << " : " << *this->children[1] << " : " << *this->children[2] << "]";
}
else if (this->type == "V") {
stream << "[";
@@ -202,7 +206,7 @@ std::string Expression::toString() const
stream << this->var_name;
}
else if (this->type == "N") {
- stream << "(" << *this->children[0] << "." << this->var_name << ")";
+ stream << *this->children[0] << "." << this->var_name;
}
else if (this->type == "F") {
stream << this->call_funcname << "(";
contact: Jan Huwald // Impressum