Commit aa035c2e authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

QuasiCanonical: throws on incorrect use of the - sign

parent 3fc55b42
......@@ -25,7 +25,17 @@ public:
const SizeType len = str_.length();
String tempBuffer;
String status = "closed";
char prev = '\0';
for (SizeType i = 0; i < len; ++i) {
if (str_[i] == '-' && i > 0) {
if (prev != '(' && prev != '+') {
throw RuntimeError("The - sign must be preceded by nothing, parens, or +\n");
}
}
prev = str_[i];
if (str_[i] == '(') {
if (status == "open")
throw RuntimeError("Too many parens levels (one only supported for now)\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment