diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2022-03-09 00:31:39 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2022-06-27 21:13:31 +0200 |
commit | f31f4e6eef1762a4b9bf54a274f1ba9e9e161802 (patch) | |
tree | dc72e4b2eaa0d1812d8886bfc4ce6b8046ec1a19 | |
parent | 1e6acf34bbf2d9c31246c6fc450ac3b0232531e2 (diff) |
Filter: Simplify handling of command sequences
Command sequences in curly braces used a separate nonterminal in grammar.
Handle them as a regular command.
-rw-r--r-- | filter/config.Y | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/filter/config.Y b/filter/config.Y index 51e7822f..a3acf245 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -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 ';' { |