Browse Source

Merge branch 'PHP-8.3' into PHP-8.4

pull/19847/head
Derick Rethans 1 month ago
parent
commit
2e85c5f245
No known key found for this signature in database GPG Key ID: 910DEB46F53EA312
  1. 213
      ext/date/lib/parse_date.c
  2. 5
      ext/date/lib/parse_date.re
  3. 18
      ext/date/lib/parse_iso_intervals.c
  4. 8
      ext/date/lib/timelib.h

213
ext/date/lib/parse_date.c

@ -1,4 +1,4 @@
/* Generated by re2c 1.0.3 on Wed Sep 11 17:29:29 2024 */
/* Generated by re2c 1.0.3 on Mon Sep 15 10:38:03 2025 */
#line 1 "ext/date/lib/parse_date.re"
/*
* The MIT License (MIT)
@ -941,10 +941,12 @@ timelib_long timelib_parse_zone(const char **ptr, int *dst, timelib_time *t, int
{
timelib_tzinfo *res;
timelib_long retval = 0;
size_t paren_count = 0;
*tz_not_found = 0;
while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
paren_count += **ptr == '(';
++*ptr;
}
if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' && ((*ptr)[3] == '+' || (*ptr)[3] == '-')) {
@ -993,8 +995,9 @@ timelib_long timelib_parse_zone(const char **ptr, int *dst, timelib_time *t, int
*tz_not_found = (found == 0);
retval = offset;
}
while (**ptr == ')') {
while (paren_count > 0 && **ptr == ')') {
++*ptr;
paren_count--;
}
return retval;
}
@ -1018,11 +1021,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 1151 "ext/date/lib/parse_date.re"
#line 1154 "ext/date/lib/parse_date.re"
#line 1026 "<stdout>"
#line 1029 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@ -1203,23 +1206,23 @@ yy2:
YYDEBUG(2, *YYCURSOR);
++YYCURSOR;
YYDEBUG(3, *YYCURSOR);
#line 1984 "ext/date/lib/parse_date.re"
#line 1987 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 1212 "<stdout>"
#line 1215 "ext/date/lib/parse_date.c"
yy4:
YYDEBUG(4, *YYCURSOR);
++YYCURSOR;
yy5:
YYDEBUG(5, *YYCURSOR);
#line 1990 "ext/date/lib/parse_date.re"
#line 1993 "ext/date/lib/parse_date.re"
{
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
goto std;
}
#line 1223 "<stdout>"
#line 1226 "ext/date/lib/parse_date.c"
yy6:
YYDEBUG(6, *YYCURSOR);
yyaccept = 0;
@ -1234,11 +1237,11 @@ yy6:
if (yych <= '9') goto yy58;
yy8:
YYDEBUG(8, *YYCURSOR);
#line 1979 "ext/date/lib/parse_date.re"
#line 1982 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 1242 "<stdout>"
#line 1245 "ext/date/lib/parse_date.c"
yy9:
YYDEBUG(9, *YYCURSOR);
yych = *++YYCURSOR;
@ -1272,11 +1275,11 @@ yy11:
YYDEBUG(11, *YYCURSOR);
++YYCURSOR;
YYDEBUG(12, *YYCURSOR);
#line 1974 "ext/date/lib/parse_date.re"
#line 1977 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 1280 "<stdout>"
#line 1283 "ext/date/lib/parse_date.c"
yy13:
YYDEBUG(13, *YYCURSOR);
yyaccept = 1;
@ -1777,7 +1780,7 @@ yy19:
}
yy20:
YYDEBUG(20, *YYCURSOR);
#line 1889 "ext/date/lib/parse_date.re"
#line 1892 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@ -1791,7 +1794,7 @@ yy20:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 1795 "<stdout>"
#line 1798 "ext/date/lib/parse_date.c"
yy21:
YYDEBUG(21, *YYCURSOR);
yych = *++YYCURSOR;
@ -3596,7 +3599,7 @@ yy80:
}
yy81:
YYDEBUG(81, *YYCURSOR);
#line 1636 "ext/date/lib/parse_date.re"
#line 1639 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@ -3607,7 +3610,7 @@ yy81:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 3611 "<stdout>"
#line 3614 "ext/date/lib/parse_date.c"
yy82:
YYDEBUG(82, *YYCURSOR);
yych = *++YYCURSOR;
@ -4122,7 +4125,7 @@ yy112:
}
if (yych == '.') goto yy289;
YYDEBUG(114, *YYCURSOR);
#line 1211 "ext/date/lib/parse_date.re"
#line 1214 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@ -4147,7 +4150,7 @@ yy112:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 4151 "<stdout>"
#line 4154 "ext/date/lib/parse_date.c"
yy115:
YYDEBUG(115, *YYCURSOR);
++YYCURSOR;
@ -5873,7 +5876,7 @@ yy176:
}
yy177:
YYDEBUG(177, *YYCURSOR);
#line 1377 "ext/date/lib/parse_date.re"
#line 1380 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timetiny24 | timeshort24 | timelong24 | iso8601long");
@ -5900,7 +5903,7 @@ yy177:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 5904 "<stdout>"
#line 5907 "ext/date/lib/parse_date.c"
yy178:
YYDEBUG(178, *YYCURSOR);
yyaccept = 4;
@ -6929,7 +6932,7 @@ yy223:
}
yy224:
YYDEBUG(224, *YYCURSOR);
#line 1471 "ext/date/lib/parse_date.re"
#line 1474 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@ -6944,7 +6947,7 @@ yy224:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 6948 "<stdout>"
#line 6951 "ext/date/lib/parse_date.c"
yy225:
YYDEBUG(225, *YYCURSOR);
yyaccept = 5;
@ -7187,7 +7190,7 @@ yy250:
if (yych <= '9') goto yy431;
yy251:
YYDEBUG(251, *YYCURSOR);
#line 1553 "ext/date/lib/parse_date.re"
#line 1556 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@ -7201,7 +7204,7 @@ yy251:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 7205 "<stdout>"
#line 7208 "ext/date/lib/parse_date.c"
yy252:
YYDEBUG(252, *YYCURSOR);
yyaccept = 3;
@ -7315,7 +7318,7 @@ yy259:
if (yych == 'e') goto yy440;
yy260:
YYDEBUG(260, *YYCURSOR);
#line 1958 "ext/date/lib/parse_date.re"
#line 1961 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@ -7330,7 +7333,7 @@ yy260:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 7334 "<stdout>"
#line 7337 "ext/date/lib/parse_date.c"
yy261:
YYDEBUG(261, *YYCURSOR);
yych = *++YYCURSOR;
@ -7776,7 +7779,7 @@ yy289:
if (yych <= '9') goto yy471;
yy290:
YYDEBUG(290, *YYCURSOR);
#line 1237 "ext/date/lib/parse_date.re"
#line 1240 "ext/date/lib/parse_date.re"
{
timelib_sll i;
timelib_ull us;
@ -7815,7 +7818,7 @@ yy290:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 7819 "<stdout>"
#line 7822 "ext/date/lib/parse_date.c"
yy291:
YYDEBUG(291, *YYCURSOR);
yych = *++YYCURSOR;
@ -7840,7 +7843,7 @@ yy292:
}
yy293:
YYDEBUG(293, *YYCURSOR);
#line 1799 "ext/date/lib/parse_date.re"
#line 1802 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@ -7860,7 +7863,7 @@ yy293:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 7864 "<stdout>"
#line 7867 "ext/date/lib/parse_date.c"
yy294:
YYDEBUG(294, *YYCURSOR);
yyaccept = 7;
@ -7899,7 +7902,7 @@ yy294:
}
yy295:
YYDEBUG(295, *YYCURSOR);
#line 1879 "ext/date/lib/parse_date.re"
#line 1882 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@ -7908,7 +7911,7 @@ yy295:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 7912 "<stdout>"
#line 7915 "ext/date/lib/parse_date.c"
yy296:
YYDEBUG(296, *YYCURSOR);
yyaccept = 7;
@ -8483,7 +8486,7 @@ yy314:
}
yy315:
YYDEBUG(315, *YYCURSOR);
#line 1820 "ext/date/lib/parse_date.re"
#line 1823 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@ -8500,7 +8503,7 @@ yy315:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 8504 "<stdout>"
#line 8507 "ext/date/lib/parse_date.c"
yy316:
YYDEBUG(316, *YYCURSOR);
yych = *++YYCURSOR;
@ -8768,7 +8771,7 @@ yy324:
}
yy325:
YYDEBUG(325, *YYCURSOR);
#line 1622 "ext/date/lib/parse_date.re"
#line 1625 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@ -8781,7 +8784,7 @@ yy325:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 8785 "<stdout>"
#line 8788 "ext/date/lib/parse_date.c"
yy326:
YYDEBUG(326, *YYCURSOR);
yyaccept = 10;
@ -9475,7 +9478,7 @@ yy350:
}
yy351:
YYDEBUG(351, *YYCURSOR);
#line 1168 "ext/date/lib/parse_date.re"
#line 1171 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@ -9483,7 +9486,7 @@ yy351:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 9487 "<stdout>"
#line 9490 "ext/date/lib/parse_date.c"
yy352:
YYDEBUG(352, *YYCURSOR);
yyaccept = 2;
@ -10986,7 +10989,7 @@ yy419:
}
yy420:
YYDEBUG(420, *YYCURSOR);
#line 1405 "ext/date/lib/parse_date.re"
#line 1408 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@ -11008,7 +11011,7 @@ yy420:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 11012 "<stdout>"
#line 11015 "ext/date/lib/parse_date.c"
yy421:
YYDEBUG(421, *YYCURSOR);
yyaccept = 13;
@ -11089,7 +11092,7 @@ yy421:
}
yy422:
YYDEBUG(422, *YYCURSOR);
#line 1790 "ext/date/lib/parse_date.re"
#line 1793 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@ -11097,7 +11100,7 @@ yy422:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 11101 "<stdout>"
#line 11104 "ext/date/lib/parse_date.c"
yy423:
YYDEBUG(423, *YYCURSOR);
yyaccept = 3;
@ -11704,7 +11707,7 @@ yy456:
YYDEBUG(456, *YYCURSOR);
++YYCURSOR;
YYDEBUG(457, *YYCURSOR);
#line 1339 "ext/date/lib/parse_date.re"
#line 1342 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@ -11721,7 +11724,7 @@ yy456:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 11725 "<stdout>"
#line 11728 "ext/date/lib/parse_date.c"
yy458:
YYDEBUG(458, *YYCURSOR);
yych = *++YYCURSOR;
@ -13048,7 +13051,7 @@ yy525:
}
yy526:
YYDEBUG(526, *YYCURSOR);
#line 1177 "ext/date/lib/parse_date.re"
#line 1180 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@ -13059,7 +13062,7 @@ yy526:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 13063 "<stdout>"
#line 13066 "ext/date/lib/parse_date.c"
yy527:
YYDEBUG(527, *YYCURSOR);
yyaccept = 2;
@ -14105,7 +14108,7 @@ yy566:
}
yy567:
YYDEBUG(567, *YYCURSOR);
#line 1539 "ext/date/lib/parse_date.re"
#line 1542 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@ -14118,7 +14121,7 @@ yy567:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14122 "<stdout>"
#line 14125 "ext/date/lib/parse_date.c"
yy568:
YYDEBUG(568, *YYCURSOR);
yyaccept = 15;
@ -14569,7 +14572,7 @@ yy599:
}
yy600:
YYDEBUG(600, *YYCURSOR);
#line 1608 "ext/date/lib/parse_date.re"
#line 1611 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@ -14582,7 +14585,7 @@ yy600:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 14586 "<stdout>"
#line 14589 "ext/date/lib/parse_date.c"
yy601:
YYDEBUG(601, *YYCURSOR);
yych = *++YYCURSOR;
@ -15957,7 +15960,7 @@ yy696:
YYDEBUG(696, *YYCURSOR);
++YYCURSOR;
YYDEBUG(697, *YYCURSOR);
#line 1594 "ext/date/lib/parse_date.re"
#line 1597 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@ -15970,7 +15973,7 @@ yy696:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 15974 "<stdout>"
#line 15977 "ext/date/lib/parse_date.c"
yy698:
YYDEBUG(698, *YYCURSOR);
yych = *++YYCURSOR;
@ -16531,7 +16534,7 @@ yy721:
}
yy722:
YYDEBUG(722, *YYCURSOR);
#line 1189 "ext/date/lib/parse_date.re"
#line 1192 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@ -16540,7 +16543,7 @@ yy722:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16544 "<stdout>"
#line 16547 "ext/date/lib/parse_date.c"
yy723:
YYDEBUG(723, *YYCURSOR);
yych = *++YYCURSOR;
@ -16850,7 +16853,7 @@ yy738:
if (yych <= '9') goto yy897;
yy739:
YYDEBUG(739, *YYCURSOR);
#line 1580 "ext/date/lib/parse_date.re"
#line 1583 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@ -16863,7 +16866,7 @@ yy739:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 16867 "<stdout>"
#line 16870 "ext/date/lib/parse_date.c"
yy740:
YYDEBUG(740, *YYCURSOR);
yyaccept = 15;
@ -16975,7 +16978,7 @@ yy751:
}
yy752:
YYDEBUG(752, *YYCURSOR);
#line 1525 "ext/date/lib/parse_date.re"
#line 1528 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@ -16988,7 +16991,7 @@ yy752:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 16992 "<stdout>"
#line 16995 "ext/date/lib/parse_date.c"
yy753:
YYDEBUG(753, *YYCURSOR);
yyaccept = 18;
@ -17237,7 +17240,7 @@ yy776:
}
yy777:
YYDEBUG(777, *YYCURSOR);
#line 1451 "ext/date/lib/parse_date.re"
#line 1454 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@ -17256,7 +17259,7 @@ yy777:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 17260 "<stdout>"
#line 17263 "ext/date/lib/parse_date.c"
yy778:
YYDEBUG(778, *YYCURSOR);
yyaccept = 19;
@ -18484,7 +18487,7 @@ yy848:
}
yy849:
YYDEBUG(849, *YYCURSOR);
#line 1928 "ext/date/lib/parse_date.re"
#line 1931 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@ -18513,7 +18516,7 @@ yy849:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 18517 "<stdout>"
#line 18520 "ext/date/lib/parse_date.c"
yy850:
YYDEBUG(850, *YYCURSOR);
yyaccept = 20;
@ -19557,7 +19560,7 @@ yy925:
}
yy926:
YYDEBUG(926, *YYCURSOR);
#line 1686 "ext/date/lib/parse_date.re"
#line 1689 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@ -19570,7 +19573,7 @@ yy926:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 19574 "<stdout>"
#line 19577 "ext/date/lib/parse_date.c"
yy927:
YYDEBUG(927, *YYCURSOR);
yyaccept = 21;
@ -19824,7 +19827,7 @@ yy941:
if (yych <= '7') goto yy1059;
yy942:
YYDEBUG(942, *YYCURSOR);
#line 1719 "ext/date/lib/parse_date.re"
#line 1722 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@ -19842,7 +19845,7 @@ yy942:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 19846 "<stdout>"
#line 19849 "ext/date/lib/parse_date.c"
yy943:
YYDEBUG(943, *YYCURSOR);
yych = *++YYCURSOR;
@ -20318,7 +20321,7 @@ yy981:
if (yych == 'e') goto yy1094;
yy982:
YYDEBUG(982, *YYCURSOR);
#line 1862 "ext/date/lib/parse_date.re"
#line 1865 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -20334,7 +20337,7 @@ yy982:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20338 "<stdout>"
#line 20341 "ext/date/lib/parse_date.c"
yy983:
YYDEBUG(983, *YYCURSOR);
yych = *++YYCURSOR;
@ -20681,7 +20684,7 @@ yy1020:
YYDEBUG(1020, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1021, *YYCURSOR);
#line 1568 "ext/date/lib/parse_date.re"
#line 1571 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@ -20692,7 +20695,7 @@ yy1020:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 20696 "<stdout>"
#line 20699 "ext/date/lib/parse_date.c"
yy1022:
YYDEBUG(1022, *YYCURSOR);
++YYCURSOR;
@ -20721,7 +20724,7 @@ yy1024:
}
yy1025:
YYDEBUG(1025, *YYCURSOR);
#line 1499 "ext/date/lib/parse_date.re"
#line 1502 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@ -20734,7 +20737,7 @@ yy1025:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 20738 "<stdout>"
#line 20741 "ext/date/lib/parse_date.c"
yy1026:
YYDEBUG(1026, *YYCURSOR);
yyaccept = 15;
@ -20954,7 +20957,7 @@ yy1042:
}
yy1043:
YYDEBUG(1043, *YYCURSOR);
#line 1487 "ext/date/lib/parse_date.re"
#line 1490 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@ -20965,7 +20968,7 @@ yy1043:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 20969 "<stdout>"
#line 20972 "ext/date/lib/parse_date.c"
yy1044:
YYDEBUG(1044, *YYCURSOR);
yyaccept = 26;
@ -21080,7 +21083,7 @@ yy1047:
}
yy1048:
YYDEBUG(1048, *YYCURSOR);
#line 1648 "ext/date/lib/parse_date.re"
#line 1651 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@ -21091,7 +21094,7 @@ yy1048:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 21095 "<stdout>"
#line 21098 "ext/date/lib/parse_date.c"
yy1049:
YYDEBUG(1049, *YYCURSOR);
yych = *++YYCURSOR;
@ -21161,7 +21164,7 @@ yy1059:
YYDEBUG(1059, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1060, *YYCURSOR);
#line 1700 "ext/date/lib/parse_date.re"
#line 1703 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@ -21179,7 +21182,7 @@ yy1059:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 21183 "<stdout>"
#line 21186 "ext/date/lib/parse_date.c"
yy1061:
YYDEBUG(1061, *YYCURSOR);
yych = *++YYCURSOR;
@ -21242,7 +21245,7 @@ yy1069:
if (yych <= '9') goto yy1143;
yy1070:
YYDEBUG(1070, *YYCURSOR);
#line 1738 "ext/date/lib/parse_date.re"
#line 1741 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@ -21255,7 +21258,7 @@ yy1070:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 21259 "<stdout>"
#line 21262 "ext/date/lib/parse_date.c"
yy1071:
YYDEBUG(1071, *YYCURSOR);
yych = *++YYCURSOR;
@ -21728,7 +21731,7 @@ yy1106:
++YYCURSOR;
yy1107:
YYDEBUG(1107, *YYCURSOR);
#line 1199 "ext/date/lib/parse_date.re"
#line 1202 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@ -21739,7 +21742,7 @@ yy1107:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21743 "<stdout>"
#line 21746 "ext/date/lib/parse_date.c"
yy1108:
YYDEBUG(1108, *YYCURSOR);
yyaccept = 28;
@ -22076,7 +22079,7 @@ yy1140:
YYDEBUG(1140, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1141, *YYCURSOR);
#line 1752 "ext/date/lib/parse_date.re"
#line 1755 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@ -22089,7 +22092,7 @@ yy1140:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 22093 "<stdout>"
#line 22096 "ext/date/lib/parse_date.c"
yy1142:
YYDEBUG(1142, *YYCURSOR);
++YYCURSOR;
@ -22133,7 +22136,7 @@ yy1144:
}
yy1145:
YYDEBUG(1145, *YYCURSOR);
#line 1294 "ext/date/lib/parse_date.re"
#line 1297 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@ -22155,7 +22158,7 @@ yy1145:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 22159 "<stdout>"
#line 22162 "ext/date/lib/parse_date.c"
yy1146:
YYDEBUG(1146, *YYCURSOR);
yyaccept = 29;
@ -22479,7 +22482,7 @@ yy1171:
}
yy1172:
YYDEBUG(1172, *YYCURSOR);
#line 1838 "ext/date/lib/parse_date.re"
#line 1841 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -22502,7 +22505,7 @@ yy1172:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22506 "<stdout>"
#line 22509 "ext/date/lib/parse_date.c"
yy1173:
YYDEBUG(1173, *YYCURSOR);
yych = *++YYCURSOR;
@ -22514,7 +22517,7 @@ yy1174:
++YYCURSOR;
yy1175:
YYDEBUG(1175, *YYCURSOR);
#line 1156 "ext/date/lib/parse_date.re"
#line 1159 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@ -22525,7 +22528,7 @@ yy1175:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22529 "<stdout>"
#line 22532 "ext/date/lib/parse_date.c"
yy1176:
YYDEBUG(1176, *YYCURSOR);
yyaccept = 31;
@ -23018,7 +23021,7 @@ yy1222:
YYDEBUG(1222, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1223, *YYCURSOR);
#line 1904 "ext/date/lib/parse_date.re"
#line 1907 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@ -23041,7 +23044,7 @@ yy1222:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 23045 "<stdout>"
#line 23048 "ext/date/lib/parse_date.c"
yy1224:
YYDEBUG(1224, *YYCURSOR);
yych = *++YYCURSOR;
@ -23543,7 +23546,7 @@ yy1268:
YYDEBUG(1268, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1269, *YYCURSOR);
#line 1317 "ext/date/lib/parse_date.re"
#line 1320 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -23564,7 +23567,7 @@ yy1268:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 23568 "<stdout>"
#line 23571 "ext/date/lib/parse_date.c"
yy1270:
YYDEBUG(1270, *YYCURSOR);
yyaccept = 24;
@ -23611,7 +23614,7 @@ yy1273:
YYDEBUG(1273, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1274, *YYCURSOR);
#line 1277 "ext/date/lib/parse_date.re"
#line 1280 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@ -23627,12 +23630,12 @@ yy1273:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 23631 "<stdout>"
#line 23634 "ext/date/lib/parse_date.c"
yy1275:
YYDEBUG(1275, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1276, *YYCURSOR);
#line 1513 "ext/date/lib/parse_date.re"
#line 1516 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601datex");
TIMELIB_INIT;
@ -23643,7 +23646,7 @@ yy1275:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 23647 "<stdout>"
#line 23650 "ext/date/lib/parse_date.c"
yy1277:
YYDEBUG(1277, *YYCURSOR);
yych = *++YYCURSOR;
@ -23746,7 +23749,7 @@ yy1290:
YYDEBUG(1290, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1291, *YYCURSOR);
#line 1357 "ext/date/lib/parse_date.re"
#line 1360 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@ -23765,7 +23768,7 @@ yy1290:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 23769 "<stdout>"
#line 23772 "ext/date/lib/parse_date.c"
yy1292:
YYDEBUG(1292, *YYCURSOR);
yych = *++YYCURSOR;
@ -24189,7 +24192,7 @@ yy1328:
if (yych <= '9') goto yy1331;
yy1329:
YYDEBUG(1329, *YYCURSOR);
#line 1660 "ext/date/lib/parse_date.re"
#line 1663 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@ -24214,7 +24217,7 @@ yy1329:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 24218 "<stdout>"
#line 24221 "ext/date/lib/parse_date.c"
yy1330:
YYDEBUG(1330, *YYCURSOR);
yych = *++YYCURSOR;
@ -24584,7 +24587,7 @@ yy1374:
if (yych <= ':') goto yy1383;
yy1375:
YYDEBUG(1375, *YYCURSOR);
#line 1766 "ext/date/lib/parse_date.re"
#line 1769 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@ -24607,7 +24610,7 @@ yy1375:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 24611 "<stdout>"
#line 24614 "ext/date/lib/parse_date.c"
yy1376:
YYDEBUG(1376, *YYCURSOR);
yyaccept = 33;
@ -24839,7 +24842,7 @@ yy1406:
if (yych == ':') goto yy1286;
goto yy1329;
}
#line 1994 "ext/date/lib/parse_date.re"
#line 1997 "ext/date/lib/parse_date.re"
}

5
ext/date/lib/parse_date.re

@ -939,10 +939,12 @@ timelib_long timelib_parse_zone(const char **ptr, int *dst, timelib_time *t, int
{
timelib_tzinfo *res;
timelib_long retval = 0;
size_t paren_count = 0;
*tz_not_found = 0;
while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
paren_count += **ptr == '(';
++*ptr;
}
if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' && ((*ptr)[3] == '+' || (*ptr)[3] == '-')) {
@ -991,8 +993,9 @@ timelib_long timelib_parse_zone(const char **ptr, int *dst, timelib_time *t, int
*tz_not_found = (found == 0);
retval = offset;
}
while (**ptr == ')') {
while (paren_count > 0 && **ptr == ')') {
++*ptr;
paren_count--;
}
return retval;
}

18
ext/date/lib/parse_iso_intervals.c

@ -1,4 +1,4 @@
/* Generated by re2c 1.0.3 on Wed Sep 11 17:29:40 2024 */
/* Generated by re2c 1.0.3 on Mon Sep 15 10:38:16 2025 */
#line 1 "ext/date/lib/parse_iso_intervals.re"
/*
* The MIT License (MIT)
@ -180,7 +180,7 @@ std:
#line 184 "<stdout>"
#line 184 "ext/date/lib/parse_iso_intervals.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@ -252,7 +252,7 @@ yy2:
s->pos = cursor; s->line++;
goto std;
}
#line 256 "<stdout>"
#line 256 "ext/date/lib/parse_iso_intervals.c"
yy4:
YYDEBUG(4, *YYCURSOR);
++YYCURSOR;
@ -263,7 +263,7 @@ yy5:
add_error(s, "Unexpected character");
goto std;
}
#line 267 "<stdout>"
#line 267 "ext/date/lib/parse_iso_intervals.c"
yy6:
YYDEBUG(6, *YYCURSOR);
++YYCURSOR;
@ -272,7 +272,7 @@ yy6:
{
goto std;
}
#line 276 "<stdout>"
#line 276 "ext/date/lib/parse_iso_intervals.c"
yy8:
YYDEBUG(8, *YYCURSOR);
yyaccept = 0;
@ -330,7 +330,7 @@ yy10:
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
#line 334 "<stdout>"
#line 334 "ext/date/lib/parse_iso_intervals.c"
yy11:
YYDEBUG(11, *YYCURSOR);
yych = *++YYCURSOR;
@ -399,7 +399,7 @@ yy16:
s->have_recurrences = 1;
return TIMELIB_PERIOD;
}
#line 403 "<stdout>"
#line 403 "ext/date/lib/parse_iso_intervals.c"
yy19:
YYDEBUG(19, *YYCURSOR);
yych = *++YYCURSOR;
@ -917,7 +917,7 @@ yy89:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 921 "<stdout>"
#line 921 "ext/date/lib/parse_iso_intervals.c"
yy91:
YYDEBUG(91, *YYCURSOR);
yych = *++YYCURSOR;
@ -956,7 +956,7 @@ yy91:
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
#line 960 "<stdout>"
#line 960 "ext/date/lib/parse_iso_intervals.c"
}
#line 321 "ext/date/lib/parse_iso_intervals.re"

8
ext/date/lib/timelib.h

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2024 Derick Rethans
* Copyright (c) 2015-2025 Derick Rethans
* Copyright (c) 2018,2021 MongoDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@ -30,9 +30,9 @@
# include "timelib_config.h"
#endif
#define TIMELIB_VERSION 202212
#define TIMELIB_EXTENDED_VERSION 20221201
#define TIMELIB_ASCII_VERSION "2022.12"
#define TIMELIB_VERSION 202214
#define TIMELIB_EXTENDED_VERSION 20221401
#define TIMELIB_ASCII_VERSION "2022.14"
#include <stdlib.h>
#include <stdbool.h>

Loading…
Cancel
Save