raise error on missing end bracket
[calc.git] / parser.c
index a6992c83c10dbaebcb074d155f0e10eaead341e4..05b89c936b8a6d96b868f440aed06adc5323a4fa 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -209,6 +209,10 @@ element_t *parser (char *str, char **next, int prio)
                 }
                 root->ops[0] = new;
             }
+            if (*str != ')') {
+                delelement (root);
+                return ERROR_OP;
+            }
             str++;
             VERBOSE (DEBUG, fprintf (stdout, "stop processing bracket\n"));
             continue;