[06/17] bison: permit keywords in list_stmt_expressions

Submitted by Florian Westphal on June 28, 2017, 10:06 a.m.

Details

Message ID 20170628100659.26976-7-fw@strlen.de
State Changes Requested
Delegated to: Pablo Neira
Headers show

Commit Message

Florian Westphal June 28, 2017, 10:06 a.m.
previous patch makes 'ct event set label' work, but we also need
to allow "set new, label".

This changes the definition to also contain keyword symbol expressions.
Unfortunately, the older "|" syntax, "ct event new | label" (not in any release)
doesn't work anymore because it requires primary_expr to work and that
causes ambiguities in the parser (we can only re-use keywords if they're
restricted to RHS expressions).

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 src/parser_bison.y | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/parser_bison.y b/src/parser_bison.y
index 66f031d3ca69..577f4bee167e 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -587,8 +587,8 @@  static void location_update(struct location *loc, struct location *rhs, int n)
 
 %type <expr>			rhs_expr concat_rhs_expr basic_rhs_expr
 %destructor { expr_free($$); }	rhs_expr concat_rhs_expr basic_rhs_expr
-%type <expr>			primary_rhs_expr list_rhs_expr shift_rhs_expr
-%destructor { expr_free($$); }	primary_rhs_expr list_rhs_expr shift_rhs_expr
+%type <expr>			primary_rhs_expr list_rhs_expr shift_rhs_expr	symbol_rhs_expr
+%destructor { expr_free($$); }	primary_rhs_expr list_rhs_expr shift_rhs_expr	symbol_rhs_expr
 %type <expr>			and_rhs_expr exclusive_or_rhs_expr inclusive_or_rhs_expr
 %destructor { expr_free($$); }	and_rhs_expr exclusive_or_rhs_expr inclusive_or_rhs_expr
 
@@ -3092,13 +3092,17 @@  ct_key_dir_optional	:	BYTES		{ $$ = NFT_CT_BYTES; }
 			|	ZONE		{ $$ = NFT_CT_ZONE; }
 			;
 
-list_stmt_expr		:	symbol_expr	COMMA	symbol_expr
+symbol_rhs_expr		:	symbol_expr
+			|	keyword_expr
+			;
+
+list_stmt_expr		:	symbol_rhs_expr	COMMA	symbol_rhs_expr
 			{
 				$$ = list_expr_alloc(&@$);
 				compound_expr_add($$, $1);
 				compound_expr_add($$, $3);
 			}
-			|	list_stmt_expr	COMMA		symbol_expr
+			|	list_stmt_expr	COMMA		symbol_rhs_expr
 			{
 				$1->location = @$;
 				compound_expr_add($1, $3);