]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit '39e75b87' into thread-merge-2.16
authorMaria Matejka <mq@ucw.cz>
Thu, 28 Nov 2024 11:43:43 +0000 (12:43 +0100)
committerMaria Matejka <mq@ucw.cz>
Thu, 28 Nov 2024 11:43:43 +0000 (12:43 +0100)
1  2 
doc/bird.sgml
filter/config.Y
filter/test.conf

diff --cc doc/bird.sgml
index d07ac6dd0b5ce292f83be99f50c4351af44662f4,e04f8d0ebcc2003730ea96a09bfa182b6ca88456..c5ebc142b6c31c3883a213cdc5bc90def22f6f03
@@@ -1995,13 -1945,16 +1997,16 @@@ may be an existing one (when just name 
  and name is used). In both cases, it must have the same type as elements.
  
  <p>The <cf>case</cf> is similar to case from Pascal. Syntax is <cf>case
- <m/expr/ { else: | <m/num_or_prefix [ .. num_or_prefix]/: <m/statement/ ; [
- ... ] }</cf>. The expression after <cf>case</cf> can be of any type which can be
- on the left side of the &tilde; operator and anything that could be a member of
- a set is allowed before <cf/:/. Multiple commands must be grouped by <cf/{}/.
- If <cf><m/expr/</cf> matches one of the <cf/:/ clauses, statements
- between it and next <cf/:/ statement are executed. If <cf><m/expr/</cf> matches
- neither of the <cf/:/ clauses, the statements after <cf/else:/ are executed.
+ <m/expr/ { else: | <m/set_body_expr/ /: <m/statement/ ; [... ] }</cf>.
+ The expression after <cf>case</cf> can be of any type that could be a member of
+ a set, while the <m/set_body_expr/ before <cf/:/ can be anything (constants,
+ intervals, expressions) that could be a part of a set literal. One exception is
+ prefix type, which can be used in sets bud not in <cf/case/ structure. Multiple
 -commands are allowed without <cf/{}/ grouping. If <cf><m/expr/</cf> matches one
 -of the <cf/:/ clauses, statements between it and next <cf/:/ statement are
++commands must be grouped by <cf/{}/. If <cf><m/expr/</cf> matches one
++of the <cf/:/ clauses, the statement or block after it is
+ executed. If <cf><m/expr/</cf> matches neither of the <cf/:/ clauses, the
 -statements after <cf/else:/ are executed.
++statement or block after <cf/else:/ is executed.
  
  <p>Here is example that uses <cf/if/ and <cf/case/ structures:
  
diff --cc filter/config.Y
index 311e851dc8ef581007740f447d82b574e703d22d,d656a7268ae1b369c9c5b5d9b11967e890f3b87c..bbffdbd4f6c17dfef3f763a136a8b1121cf90e01
@@@ -672,12 -642,18 +672,18 @@@ set_atom0
   | VPN_RD { $$.type = T_RD; $$.val.ec = $1; }
   | ENUM   { $$.type = pair_a($1); $$.val.i = pair_b($1); }
   | '(' term ')' {
 -     $$ = cf_eval($2, T_VOID);
 +     $$ = cf_eval_tmp($2, T_VOID);
-      if (!f_valid_set_type($$.type)) cf_error("Set-incompatible type");
+      if (!f_valid_set_type($$.type))
+        cf_error("Set-incompatible type (%s)", f_type_name($$.type));
     }
 - | symbol_known {
+  ;
+ set_atom:
+    set_atom0
 + | CF_SYM_KNOWN {
       cf_assert_symbol($1, SYM_CONSTANT);
-      if (!f_valid_set_type(SYM_TYPE($1))) cf_error("%s: set-incompatible type", $1->name);
+      if (!f_valid_set_type(SYM_TYPE($1)))
+        cf_error("%s: Set-incompatible type (%s)", $1->name, f_type_name(SYM_TYPE($1)));
       $$ = *$1->val;
     }
   ;
@@@ -779,7 -752,7 +782,7 @@@ fprefix_set
   ;
  
  switch_body: /* EMPTY */ { $$ = NULL; }
-  | switch_body switch_items ':' cmd  {
 - | switch_body switch_items ':' cmds_scoped {
++ | switch_body switch_items ':' cmd {
       /* Fill data fields */
       struct f_tree *t;
       for (t = $2; t; t = t->left)
Simple merge