summaryrefslogtreecommitdiffstats
path: root/filter/config.Y
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>1999-11-11 14:55:39 +0100
committerPavel Machek <pavel@ucw.cz>1999-11-11 14:55:39 +0100
commit4515bdba4f56b298e62150ffe24608ba1a42e7da (patch)
treea0e979e2be1a8179fcddcc3621c74f3f13021886 /filter/config.Y
parent4ed8718a19747bba95ff86fb8d3c6ea357b50101 (diff)
downloadbird-4515bdba4f56b298e62150ffe24608ba1a42e7da.tar
bird-4515bdba4f56b298e62150ffe24608ba1a42e7da.zip
Fixed order of arguments for function call.
Enumeration types should work once CF_ENUM() is ready. Created test.conf for testing of filters. (I'm currently thinking about ./tests in root directory which will just fire all available tests...)
Diffstat (limited to 'filter/config.Y')
-rw-r--r--filter/config.Y39
1 files changed, 12 insertions, 27 deletions
diff --git a/filter/config.Y b/filter/config.Y
index 5c8977c..4fe1473 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -8,7 +8,6 @@
FIXME (nonurgent): define keyword
FIXME: whole system of paths, path ~ string, path.prepend(), path.originate
FIXME: create community lists
- FIXME: enumerational types
FIXME: write access to dynamic attributes.
*/
@@ -41,9 +40,9 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, CONST,
%nonassoc THEN
%nonassoc ELSE
-%type <x> term block cmds cmd function_body constant print_one print_list var_list var_listn any_dynamic enums
+%type <x> term block cmds cmd function_body constant print_one print_list var_list var_listn any_dynamic
%type <f> filter filter_body
-%type <i> type break_command pair enum_rts
+%type <i> type break_command pair
%type <e> set_item set_items switch_body
%type <v> set_atom prefix prefix_s ipa
%type <s> decls declsn one_decl function_params
@@ -103,8 +102,8 @@ decls: /* EMPTY */ { $$ = NULL; }
/* Declarations that have no ';' at the end. */
declsn: one_decl { $$ = $1; }
| declsn ';' one_decl {
- $$ = $3;
- $$->aux = (int) $1;
+ $$ = $1;
+ $$->aux = (int) $3;
}
;
@@ -229,27 +228,6 @@ switch_body: /* EMPTY */ { $$ = NULL; }
}
;
-enum_rts:
- RTSDUMMY { $$ = 0; }
- | RTSSTATIC { $$ = 1; }
- | RTSINHERIT { $$ = 2; }
- | RTSDEVICE { $$ = 3; }
- | RTSSTATIC_DEVICE { $$ = 4; }
- | RTSREDIRECT { $$ = 5; }
- | RTSRIP { $$ = 6; }
- | RTSRIP_EXT { $$ = 7; }
- | RTSOSPF { $$ = 8; }
- | RTSOSPF_EXT { $$ = 9; }
- | RTSOSPF_IA { $$ = 10; }
- | RTSOSPF_BOUNDARY { $$ = 11; }
- | RTSBGP { $$ = 12; }
- | RTSPIPE { $$ = 13; }
- ;
-
-enums:
- enum_rts { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_ENUM_RTS; $$->a2.i = $1; }
- ;
-
constant:
CONST '(' expr ')' { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_INT; $$->a2.i = $3; }
| NUM { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_INT; $$->a2.i = $1; }
@@ -260,7 +238,6 @@ constant:
| ipa { NEW_F_VAL; $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; *val = $1; }
| prefix_s {NEW_F_VAL; $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; *val = $1; }
| '[' set_items ']' { printf( "We've got a set here..." ); $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_SET; $$->a2.p = build_tree($2); printf( "ook\n" ); }
- | enums { $$ = $1; }
;
any_dynamic:
@@ -285,6 +262,13 @@ term:
| SYM {
$$ = f_new_inst();
switch ($1->class) {
+ case 0: /* This should better be an enum */
+ $$->code = 'c';
+ $$->a1.i = $1->aux;
+ if (($$->a1.i < T_ENUM_LO) || ($$->a1.i > T_ENUM_HI))
+ cf_error("You used symbol and it was not enum.\n");
+ $$->a2.i = (int) $1->aux2;
+ break;
case SYM_VARIABLE | T_INT:
case SYM_VARIABLE | T_PAIR:
case SYM_VARIABLE | T_PREFIX:
@@ -296,6 +280,7 @@ term:
cf_error("Can not use this class of symbol (%s,%x) as variable.", $1->name, $1->class );
}
}
+
| RTA '.' FROM { $$ = f_new_inst(); $$->code = 'a'; $$->a1.i = T_IP; $$->a2.i = OFFSETOF(struct rta, from); }
| RTA '.' GW { $$ = f_new_inst(); $$->code = 'a'; $$->a1.i = T_IP; $$->a2.i = OFFSETOF(struct rta, gw); }