0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Changes right-recursion to left-recursion in a filter grammar.

Because we don't want to have a limit on a function/filter length.
This commit is contained in:
Ondrej Zajicek 2010-02-02 00:03:46 +01:00
parent 1a7a4e59a2
commit 5f47c4c11e

View File

@ -43,7 +43,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
%nonassoc THEN %nonassoc THEN
%nonassoc ELSE %nonassoc ELSE
%type <x> term block cmds cmd function_body constant print_one print_list var_list var_listn dynamic_attr static_attr function_call symbol dpair bgp_path_expr %type <x> term block cmds cmds_int cmd function_body constant print_one print_list var_list var_listn dynamic_attr static_attr function_call symbol dpair bgp_path_expr
%type <f> filter filter_body where_filter %type <f> filter filter_body where_filter
%type <i> type break_command cpair %type <i> type break_command cpair
%type <e> set_item set_items switch_body %type <e> set_item set_items switch_body
@ -191,15 +191,15 @@ function_def:
/* Programs */ /* Programs */
/* Hack: $$ of cmds_int is the last node.
$$->next of cmds_int is temporary used for the first node */
cmds: /* EMPTY */ { $$ = NULL; } cmds: /* EMPTY */ { $$ = NULL; }
| cmd cmds { | cmds_int { $$ = $1->next; $1->next = NULL; }
if ($1) { ;
if ($1->next)
bug("Command has next already set"); cmds_int: cmd { $$ = $1; $1->next = $1; }
$1->next = $2; | cmds_int cmd { $$ = $2; $2->next = $1->next ; $1->next = $2; }
$$ = $1;
} else $$ = $2;
}
; ;
block: block: