There are two nearly identical blocks for typeof maps: one with INTERVAL keyword present and one without. Compact this into a single block. Signed-off-by: Florian Westphal <fw@xxxxxxxxx> --- src/parser_bison.y | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/parser_bison.y b/src/parser_bison.y index 17edaef8b0bc..2b4968280042 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -812,8 +812,8 @@ int nft_lex(void *, void *, void *); %type <expr> symbol_expr verdict_expr integer_expr variable_expr chain_expr policy_expr %destructor { expr_free($$); } symbol_expr verdict_expr integer_expr variable_expr chain_expr policy_expr -%type <expr> primary_expr shift_expr and_expr typeof_expr typeof_data_expr -%destructor { expr_free($$); } primary_expr shift_expr and_expr typeof_expr typeof_data_expr +%type <expr> primary_expr shift_expr and_expr typeof_expr typeof_data_expr typeof_verdict_expr +%destructor { expr_free($$); } primary_expr shift_expr and_expr typeof_expr typeof_data_expr typeof_verdict_expr %type <expr> exclusive_or_expr inclusive_or_expr %destructor { expr_free($$); } exclusive_or_expr inclusive_or_expr %type <expr> basic_expr @@ -2110,7 +2110,7 @@ subchain_block : /* empty */ { $$ = $<chain>-1; } } ; -typeof_data_expr : primary_expr +typeof_verdict_expr : primary_expr { struct expr *e = $1; @@ -2142,6 +2142,17 @@ typeof_data_expr : primary_expr } ; +typeof_data_expr : INTERVAL typeof_expr + { + $2->flags |= EXPR_F_INTERVAL; + $$ = $2; + } + | typeof_verdict_expr + { + $$ = $1; + } + ; + typeof_expr : primary_expr { if (expr_ops($1)->build_udata == NULL) { @@ -2321,23 +2332,6 @@ map_block : /* empty */ { $$ = $<set>-1; } $1->flags |= NFT_SET_MAP; $$ = $1; } - | map_block TYPEOF - typeof_expr COLON INTERVAL typeof_expr - stmt_separator - { - if (already_set($1->key, &@2, state)) { - expr_free($3); - expr_free($6); - YYERROR; - } - - $1->key = $3; - $1->data = $6; - $1->data->flags |= EXPR_F_INTERVAL; - - $1->flags |= NFT_SET_MAP; - $$ = $1; - } | map_block TYPE data_type_expr COLON map_block_obj_type stmt_separator close_scope_type -- 2.43.0