X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=parser.c;h=223b173bafd76faf34ba7ac0eca01f7b438d1965;hb=a28ab26a7d2d420a63cbbfdec0d2450263ecc352;hp=326dad384b916b135d27ca3b80c786ce8495f5ee;hpb=226557a3339d4f3f98547eef6deeb4ec512366d1;p=calc.git diff --git a/parser.c b/parser.c index 326dad3..223b173 100644 --- a/parser.c +++ b/parser.c @@ -367,7 +367,11 @@ element_t *parser (char *str, char **next, int prio) keyword_t *operator = operators + i; if (codecmp (operator->keyword, str) == 0) { VERBOSE (DEBUG, fprintf (stdout, "start processing operator\n")); - if (root) { + if ((root) && (root->prio == 9)) { + VERBOSE (DEBUG, fprintf (stdout, "terminal function (%d)\n", root->func)); + delelement (root); + return ERROR_OP; + } else if (root) { if ((prio) && (prio > operator->prio)) { VERBOSE (DEBUG, fprintf (stdout, "stop because operator priority\n")); *next = str; @@ -380,7 +384,7 @@ element_t *parser (char *str, char **next, int prio) return ERROR_OP; } } else if (*str == '-') { - root = newelement (Sig, 1, 9); + root = newelement (Sig, 1, 6); } else { return ERROR_OP; }