diff options
author | Marius Kintel <marius@kintel.net> | 2013-06-02 22:15:37 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-06-02 22:15:37 (GMT) |
commit | 85c83fbc04f4918159a598793cee47cdafabf8c4 (patch) | |
tree | d79d2c7d954424dd2354a16560b693351193d35b /src/expr.cc | |
parent | 40ad09637974f840ea4bdd3b7b27e2f5d7388c5b (diff) | |
parent | 41f352a7888aebfffd96b0e764e29b3f0cbf01fa (diff) |
Merge branch 'master' into issue181
Diffstat (limited to 'src/expr.cc')
-rw-r--r-- | src/expr.cc | 16 |
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 << "("; |