Skip to content

Commit

Permalink
datetime.rs add RP_NOALPHA after CGP_TZZ
Browse files Browse the repository at this point in the history
In recently added pattern, the `CGP_TZZ` should be
followed by `RP_NOALPHA`.

Also, add more tests for this `DTPD!` and others.
  • Loading branch information
jtmoon79 committed Oct 10, 2022
1 parent 9ddaaee commit 1cfc72e
Showing 1 changed file with 49 additions and 15 deletions.
64 changes: 49 additions & 15 deletions src/data/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2505,26 +2505,27 @@ 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:‼"),
(8, 37, "warning sat jan 01 2000 08:00:00 pont warning‼"),
(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!(),
Expand Down Expand Up @@ -2742,53 +2743,86 @@ 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!(),
),
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!(),
),
//
Expand Down

0 comments on commit 1cfc72e

Please sign in to comment.