From: Ondrej Zajicek Date: Tue, 5 Nov 2024 16:35:20 +0000 (+0100) Subject: Nest: Cleanup timeformat grammar X-Git-Tag: v2.16~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9eca3e1a2e5a71c38ebd95ee01489d1eb62a063f;p=thirdparty%2Fbird.git Nest: Cleanup timeformat grammar --- diff --git a/conf/confbase.Y b/conf/confbase.Y index 1011a57c7..5b00937f2 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -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; diff --git a/nest/config.Y b/nest/config.Y index 2b92ea52e..f2a4f84ba 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -153,6 +153,8 @@ CF_ENUM(T_ENUM_MPLS_POLICY, MPLS_POLICY_, NONE, STATIC, PREFIX, AGGREGATE, VRF) %type proto_patt proto_patt2 %type channel_start proto_channel %type limit_spec +%type timeformat_spec +%type timeformat_which %type r_args_for_val %type r_args_for %type 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; } ; diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y index 7607f34aa..f4e70d198 100644 --- a/sysdep/unix/config.Y +++ b/sysdep/unix/config.Y @@ -24,7 +24,6 @@ CF_KEYWORDS(DEBUG, LATENCY, LIMIT, WATCHDOG, WARNING, TIMEOUT, THREADS) %type log_mask log_mask_list log_cat cfg_timeout %type cfg_name -%type timeformat_which %type syslog_name CF_GRAMMAR