From: Laurent Mazet Date: Mon, 6 Feb 2023 14:56:17 +0000 (+0100) Subject: correct terminated function management X-Git-Tag: v1.0~1 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=a28ab26a7d2d420a63cbbfdec0d2450263ecc352;p=calc.git correct terminated function management --- 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; }