From: Michael Tremer Date: Fri, 15 Mar 2019 04:08:30 +0000 (+0000) Subject: libpakfire: parser: Hack for IF in variable values X-Git-Tag: 0.9.28~1285^2~1051 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=246e950fd0885eb39bdaa3c2708ac092b6ab1fd9;p=pakfire.git libpakfire: parser: Hack for IF in variable values Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/parser/grammar.y b/src/libpakfire/parser/grammar.y index f098f3bb1..d26c36cd2 100644 --- a/src/libpakfire/parser/grammar.y +++ b/src/libpakfire/parser/grammar.y @@ -67,7 +67,7 @@ char* current_block = NULL; %token DEFINE %token END %token EQUALS -%token IF +%token IF %token NEWLINE %token TAB %token WORD @@ -77,6 +77,7 @@ char* current_block = NULL; %type text; %type variable; %type value; +%type word; %type 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) {