From 1cfc72e99382ab47b55c9410ab531c0baf8ac46e Mon Sep 17 00:00:00 2001 From: jtmoon79 <815261+jtmoon79@users.noreply.github.com> Date: Sun, 9 Oct 2022 17:52:00 -0700 Subject: [PATCH] datetime.rs add RP_NOALPHA after CGP_TZZ In recently added pattern, the `CGP_TZZ` should be followed by `RP_NOALPHA`. Also, add more tests for this `DTPD!` and others. --- src/data/datetime.rs | 64 +++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/src/data/datetime.rs b/src/data/datetime.rs index 4d390cb6..b947914e 100644 --- a/src/data/datetime.rs +++ b/src/data/datetime.rs @@ -2505,17 +2505,18 @@ pub const DATETIME_PARSE_DATAS: [DateTimeParseInstr; DATETIME_PARSE_DATAS_LEN] = line!(), ), DTPD!( - concatcp!("^", RP_LEVELS, "[:]?", RP_BLANKSq, CGP_DAYa, RP_BLANK, CGP_MONTHb, RP_BLANK, CGP_DAYd, RP_BLANK, CGP_YEAR, RP_BLANK, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, RP_BLANKq, CGP_TZZ), + concatcp!("^", RP_LEVELS, "[:]?", RP_BLANKSq, CGP_DAYa, RP_BLANK, CGP_MONTHb, RP_BLANK, CGP_DAYd, RP_BLANK, CGP_YEAR, RP_BLANK, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, RP_BLANKq, CGP_TZZ, RP_NOALPHA), DTFSS_YbdHMSZ, 0, 56, CGN_DAYa, CGN_TZ, &[ + (7, 35, "TRACE: Sat Jan 01 2000 08:00:00 PST"), (7, 35, "TRACE: Sat Jan 01 2000 08:00:00 PST TRACE: ⇥ ×1‼"), (8, 36, "trace0: sat jan 01 2000 08:00:00 mit trace0: ⇥ ×1‼"), (9, 38, "TRACE1: Sat Jan 01 2000 08:00:00 YAKT TRACE1: ⇥ ×2‼"), - (8, 36, "TRACE2: Sat Jan 01 2000 08:00:00 WITA TRACE2: ⇥ ×1‼"), - (7, 35, "DEBUG: Sun Jan 02 2000 21:00:00 WITA DEBUG:‼"), - (7, 35, "debug: sat jan 01 2000 08:00:00 wita debug:‼"), - (7, 35, "DEBUG0 Sat Jan 01 2000 08:00:00 WITA debug0‼"), - (8, 36, "DEBUG9: Sat Jan 01 2000 08:00:00 WITA debug9:‼"), + (8, 37, "TRACE2: Sat Jan 01 2000 08:00:00 WITA TRACE2: ⇥ ×1‼"), + (7, 36, "DEBUG: Sun Jan 02 2000 21:00:00 WITA DEBUG:‼"), + (7, 36, "debug: sat jan 01 2000 08:00:00 wita debug:‼"), + (7, 36, "DEBUG0 Sat Jan 01 2000 08:00:00 WITA debug0‼"), + (8, 37, "DEBUG9: Sat Jan 01 2000 08:00:00 WITA debug9:‼"), (6, 35, "INFO: Sat Jan 01 2000 08:00:00 PONT info:‼"), (7, 36, "INFO2: Sat Jan 01 2000 08:00:00 PONT info2:‼"), (9, 38, "warning: Sat Jan 01 2000 08:00:00 pont warning:‼"), @@ -2523,8 +2524,8 @@ pub const DATETIME_PARSE_DATAS: [DateTimeParseInstr; DATETIME_PARSE_DATAS_LEN] = (8, 37, "warning Sat Jan 01 2000 08:00:00 pont warning ⇥ ×1‼"), (8, 37, "WARNING MON JAN 03 2000 23:30:59 PONT warning ⇥ ×1‼"), (9, 38, "warning Sat Jan 01 2000 08:00:00 pont warning ⇥ ×2‼"), - (6, 35, "WARN: SAT JAN 01 2000 08:00:00 PONT warn:‼"), - (7, 36, "ERROR: Sat Jan 01 2000 08:00:00 PONT error:‼"), + (6, 35, "WARN: SAT JAN 01 2000 08:00:00 PONT:warn:‼"), + (7, 36, "ERROR: SAT jan 01 2000 08:00:00 PONT|error:‼"), (5, 34, "ERR: Sat Jan 01 2000 08:00:00 PONT err:‼"), ], line!(), @@ -2742,20 +2743,34 @@ pub const DATETIME_PARSE_DATAS: [DateTimeParseInstr; DATETIME_PARSE_DATAS_LEN] = DTPD!( concatcp!(CGP_YEAR, D_Dq, CGP_MONTHm, D_Dq, CGP_DAYd, D_DHcd, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, D_SF, CGP_FRACTIONAL, RP_BLANKq, CGP_TZzc), DTFSS_YmdHMSfzc, 0, 1024, CGN_YEAR, CGN_TZ, - &[(0, 33, "2000/01/03 00:02:03.123456 -11:30 ab")], + &[ + (0, 33, "2000/01/03 00:02:03.123456 -11:30 ab"), + (1, 34, "<2000/01/03 00:02:03.123456 -11:30> abc"), + ], line!(), ), DTPD!( concatcp!(CGP_YEAR, D_Dq, CGP_MONTHm, D_Dq, CGP_DAYd, D_DHcd, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, D_SF, CGP_FRACTIONAL, RP_BLANKq, CGP_TZzp), DTFSS_YmdHMSfzp, 0, 1024, CGN_YEAR, CGN_TZ, - &[(0, 33, "2000/01/04 00:03:04,123456789 -11 abc")], + &[ + (0, 33, "2000/01/04 00:03:04,123456789 -11"), + (0, 33, "2000/01/04 00:03:04,123456789 -11 abc"), + (0, 33, "2000/01/04 00:03:04,123456789 -11_abc"), + (1, 34, "[2000/01/04 00:03:04,123456789 -11] abc"), + ], line!(), ), DTPD!( concatcp!(CGP_YEAR, D_Dq, CGP_MONTHm, D_Dq, CGP_DAYd, D_DHcd, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, D_SF, CGP_FRACTIONAL, RP_BLANK, CGP_TZZ, RP_NOALPHA), DTFSS_YmdHMSfZ, 0, 1024, CGN_YEAR, CGN_TZ, &[ + (0, 34, "2000/01/05 00:04:05.123456789 VLAT:"), + (0, 34, "2000/01/05 00:04:05.123456789 VLAT"), (0, 34, "2000/01/05 00:04:05.123456789 VLAT abcd"), + (0, 34, "2000/01/05 00:04:05.123456789 VLAT:abcd"), + (0, 34, "2000/01/05 00:04:05.123456789 VLAT|abcd"), + (1, 35, "[2000/01/05 00:04:05.123456789 VLAT] abcd"), + (1, 35, "[2000/01/05 00:04:05.123456789 VLAT]"), (0, 34, "2000/01/05 00:04:05.123456789 vlat abcd"), ], line!(), @@ -2763,32 +2778,51 @@ pub const DATETIME_PARSE_DATAS: [DateTimeParseInstr; DATETIME_PARSE_DATAS_LEN] = DTPD!( concatcp!(CGP_YEAR, D_Dq, CGP_MONTHm, D_Dq, CGP_DAYd, D_DHcd, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, D_SF, CGP_FRACTIONAL), DTFSS_YmdHMSf, 0, 1024, CGN_YEAR, CGN_FRACTIONAL, - &[(0, 29, "2020-01-06 00:05:26.123456789 abcdefg")], + &[ + (0, 29, "2020-01-06 00:05:26.123456789 abcdefg"), + (20, 49, "[FOOBAR] (PID 2005) 2020-01-06 00:05:26.123456789 foobar!"), + ], line!(), ), // DTPD!( concatcp!(CGP_YEAR, D_Dq, CGP_MONTHm, D_Dq, CGP_DAYd, D_DHcd, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, RP_BLANKq, CGP_TZz), DTFSS_YmdHMSz, 0, 1024, CGN_YEAR, CGN_TZ, - &[(0, 25, "2000/01/07T00:06:02 -1100 abcdefgh")], + &[ + (0, 25, "2000/01/07T00:06:02 -1100 abcdefgh"), + (1, 26, "[2000/01/07T00:06:02 -1100] abcdefgh"), + ], line!(), ), DTPD!( concatcp!(CGP_YEAR, D_Dq, CGP_MONTHm, D_Dq, CGP_DAYd, D_DHcd, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, RP_BLANKq, CGP_TZzc), DTFSS_YmdHMSzc, 0, 1024, CGN_YEAR, CGN_TZ, - &[(0, 26, "2000-01-08-00:07:03 -11:30 aabcdefghi")], + &[ + (0, 26, "2000-01-08-00:07:03 -11:30 aabcdefghi"), + (0, 26, "2000-01-08-00:07:03 -11:30 aabcdefghi"), + (1, 27, "[2000-01-08-00:07:03 -11:30] aabcdefghi"), + ], line!(), ), DTPD!( concatcp!(CGP_YEAR, D_Dq, CGP_MONTHm, D_Dq, CGP_DAYd, D_DHcd, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, RP_BLANKq, CGP_TZzp), DTFSS_YmdHMSzp, 0, 1024, CGN_YEAR, CGN_TZ, - &[(0, 23, "2000/01/09 00:08:04 -11 abcdefghij")], + &[ + (0, 23, "2000/01/09 00:08:04 -11 abcdefghij"), + (1, 24, "[2000/01/09 00:08:04 -11] abcdefghij"), + ], line!(), ), DTPD!( concatcp!(CGP_YEAR, D_Dq, CGP_MONTHm, D_Dq, CGP_DAYd, D_DHcd, CGP_HOUR, D_T, CGP_MINUTE, D_T, CGP_SECOND, RP_BLANK, CGP_TZZ, RP_NOALPHA), DTFSS_YmdHMSZ, 0, 1024, CGN_YEAR, CGN_TZ, - &[(0, 24, "2000/01/10T00:09:05 VLAT abcdefghijk")], + &[ + (0, 24, "2000/01/10T00:09:05 VLAT abcdefghijk"), + (0, 24, "2000/01/10T00:09:05 VLAT_abcdefghijk"), + (1, 25, "[2000/01/10T00:09:05 VLAT] abcdefghijk"), + (1, 25, "[2000/01/10T00:09:05 VLAT] abcdefghijk"), + (1, 25, "<2000/01/10T00:09:05 VLAT> abcdefghijk"), + ], line!(), ), //