From: Ondrej Zajicek (work) Date: Tue, 8 Mar 2022 23:31:39 +0000 (+0100) Subject: Filter: Simplify handling of command sequences X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d07893fb9bca0aeff0cfea1ac99a022a5bca9927;p=thirdparty%2Fbird.git Filter: Simplify handling of command sequences Command sequences in curly braces used a separate nonterminal in grammar. Handle them as a regular command. --- diff --git a/filter/config.Y b/filter/config.Y index 51e7822f2..a3acf2452 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -296,7 +296,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN, %nonassoc ELSE %type cmds_int cmd_prep -%type term block cmd cmds constant constructor print_list var_list function_call symbol_value bgp_path_expr bgp_path bgp_path_tail +%type term cmd cmds constant constructor print_list var_list function_call symbol_value bgp_path_expr bgp_path bgp_path_tail %type dynamic_attr %type static_attr %type filter where_filter @@ -514,15 +514,6 @@ cmds_int: cmd_prep } ; -block: - cmd { - $$=$1; - } - | '{' cmds '}' { - $$=$2; - } - ; - /* * Complex types, their bison value is struct f_val */ @@ -864,10 +855,13 @@ print_list: /* EMPTY */ { $$ = NULL; } ; cmd: - IF term THEN block { + '{' cmds '}' { + $$ = $2; + } + | IF term THEN cmd { $$ = f_new_inst(FI_CONDITION, $2, $4, NULL); } - | IF term THEN block ELSE block { + | IF term THEN cmd ELSE cmd { $$ = f_new_inst(FI_CONDITION, $2, $4, $6); } | CF_SYM_KNOWN '=' term ';' {