diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-25 23:21:28 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-25 23:21:28 +0100 |
commit | 9e2fd97040e65817b8b559da48f67464acfc4f0f (patch) | |
tree | df00bf7609131c5e4f0ce262b3b9732eed9eb42c | |
parent | 8fc78e7807514a89d8142155acd6fd8f70c3dd89 (diff) | |
parent | e4ce88cc50a7af21e0b7042f60abd11e4288c6fe (diff) |
Merge commit 'e4ce88cc' into wireguard-next-tmp7-1
-rw-r--r-- | filter/config.Y | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/filter/config.Y b/filter/config.Y index 771caa28..0840b5bc 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -512,7 +512,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN, %nonassoc ELSE %type <xp> cmds_int cmd_prep -%type <x> term term_bs cmd cmd_var cmds cmds_scoped constant constructor var var_list function_call symbol_value bgp_path_expr bgp_path bgp_path_tail term_dot_method method_name_cont +%type <x> term term_bs cmd cmd_var cmds cmds_scoped constant constructor var var_list var_list_r function_call symbol_value bgp_path_expr bgp_path bgp_path_tail term_dot_method method_name_cont %type <fda> dynamic_attr %type <fsa> static_attr %type <f> filter where_filter @@ -955,10 +955,27 @@ constructor: ; -/* This generates the function_call variable list backwards. */ -var_list: /* EMPTY */ { $$ = NULL; } +/* This generates the function_call variable list backwards */ +var_list_r: + /* EMPTY */ { $$ = NULL; } | term { $$ = $1; } - | var_list ',' term { $$ = $3; $$->next = $1; } + | var_list_r ',' term { $$ = $3; $$->next = $1; } + ; + +var_list: var_list_r + { + $$ = NULL; + + /* Revert the var_list_r */ + while ($1) { + struct f_inst *tmp = $1; + $1 = $1->next; + + tmp->next = $$; + $$ = tmp; + } + } + ; function_call: symbol_known '(' var_list ')' @@ -966,17 +983,7 @@ function_call: if ($1->class != SYM_FUNCTION) cf_error("You can't call something which is not a function. Really."); - /* Revert the var_list */ - struct f_inst *args = NULL; - while ($3) { - struct f_inst *tmp = $3; - $3 = $3->next; - - tmp->next = args; - args = tmp; - } - - $$ = f_new_inst(FI_CALL, args, $1); + $$ = f_new_inst(FI_CALL, $3, $1); } ; @@ -1170,13 +1177,13 @@ cmd: | UNSET '(' dynamic_attr ')' ';' { $$ = f_new_inst(FI_EA_UNSET, $3); } - | break_command var_list ';' { + | break_command var_list_r ';' { $$ = f_print($2, !!$2, $1); } - | PRINT var_list ';' { + | PRINT var_list_r ';' { $$ = f_print($2, 1, F_NOP); } - | PRINTN var_list ';' { + | PRINTN var_list_r ';' { $$ = f_print($2, 0, F_NOP); } | function_call ';' { $$ = f_new_inst(FI_DROP_RESULT, $1); } |