From 38506f71b0bea5580987e999a7b1a69f58aec7ec Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Mon, 12 Apr 1999 19:58:18 +0000 Subject: Sets of integers now actually work. Sets of IP will work as soon as compare function is ready. --- filter/config.Y | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'filter/config.Y') diff --git a/filter/config.Y b/filter/config.Y index a3eeef7..4f910c2 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -18,7 +18,7 @@ CF_HDR CF_DECLS -CF_KEYWORDS(FUNCTION, PRINTDEBUG, PRINT, CONST, PUTS, +CF_KEYWORDS(FUNCTION, PRINT, CONST, ACCEPT, REJECT, ERROR, QUITBIRD, INT, BOOL, IP, PREFIX, PAIR, SET, STRING, IF, THEN, ELSE, @@ -29,6 +29,8 @@ CF_KEYWORDS(FUNCTION, PRINTDEBUG, PRINT, CONST, PUTS, %type term block cmds cmd function_body ifthen constant print_one print_list %type filter filter_body %type type break_command +%type set_item set_items +%type set_atom CF_GRAMMAR @@ -128,12 +130,29 @@ block: } ; +set_atom: + NUM { $$.type = T_INT; $$.val.i = $1; } + | IPA { $$.type = T_IP; $$.val.ip = $1; } + ; + +set_item: + set_atom { $$ = f_new_tree(); $$->from = $$->to = $1 } + | set_atom '.' '.' set_atom { $$ = f_new_tree(); $$->from = $1; $$->to = $4; } + ; + +set_items: + set_item { $$ = $1; } + | set_items ',' set_item { $$ = $3; $$->left = $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; } | TRUE { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_BOOL; $$->a2.i = 1; } | FALSE { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_BOOL; $$->a2.i = 0; } - | TEXT { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_STRING; $$->a2.p = $1; } + | TEXT { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_STRING; $$->a2.p = $1; } + | IPA { struct f_val * val; val = cfg_alloc(sizeof(struct f_val)); $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; val->type = T_IP; val->val.ip = $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" ); } ; term: @@ -145,6 +164,7 @@ term: | term '<' '=' term { $$ = f_new_inst(); $$->code = '<='; $$->a1.p = $1; $$->a2.p = $4; } | term '>' term { $$ = f_new_inst(); $$->code = '<'; $$->a1.p = $3; $$->a2.p = $1; } | term '>' '=' term { $$ = f_new_inst(); $$->code = '<='; $$->a1.p = $4; $$->a2.p = $1; } + | term '~' term { $$ = f_new_inst(); $$->code = '~'; $$->a1.p = $1; $$->a2.p = $3; } | SYM { $$ = f_new_inst(); -- cgit v1.2.3