summaryrefslogtreecommitdiffstats
path: root/filter/config.Y
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-03-01 12:32:23 +0100
committerMartin Mares <mj@ucw.cz>2000-03-01 12:32:23 +0100
commitdb1326aa5e39711d88d305ac08a0afa137ab77f0 (patch)
treee7b9ebe24bd923bde8c2d177aec2131cf8ebf90c /filter/config.Y
parent2ca3d9a8fc25be6f7d41d8a6ff50a70612c11c93 (diff)
downloadbird-db1326aa5e39711d88d305ac08a0afa137ab77f0.tar
bird-db1326aa5e39711d88d305ac08a0afa137ab77f0.zip
Dynamic attributes are now declared in per-protocol grammar files instead
of filter/config.Y. Bird now compiles even if you disable RIP. Removed RTA and IMPOSSIBLE tokens (unused). Removed superfluous comment in filter.h. I've tried to do my best, but Pavel, please check these changes.
Diffstat (limited to 'filter/config.Y')
-rw-r--r--filter/config.Y21
1 files changed, 11 insertions, 10 deletions
diff --git a/filter/config.Y b/filter/config.Y
index 856189e..ed94b9b 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -34,16 +34,15 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, CONST, UNSET, RETURN,
INT, BOOL, IP, PREFIX, PAIR, SET, STRING,
IF, THEN, ELSE, CASE,
TRUE, FALSE,
- RTA, FROM, GW, NET, MASK, RIP_METRIC, RIP_TAG, SOURCE,
+ FROM, GW, NET, MASK, SOURCE,
LEN,
DEFINED,
- IMPOSSIBLE,
FILTER, WHERE)
%nonassoc THEN
%nonassoc ELSE
-%type <x> term block cmds cmd function_body constant print_one print_list var_list var_listn any_dynamic function_call
+%type <x> term block cmds cmd function_body constant print_one print_list var_list var_listn dynamic_attr function_call
%type <f> filter filter_body where_filter
%type <i> type break_command pair
%type <e> set_item set_items switch_body
@@ -268,10 +267,12 @@ constant:
| ENUM { $$ = f_new_inst(); $$->code = 'c'; $$->aux = $1 >> 16; $$->a2.i = $1 & 0xffff; }
;
-any_dynamic:
- RIP_METRIC { $$ = f_new_inst(); $$->aux = T_INT; $$->a2.i = EA_RIP_METRIC;}
- | RIP_TAG { $$ = f_new_inst(); $$->aux = T_INT; $$->a2.i = EA_RIP_TAG; }
- ;
+/*
+ * Maybe there are no dynamic attributes defined by protocols.
+ * For such cases, we force the dynamic_attr list to contain
+ * at least an invalid token, so it's syntantically correct.
+ */
+CF_ADDTO(dynamic_attr, INVALID_TOKEN { $$ = NULL; })
rtadot: /* EMPTY, we are not permitted RTA. prefix */
;
@@ -334,7 +335,7 @@ term:
| rtadot NET { $$ = f_new_inst(); $$->code = 'a'; $$->aux = T_PREFIX; $$->a2.i = 0x12345678; }
| rtadot SOURCE { $$ = f_new_inst(); $$->code = 'a'; $$->aux = T_ENUM_RTS; $$->a2.i = OFFSETOF(struct rta, gw); }
- | rtadot any_dynamic { $$ = $2; $$->code = P('e','a'); }
+ | rtadot dynamic_attr { $$ = $2; $$->code = P('e','a'); }
| term '.' IP { $$ = f_new_inst(); $$->code = P('c','p'); $$->a1.p = $1; $$->aux = T_IP; }
| term '.' LEN { $$ = f_new_inst(); $$->code = P('c','p'); $$->a1.p = $1; $$->aux = T_INT; }
@@ -416,12 +417,12 @@ cmd:
$$->code = 'r';
$$->a1.p = $2;
}
- | rtadot any_dynamic '=' term ';' {
+ | rtadot dynamic_attr '=' term ';' {
$$ = $2;
$$->code = P('e','S');
$$->a1.p = $4;
}
- | UNSET '(' rtadot any_dynamic ')' ';' {
+ | UNSET '(' rtadot dynamic_attr ')' ';' {
$$ = $4;
$$->aux = T_VOID;
$$->code = P('e','S');