diff options
author | Marius Kintel <marius@kintel.net> | 2013-06-18 05:46:48 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-06-18 05:46:48 (GMT) |
commit | 6d91540e4cc3f9fe0caaea63ac64518a5626d28b (patch) | |
tree | ca7034453a1f55124e4b7378aaab22985aff6a21 /src/expr.cc | |
parent | 95947a877b8e88521a7f00348d56c89e9b7c2a79 (diff) | |
parent | 6c7d386a3338039416ced323bf1aa75edbb43d19 (diff) |
Merge branch 'master' into epec-kernel
Diffstat (limited to 'src/expr.cc')
-rw-r--r-- | src/expr.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/expr.cc b/src/expr.cc index 4355400..2e069f0 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -69,7 +69,7 @@ public: expr.recursioncount++; } ~FuncRecursionGuard() { expr.recursioncount--; } - bool recursion_detected() const { return (expr.recursioncount > 100); } + bool recursion_detected() const { return (expr.recursioncount > 1000); } private: const Expression &expr; }; @@ -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 << "("; |