This patch adds a rule for variable expression so we can reuse it in a follow up patch to allow set element initialization from variable. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- src/parser_bison.y | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/parser_bison.y b/src/parser_bison.y index dc79465..a87468e 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -496,8 +496,8 @@ static void location_update(struct location *loc, struct location *rhs, int n) %type <stmt> flow_stmt flow_stmt_alloc %destructor { stmt_free($$); } flow_stmt flow_stmt_alloc -%type <expr> symbol_expr verdict_expr integer_expr -%destructor { expr_free($$); } symbol_expr verdict_expr integer_expr +%type <expr> symbol_expr verdict_expr integer_expr variable_expr +%destructor { expr_free($$); } symbol_expr verdict_expr integer_expr variable_expr %type <expr> primary_expr shift_expr and_expr %destructor { expr_free($$); } primary_expr shift_expr and_expr %type <expr> exclusive_or_expr inclusive_or_expr @@ -1927,14 +1927,7 @@ match_stmt : relational_expr } ; -symbol_expr : string - { - $$ = symbol_expr_alloc(&@$, SYMBOL_VALUE, - current_scope(state), - $1); - xfree($1); - } - | '$' identifier +variable_expr : '$' identifier { struct scope *scope = current_scope(state); @@ -1948,6 +1941,16 @@ symbol_expr : string scope, $2); xfree($2); } + ; + +symbol_expr : variable_expr + | string + { + $$ = symbol_expr_alloc(&@$, SYMBOL_VALUE, + current_scope(state), + $1); + xfree($1); + } | AT identifier { $$ = symbol_expr_alloc(&@$, SYMBOL_SET, -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html