]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: parser: Hack for IF in variable values
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 15 Mar 2019 04:08:30 +0000 (04:08 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 15 Mar 2019 04:08:30 +0000 (04:08 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/parser/grammar.y

index f098f3bb18f31edefa50431669117eb356e92baa..d26c36cd290765a2fc1cc5dc4353c47f003b1588 100644 (file)
@@ -67,7 +67,7 @@ char* current_block = NULL;
 %token DEFINE
 %token END
 %token <string>                                        EQUALS
-%token IF
+%token <string>                                        IF
 %token NEWLINE
 %token TAB
 %token <string>                                        WORD
@@ -77,6 +77,7 @@ char* current_block = NULL;
 %type <string>                                 text;
 %type <string>                                 variable;
 %type <string>                                 value;
+%type <string>                                 word;
 %type <string>                                 words;
 
 %precedence WORD
@@ -110,8 +111,12 @@ value                                              : words
                                                                $$ = NULL;
                                                        };
 
-words                                          : WORD
-                                                       | words WORD
+                                                       // IF can show up in values and therefore this
+                                                       // hack is needed to parse those properly
+word                                           : WORD | IF;
+
+words                                          : word
+                                                       | words word
                                                        {
                                                                int r = asprintf(&$$, "%s %s", $1, $2);
                                                                if (r < 0) {