]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Cleanup timeformat grammar
authorOndrej Zajicek <santiago@crfreenet.org>
Tue, 5 Nov 2024 16:35:20 +0000 (17:35 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Thu, 7 Nov 2024 14:08:51 +0000 (15:08 +0100)
conf/confbase.Y
nest/config.Y
sysdep/unix/config.Y

index 1011a57c7c42cfe352a15325a1bfbf8af63bbcd5..5b00937f22aad4867e9cdf3e051fe1ee5362857f 100644 (file)
@@ -96,7 +96,8 @@ CF_DECLS
   struct f_prefix px;
   struct proto_spec ps;
   struct channel_limit cl;
-  struct timeformat *tf;
+  struct timeformat tf;
+  struct timeformat *tfp;
   mpls_label_stack *mls;
   const struct adata *bs;
   struct aggr_item_node *ai;
index 2b92ea52e7f993f635cccfefdd5112975fa01b53..f2a4f84baed9f3c9e935f2e8b31d433e61c4a1c4 100644 (file)
@@ -153,6 +153,8 @@ CF_ENUM(T_ENUM_MPLS_POLICY, MPLS_POLICY_, NONE, STATIC, PREFIX, AGGREGATE, VRF)
 %type <ps> proto_patt proto_patt2
 %type <cc> channel_start proto_channel
 %type <cl> limit_spec
+%type <tf> timeformat_spec
+%type <tfp> timeformat_which
 %type <net> r_args_for_val
 %type <net_ptr> r_args_for
 %type <t> channel_sym
@@ -390,6 +392,10 @@ debug_default:
 
 conf: timeformat_base ;
 
+timeformat_base:
+   TIMEFORMAT timeformat_which timeformat_spec ';' { *$2 = $3; }
+ ;
+
 timeformat_which:
    ROUTE { $$ = &new_config->tf_route; }
  | PROTOCOL { $$ = &new_config->tf_proto; }
@@ -398,18 +404,14 @@ timeformat_which:
  ;
 
 timeformat_spec:
-   timeformat_which TEXT { *$1 = (struct timeformat){$2, NULL, 0}; }
- | timeformat_which TEXT expr TEXT { *$1 = (struct timeformat){$2, $4, (s64) $3 S_}; }
- | timeformat_which ISO SHORT    { *$1 = TM_ISO_SHORT_S; }
- | timeformat_which ISO SHORT MS { *$1 = TM_ISO_SHORT_MS; }
- | timeformat_which ISO SHORT US { *$1 = TM_ISO_SHORT_US; }
- | timeformat_which ISO LONG    { *$1 = TM_ISO_LONG_S; }
- | timeformat_which ISO LONG MS { *$1 = TM_ISO_LONG_MS; }
- | timeformat_which ISO LONG US { *$1 = TM_ISO_LONG_US; }
- ;
-
-timeformat_base:
-   TIMEFORMAT timeformat_spec ';'
+   TEXT { $$ = (struct timeformat){$1, NULL, 0}; }
+ | TEXT expr TEXT { $$ = (struct timeformat){$1, $3, (s64) $2 S_}; }
+ | ISO SHORT   { $$ = TM_ISO_SHORT_S; }
+ | ISO SHORT MS        { $$ = TM_ISO_SHORT_MS; }
+ | ISO SHORT US        { $$ = TM_ISO_SHORT_US; }
+ | ISO LONG    { $$ = TM_ISO_LONG_S; }
+ | ISO LONG MS { $$ = TM_ISO_LONG_MS; }
+ | ISO LONG US { $$ = TM_ISO_LONG_US; }
  ;
 
 
index 7607f34aa2767b5777ef50f7625f4e0bdf0e7fa3..f4e70d19888c1764ccca328737ad2a1cb711a48b 100644 (file)
@@ -24,7 +24,6 @@ CF_KEYWORDS(DEBUG, LATENCY, LIMIT, WATCHDOG, WARNING, TIMEOUT, THREADS)
 
 %type <i> log_mask log_mask_list log_cat cfg_timeout
 %type <t> cfg_name
-%type <tf> timeformat_which
 %type <t> syslog_name
 
 CF_GRAMMAR