]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Filter: Simplify handling of command sequences
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 8 Mar 2022 23:31:39 +0000 (00:31 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Mon, 27 Jun 2022 19:13:31 +0000 (21:13 +0200)
Command sequences in curly braces used a separate nonterminal in grammar.
Handle them as a regular command.

filter/config.Y

index 51e7822f25563eb012f0a1cb03d30986b1e056ea..a3acf245289eb85e1abb6bca785636750a1e98ab 100644 (file)
@@ -296,7 +296,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
 %nonassoc ELSE
 
 %type <xp> cmds_int cmd_prep
-%type <x> term block cmd cmds constant constructor print_list var_list function_call symbol_value bgp_path_expr bgp_path bgp_path_tail
+%type <x> term cmd cmds constant constructor print_list var_list function_call symbol_value bgp_path_expr bgp_path bgp_path_tail
 %type <fda> dynamic_attr
 %type <fsa> static_attr
 %type <f> 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 ';' {