]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Enums do not work, this is testcase.
authorPavel Machek <pavel@ucw.cz>
Wed, 10 Nov 1999 13:59:13 +0000 (13:59 +0000)
committerPavel Machek <pavel@ucw.cz>
Wed, 10 Nov 1999 13:59:13 +0000 (13:59 +0000)
bird.conf
filter/config.Y

index 46633bf24b809c32beb8b422f923be837f77ddf5..ec154759fa30a016a7b95ae6feec5342b0f6ac8a 100644 (file)
--- a/bird.conf
+++ b/bird.conf
@@ -46,6 +46,7 @@ ip p;
        p = 127.1.2.3;
        print "Testing mask : 127.0.0.0 = " p.mask(8);
        print "Testing pairs: (1,2) = " (1,2);
+       print "Set of enums: " RTSDUMMY;
 
        print "What will this do? " [ 1, 2, 1, 1, 1, 3, 4, 1, 1, 1, 5 ];
 
index 36d6c6f3ddff9637979ce2736924d63e0c279fa4..54aeb69d8ad3f998ab414ea25f4f949a692ca7a1 100644 (file)
@@ -43,7 +43,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, CONST,
 %nonassoc THEN
 */
 
-%type <x> term block cmds cmd function_body constant print_one print_list var_list var_listn any_dynamic
+%type <x> term block cmds cmd function_body constant print_one print_list var_list var_listn any_dynamic enums
 %type <f> filter filter_body
 %type <i> type break_command pair enum_rts
 %type <e> set_item set_items switch_body
@@ -248,6 +248,10 @@ enum_rts:
  | 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; }
@@ -258,8 +262,7 @@ 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" ); }
-
- | enum_rts { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_ENUM_RTS; $$->a2.i = $1; } 
+ | enums { $$ = $1; }
  ;
 
 any_dynamic:
@@ -280,6 +283,7 @@ term:
  | term '~' term     { $$ = f_new_inst(); $$->code = '~';  $$->a1.p = $1; $$->a2.p = $3; }
  | DEFINED '(' term ')' { $$ = f_new_inst(); $$->code = 'de';  $$->a1.p = $3; }
 
+ | constant { $$ = $1; }
  | SYM {
      $$ = f_new_inst();
      switch ($1->class) {
@@ -291,10 +295,9 @@ term:
         $$->a1.p = $1->aux2;
         break;
        default:
-        cf_error("Can not use this class of symbol as variable." );
+        cf_error("Can not use this class of symbol (%s,%x) as variable.", $1->name, $1->class );
      }
    }
- | constant { $$ = $1; }
  | 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); }