correct terminated function management
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Mon, 6 Feb 2023 14:56:17 +0000 (15:56 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Mon, 6 Feb 2023 14:56:17 +0000 (15:56 +0100)
parser.c

index 326dad384b916b135d27ca3b80c786ce8495f5ee..223b173bafd76faf34ba7ac0eca01f7b438d1965 100644 (file)
--- 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;
                 }