diff options
-rw-r--r-- | src/expr.cc | 6 | ||||
-rw-r--r-- | tests/regression/moduledumptest/allexpressions-expected.ast | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/expr.cc b/src/expr.cc index 51accf3..08615ba 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -199,7 +199,11 @@ std::string Expression::toString() const 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]; + if (this->children.size() > 2) { + stream << " : " << *this->children[2]; + } + stream << "]"; } else if (this->type == "V") { stream << "["; diff --git a/tests/regression/moduledumptest/allexpressions-expected.ast b/tests/regression/moduledumptest/allexpressions-expected.ast index 6d9de40..69ec746 100644 --- a/tests/regression/moduledumptest/allexpressions-expected.ast +++ b/tests/regression/moduledumptest/allexpressions-expected.ast @@ -6,7 +6,7 @@ e = $fn; f1 = [1]; f2 = [1, 2, 3]; g = ((f2.x + f2.y) + f2.z); -h1 = [2 : 1 : 5]; +h1 = [2 : 5]; h2 = [1 : 2 : 10]; i = ((h2.begin - h2.step) - h2.end); j = "test"; |