diff options
Diffstat (limited to 'src')
| -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 4355400..46d606f 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 << "("; | 
