From a28ab26a7d2d420a63cbbfdec0d2450263ecc352 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Mon, 6 Feb 2023 15:56:17 +0100 Subject: [PATCH] correct terminated function management --- parser.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } -- 2.30.2