Merge branch 'PHP-8.3'

This commit is contained in:
Derick Rethans 2024-09-11 17:44:18 +01:00
commit 9698ad2fc0
No known key found for this signature in database
GPG Key ID: 910DEB46F53EA312
6 changed files with 575 additions and 521 deletions

View File

@ -1,4 +1,4 @@
/* Generated by re2c 1.0.3 on Thu Nov 23 16:02:28 2023 */
/* Generated by re2c 1.0.3 on Wed Sep 11 17:29:29 2024 */
#line 1 "ext/date/lib/parse_date.re"
/*
* The MIT License (MIT)
@ -549,22 +549,26 @@ static timelib_ull timelib_get_signed_nr(Scanner *s, const char **ptr, int max_l
timelib_sll tmp_nr = 0;
int len = 0;
str = timelib_calloc(1, max_length + 2); // for sign and \0
str_ptr = str;
/* Skip over non-numeric chars */
while (((**ptr < '0') || (**ptr > '9')) && (**ptr != '+') && (**ptr != '-')) {
if (**ptr == '\0') {
add_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Found unexpected data");
timelib_free(str);
return 0;
}
++*ptr;
}
/* Allocate string to feed to strtoll(): sign + length + '\0' */
str = timelib_calloc(1, max_length + 2);
str[0] = '+'; /* First position is the sign */
str_ptr = str + 1;
if ((**ptr == '+') || (**ptr == '-')) {
*str_ptr = **ptr;
while ((**ptr == '+') || (**ptr == '-')) {
if (**ptr == '-') {
str[0] = str[0] == '+' ? '-' : '+';
}
++*ptr;
++str_ptr;
}
while (((**ptr < '0') || (**ptr > '9'))) {
@ -715,7 +719,7 @@ static const timelib_relunit* timelib_lookup_relunit(const char **ptr)
static void add_with_overflow(Scanner *s, timelib_sll *e, timelib_sll amount, int multiplier)
{
#if defined(__has_builtin) && __has_builtin(__builtin_saddll_overflow)
#if TIMELIB_HAVE_BUILTIN_SADDLL_OVERFLOW
if (__builtin_saddll_overflow(*e, amount * multiplier, e)) {
add_error(s, TIMELIB_ERR_NUMBER_OUT_OF_RANGE, "Number out of range");
}
@ -1014,11 +1018,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 1147 "ext/date/lib/parse_date.re"
#line 1151 "ext/date/lib/parse_date.re"
#line 1022 "<stdout>"
#line 1026 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@ -1199,23 +1203,23 @@ yy2:
YYDEBUG(2, *YYCURSOR);
++YYCURSOR;
YYDEBUG(3, *YYCURSOR);
#line 1980 "ext/date/lib/parse_date.re"
#line 1984 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 1208 "<stdout>"
#line 1212 "<stdout>"
yy4:
YYDEBUG(4, *YYCURSOR);
++YYCURSOR;
yy5:
YYDEBUG(5, *YYCURSOR);
#line 1986 "ext/date/lib/parse_date.re"
#line 1990 "ext/date/lib/parse_date.re"
{
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
goto std;
}
#line 1219 "<stdout>"
#line 1223 "<stdout>"
yy6:
YYDEBUG(6, *YYCURSOR);
yyaccept = 0;
@ -1230,11 +1234,11 @@ yy6:
if (yych <= '9') goto yy58;
yy8:
YYDEBUG(8, *YYCURSOR);
#line 1975 "ext/date/lib/parse_date.re"
#line 1979 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 1238 "<stdout>"
#line 1242 "<stdout>"
yy9:
YYDEBUG(9, *YYCURSOR);
yych = *++YYCURSOR;
@ -1268,11 +1272,11 @@ yy11:
YYDEBUG(11, *YYCURSOR);
++YYCURSOR;
YYDEBUG(12, *YYCURSOR);
#line 1970 "ext/date/lib/parse_date.re"
#line 1974 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 1276 "<stdout>"
#line 1280 "<stdout>"
yy13:
YYDEBUG(13, *YYCURSOR);
yyaccept = 1;
@ -1773,7 +1777,7 @@ yy19:
}
yy20:
YYDEBUG(20, *YYCURSOR);
#line 1885 "ext/date/lib/parse_date.re"
#line 1889 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@ -1787,7 +1791,7 @@ yy20:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 1791 "<stdout>"
#line 1795 "<stdout>"
yy21:
YYDEBUG(21, *YYCURSOR);
yych = *++YYCURSOR;
@ -3592,7 +3596,7 @@ yy80:
}
yy81:
YYDEBUG(81, *YYCURSOR);
#line 1632 "ext/date/lib/parse_date.re"
#line 1636 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@ -3603,7 +3607,7 @@ yy81:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 3607 "<stdout>"
#line 3611 "<stdout>"
yy82:
YYDEBUG(82, *YYCURSOR);
yych = *++YYCURSOR;
@ -4118,7 +4122,7 @@ yy112:
}
if (yych == '.') goto yy289;
YYDEBUG(114, *YYCURSOR);
#line 1207 "ext/date/lib/parse_date.re"
#line 1211 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@ -4143,7 +4147,7 @@ yy112:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 4147 "<stdout>"
#line 4151 "<stdout>"
yy115:
YYDEBUG(115, *YYCURSOR);
++YYCURSOR;
@ -5869,7 +5873,7 @@ yy176:
}
yy177:
YYDEBUG(177, *YYCURSOR);
#line 1373 "ext/date/lib/parse_date.re"
#line 1377 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timetiny24 | timeshort24 | timelong24 | iso8601long");
@ -5896,7 +5900,7 @@ yy177:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 5900 "<stdout>"
#line 5904 "<stdout>"
yy178:
YYDEBUG(178, *YYCURSOR);
yyaccept = 4;
@ -6925,7 +6929,7 @@ yy223:
}
yy224:
YYDEBUG(224, *YYCURSOR);
#line 1467 "ext/date/lib/parse_date.re"
#line 1471 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@ -6940,7 +6944,7 @@ yy224:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 6944 "<stdout>"
#line 6948 "<stdout>"
yy225:
YYDEBUG(225, *YYCURSOR);
yyaccept = 5;
@ -7183,7 +7187,7 @@ yy250:
if (yych <= '9') goto yy431;
yy251:
YYDEBUG(251, *YYCURSOR);
#line 1549 "ext/date/lib/parse_date.re"
#line 1553 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@ -7197,7 +7201,7 @@ yy251:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 7201 "<stdout>"
#line 7205 "<stdout>"
yy252:
YYDEBUG(252, *YYCURSOR);
yyaccept = 3;
@ -7311,7 +7315,7 @@ yy259:
if (yych == 'e') goto yy440;
yy260:
YYDEBUG(260, *YYCURSOR);
#line 1954 "ext/date/lib/parse_date.re"
#line 1958 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@ -7326,7 +7330,7 @@ yy260:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 7330 "<stdout>"
#line 7334 "<stdout>"
yy261:
YYDEBUG(261, *YYCURSOR);
yych = *++YYCURSOR;
@ -7772,7 +7776,7 @@ yy289:
if (yych <= '9') goto yy471;
yy290:
YYDEBUG(290, *YYCURSOR);
#line 1233 "ext/date/lib/parse_date.re"
#line 1237 "ext/date/lib/parse_date.re"
{
timelib_sll i;
timelib_ull us;
@ -7811,7 +7815,7 @@ yy290:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 7815 "<stdout>"
#line 7819 "<stdout>"
yy291:
YYDEBUG(291, *YYCURSOR);
yych = *++YYCURSOR;
@ -7836,7 +7840,7 @@ yy292:
}
yy293:
YYDEBUG(293, *YYCURSOR);
#line 1795 "ext/date/lib/parse_date.re"
#line 1799 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@ -7856,7 +7860,7 @@ yy293:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 7860 "<stdout>"
#line 7864 "<stdout>"
yy294:
YYDEBUG(294, *YYCURSOR);
yyaccept = 7;
@ -7895,7 +7899,7 @@ yy294:
}
yy295:
YYDEBUG(295, *YYCURSOR);
#line 1875 "ext/date/lib/parse_date.re"
#line 1879 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@ -7904,7 +7908,7 @@ yy295:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 7908 "<stdout>"
#line 7912 "<stdout>"
yy296:
YYDEBUG(296, *YYCURSOR);
yyaccept = 7;
@ -8479,7 +8483,7 @@ yy314:
}
yy315:
YYDEBUG(315, *YYCURSOR);
#line 1816 "ext/date/lib/parse_date.re"
#line 1820 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@ -8496,7 +8500,7 @@ yy315:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 8500 "<stdout>"
#line 8504 "<stdout>"
yy316:
YYDEBUG(316, *YYCURSOR);
yych = *++YYCURSOR;
@ -8764,7 +8768,7 @@ yy324:
}
yy325:
YYDEBUG(325, *YYCURSOR);
#line 1618 "ext/date/lib/parse_date.re"
#line 1622 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@ -8777,7 +8781,7 @@ yy325:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 8781 "<stdout>"
#line 8785 "<stdout>"
yy326:
YYDEBUG(326, *YYCURSOR);
yyaccept = 10;
@ -9471,7 +9475,7 @@ yy350:
}
yy351:
YYDEBUG(351, *YYCURSOR);
#line 1164 "ext/date/lib/parse_date.re"
#line 1168 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@ -9479,7 +9483,7 @@ yy351:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 9483 "<stdout>"
#line 9487 "<stdout>"
yy352:
YYDEBUG(352, *YYCURSOR);
yyaccept = 2;
@ -10982,7 +10986,7 @@ yy419:
}
yy420:
YYDEBUG(420, *YYCURSOR);
#line 1401 "ext/date/lib/parse_date.re"
#line 1405 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@ -11004,7 +11008,7 @@ yy420:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 11008 "<stdout>"
#line 11012 "<stdout>"
yy421:
YYDEBUG(421, *YYCURSOR);
yyaccept = 13;
@ -11085,7 +11089,7 @@ yy421:
}
yy422:
YYDEBUG(422, *YYCURSOR);
#line 1786 "ext/date/lib/parse_date.re"
#line 1790 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@ -11093,7 +11097,7 @@ yy422:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 11097 "<stdout>"
#line 11101 "<stdout>"
yy423:
YYDEBUG(423, *YYCURSOR);
yyaccept = 3;
@ -11700,7 +11704,7 @@ yy456:
YYDEBUG(456, *YYCURSOR);
++YYCURSOR;
YYDEBUG(457, *YYCURSOR);
#line 1335 "ext/date/lib/parse_date.re"
#line 1339 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@ -11717,7 +11721,7 @@ yy456:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 11721 "<stdout>"
#line 11725 "<stdout>"
yy458:
YYDEBUG(458, *YYCURSOR);
yych = *++YYCURSOR;
@ -13044,7 +13048,7 @@ yy525:
}
yy526:
YYDEBUG(526, *YYCURSOR);
#line 1173 "ext/date/lib/parse_date.re"
#line 1177 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@ -13055,7 +13059,7 @@ yy526:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 13059 "<stdout>"
#line 13063 "<stdout>"
yy527:
YYDEBUG(527, *YYCURSOR);
yyaccept = 2;
@ -14101,7 +14105,7 @@ yy566:
}
yy567:
YYDEBUG(567, *YYCURSOR);
#line 1535 "ext/date/lib/parse_date.re"
#line 1539 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@ -14114,7 +14118,7 @@ yy567:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14118 "<stdout>"
#line 14122 "<stdout>"
yy568:
YYDEBUG(568, *YYCURSOR);
yyaccept = 15;
@ -14565,7 +14569,7 @@ yy599:
}
yy600:
YYDEBUG(600, *YYCURSOR);
#line 1604 "ext/date/lib/parse_date.re"
#line 1608 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@ -14578,7 +14582,7 @@ yy600:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 14582 "<stdout>"
#line 14586 "<stdout>"
yy601:
YYDEBUG(601, *YYCURSOR);
yych = *++YYCURSOR;
@ -15953,7 +15957,7 @@ yy696:
YYDEBUG(696, *YYCURSOR);
++YYCURSOR;
YYDEBUG(697, *YYCURSOR);
#line 1590 "ext/date/lib/parse_date.re"
#line 1594 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@ -15966,7 +15970,7 @@ yy696:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 15970 "<stdout>"
#line 15974 "<stdout>"
yy698:
YYDEBUG(698, *YYCURSOR);
yych = *++YYCURSOR;
@ -16527,7 +16531,7 @@ yy721:
}
yy722:
YYDEBUG(722, *YYCURSOR);
#line 1185 "ext/date/lib/parse_date.re"
#line 1189 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@ -16536,7 +16540,7 @@ yy722:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16540 "<stdout>"
#line 16544 "<stdout>"
yy723:
YYDEBUG(723, *YYCURSOR);
yych = *++YYCURSOR;
@ -16846,7 +16850,7 @@ yy738:
if (yych <= '9') goto yy897;
yy739:
YYDEBUG(739, *YYCURSOR);
#line 1576 "ext/date/lib/parse_date.re"
#line 1580 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@ -16859,7 +16863,7 @@ yy739:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 16863 "<stdout>"
#line 16867 "<stdout>"
yy740:
YYDEBUG(740, *YYCURSOR);
yyaccept = 15;
@ -16971,7 +16975,7 @@ yy751:
}
yy752:
YYDEBUG(752, *YYCURSOR);
#line 1521 "ext/date/lib/parse_date.re"
#line 1525 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@ -16984,7 +16988,7 @@ yy752:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 16988 "<stdout>"
#line 16992 "<stdout>"
yy753:
YYDEBUG(753, *YYCURSOR);
yyaccept = 18;
@ -17233,7 +17237,7 @@ yy776:
}
yy777:
YYDEBUG(777, *YYCURSOR);
#line 1447 "ext/date/lib/parse_date.re"
#line 1451 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@ -17252,7 +17256,7 @@ yy777:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 17256 "<stdout>"
#line 17260 "<stdout>"
yy778:
YYDEBUG(778, *YYCURSOR);
yyaccept = 19;
@ -18480,7 +18484,7 @@ yy848:
}
yy849:
YYDEBUG(849, *YYCURSOR);
#line 1924 "ext/date/lib/parse_date.re"
#line 1928 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@ -18509,7 +18513,7 @@ yy849:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 18513 "<stdout>"
#line 18517 "<stdout>"
yy850:
YYDEBUG(850, *YYCURSOR);
yyaccept = 20;
@ -19553,7 +19557,7 @@ yy925:
}
yy926:
YYDEBUG(926, *YYCURSOR);
#line 1682 "ext/date/lib/parse_date.re"
#line 1686 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@ -19566,7 +19570,7 @@ yy926:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 19570 "<stdout>"
#line 19574 "<stdout>"
yy927:
YYDEBUG(927, *YYCURSOR);
yyaccept = 21;
@ -19820,7 +19824,7 @@ yy941:
if (yych <= '7') goto yy1059;
yy942:
YYDEBUG(942, *YYCURSOR);
#line 1715 "ext/date/lib/parse_date.re"
#line 1719 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@ -19838,7 +19842,7 @@ yy942:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 19842 "<stdout>"
#line 19846 "<stdout>"
yy943:
YYDEBUG(943, *YYCURSOR);
yych = *++YYCURSOR;
@ -20314,7 +20318,7 @@ yy981:
if (yych == 'e') goto yy1094;
yy982:
YYDEBUG(982, *YYCURSOR);
#line 1858 "ext/date/lib/parse_date.re"
#line 1862 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -20330,7 +20334,7 @@ yy982:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20334 "<stdout>"
#line 20338 "<stdout>"
yy983:
YYDEBUG(983, *YYCURSOR);
yych = *++YYCURSOR;
@ -20677,7 +20681,7 @@ yy1020:
YYDEBUG(1020, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1021, *YYCURSOR);
#line 1564 "ext/date/lib/parse_date.re"
#line 1568 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@ -20688,7 +20692,7 @@ yy1020:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 20692 "<stdout>"
#line 20696 "<stdout>"
yy1022:
YYDEBUG(1022, *YYCURSOR);
++YYCURSOR;
@ -20717,7 +20721,7 @@ yy1024:
}
yy1025:
YYDEBUG(1025, *YYCURSOR);
#line 1495 "ext/date/lib/parse_date.re"
#line 1499 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@ -20730,7 +20734,7 @@ yy1025:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 20734 "<stdout>"
#line 20738 "<stdout>"
yy1026:
YYDEBUG(1026, *YYCURSOR);
yyaccept = 15;
@ -20950,7 +20954,7 @@ yy1042:
}
yy1043:
YYDEBUG(1043, *YYCURSOR);
#line 1483 "ext/date/lib/parse_date.re"
#line 1487 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@ -20961,7 +20965,7 @@ yy1043:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 20965 "<stdout>"
#line 20969 "<stdout>"
yy1044:
YYDEBUG(1044, *YYCURSOR);
yyaccept = 26;
@ -21076,7 +21080,7 @@ yy1047:
}
yy1048:
YYDEBUG(1048, *YYCURSOR);
#line 1644 "ext/date/lib/parse_date.re"
#line 1648 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@ -21087,7 +21091,7 @@ yy1048:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 21091 "<stdout>"
#line 21095 "<stdout>"
yy1049:
YYDEBUG(1049, *YYCURSOR);
yych = *++YYCURSOR;
@ -21157,7 +21161,7 @@ yy1059:
YYDEBUG(1059, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1060, *YYCURSOR);
#line 1696 "ext/date/lib/parse_date.re"
#line 1700 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@ -21175,7 +21179,7 @@ yy1059:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 21179 "<stdout>"
#line 21183 "<stdout>"
yy1061:
YYDEBUG(1061, *YYCURSOR);
yych = *++YYCURSOR;
@ -21238,7 +21242,7 @@ yy1069:
if (yych <= '9') goto yy1143;
yy1070:
YYDEBUG(1070, *YYCURSOR);
#line 1734 "ext/date/lib/parse_date.re"
#line 1738 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@ -21251,7 +21255,7 @@ yy1070:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 21255 "<stdout>"
#line 21259 "<stdout>"
yy1071:
YYDEBUG(1071, *YYCURSOR);
yych = *++YYCURSOR;
@ -21724,7 +21728,7 @@ yy1106:
++YYCURSOR;
yy1107:
YYDEBUG(1107, *YYCURSOR);
#line 1195 "ext/date/lib/parse_date.re"
#line 1199 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@ -21735,7 +21739,7 @@ yy1107:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21739 "<stdout>"
#line 21743 "<stdout>"
yy1108:
YYDEBUG(1108, *YYCURSOR);
yyaccept = 28;
@ -22072,7 +22076,7 @@ yy1140:
YYDEBUG(1140, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1141, *YYCURSOR);
#line 1748 "ext/date/lib/parse_date.re"
#line 1752 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@ -22085,7 +22089,7 @@ yy1140:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 22089 "<stdout>"
#line 22093 "<stdout>"
yy1142:
YYDEBUG(1142, *YYCURSOR);
++YYCURSOR;
@ -22129,7 +22133,7 @@ yy1144:
}
yy1145:
YYDEBUG(1145, *YYCURSOR);
#line 1290 "ext/date/lib/parse_date.re"
#line 1294 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@ -22151,7 +22155,7 @@ yy1145:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 22155 "<stdout>"
#line 22159 "<stdout>"
yy1146:
YYDEBUG(1146, *YYCURSOR);
yyaccept = 29;
@ -22475,7 +22479,7 @@ yy1171:
}
yy1172:
YYDEBUG(1172, *YYCURSOR);
#line 1834 "ext/date/lib/parse_date.re"
#line 1838 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -22498,7 +22502,7 @@ yy1172:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22502 "<stdout>"
#line 22506 "<stdout>"
yy1173:
YYDEBUG(1173, *YYCURSOR);
yych = *++YYCURSOR;
@ -22510,7 +22514,7 @@ yy1174:
++YYCURSOR;
yy1175:
YYDEBUG(1175, *YYCURSOR);
#line 1152 "ext/date/lib/parse_date.re"
#line 1156 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@ -22521,7 +22525,7 @@ yy1175:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22525 "<stdout>"
#line 22529 "<stdout>"
yy1176:
YYDEBUG(1176, *YYCURSOR);
yyaccept = 31;
@ -23014,7 +23018,7 @@ yy1222:
YYDEBUG(1222, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1223, *YYCURSOR);
#line 1900 "ext/date/lib/parse_date.re"
#line 1904 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@ -23037,7 +23041,7 @@ yy1222:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 23041 "<stdout>"
#line 23045 "<stdout>"
yy1224:
YYDEBUG(1224, *YYCURSOR);
yych = *++YYCURSOR;
@ -23539,7 +23543,7 @@ yy1268:
YYDEBUG(1268, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1269, *YYCURSOR);
#line 1313 "ext/date/lib/parse_date.re"
#line 1317 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -23560,7 +23564,7 @@ yy1268:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 23564 "<stdout>"
#line 23568 "<stdout>"
yy1270:
YYDEBUG(1270, *YYCURSOR);
yyaccept = 24;
@ -23607,7 +23611,7 @@ yy1273:
YYDEBUG(1273, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1274, *YYCURSOR);
#line 1273 "ext/date/lib/parse_date.re"
#line 1277 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@ -23623,12 +23627,12 @@ yy1273:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 23627 "<stdout>"
#line 23631 "<stdout>"
yy1275:
YYDEBUG(1275, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1276, *YYCURSOR);
#line 1509 "ext/date/lib/parse_date.re"
#line 1513 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601datex");
TIMELIB_INIT;
@ -23639,7 +23643,7 @@ yy1275:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 23643 "<stdout>"
#line 23647 "<stdout>"
yy1277:
YYDEBUG(1277, *YYCURSOR);
yych = *++YYCURSOR;
@ -23742,7 +23746,7 @@ yy1290:
YYDEBUG(1290, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1291, *YYCURSOR);
#line 1353 "ext/date/lib/parse_date.re"
#line 1357 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@ -23761,7 +23765,7 @@ yy1290:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 23765 "<stdout>"
#line 23769 "<stdout>"
yy1292:
YYDEBUG(1292, *YYCURSOR);
yych = *++YYCURSOR;
@ -24185,7 +24189,7 @@ yy1328:
if (yych <= '9') goto yy1331;
yy1329:
YYDEBUG(1329, *YYCURSOR);
#line 1656 "ext/date/lib/parse_date.re"
#line 1660 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@ -24210,7 +24214,7 @@ yy1329:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 24214 "<stdout>"
#line 24218 "<stdout>"
yy1330:
YYDEBUG(1330, *YYCURSOR);
yych = *++YYCURSOR;
@ -24580,7 +24584,7 @@ yy1374:
if (yych <= ':') goto yy1383;
yy1375:
YYDEBUG(1375, *YYCURSOR);
#line 1762 "ext/date/lib/parse_date.re"
#line 1766 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@ -24603,7 +24607,7 @@ yy1375:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 24607 "<stdout>"
#line 24611 "<stdout>"
yy1376:
YYDEBUG(1376, *YYCURSOR);
yyaccept = 33;
@ -24835,7 +24839,7 @@ yy1406:
if (yych == ':') goto yy1286;
goto yy1329;
}
#line 1990 "ext/date/lib/parse_date.re"
#line 1994 "ext/date/lib/parse_date.re"
}

View File

@ -547,22 +547,26 @@ static timelib_ull timelib_get_signed_nr(Scanner *s, const char **ptr, int max_l
timelib_sll tmp_nr = 0;
int len = 0;
str = timelib_calloc(1, max_length + 2); // for sign and \0
str_ptr = str;
/* Skip over non-numeric chars */
while (((**ptr < '0') || (**ptr > '9')) && (**ptr != '+') && (**ptr != '-')) {
if (**ptr == '\0') {
add_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Found unexpected data");
timelib_free(str);
return 0;
}
++*ptr;
}
/* Allocate string to feed to strtoll(): sign + length + '\0' */
str = timelib_calloc(1, max_length + 2);
str[0] = '+'; /* First position is the sign */
str_ptr = str + 1;
if ((**ptr == '+') || (**ptr == '-')) {
*str_ptr = **ptr;
while ((**ptr == '+') || (**ptr == '-')) {
if (**ptr == '-') {
str[0] = str[0] == '+' ? '-' : '+';
}
++*ptr;
++str_ptr;
}
while (((**ptr < '0') || (**ptr > '9'))) {
@ -713,7 +717,7 @@ static const timelib_relunit* timelib_lookup_relunit(const char **ptr)
static void add_with_overflow(Scanner *s, timelib_sll *e, timelib_sll amount, int multiplier)
{
#if defined(__has_builtin) && __has_builtin(__builtin_saddll_overflow)
#if TIMELIB_HAVE_BUILTIN_SADDLL_OVERFLOW
if (__builtin_saddll_overflow(*e, amount * multiplier, e)) {
add_error(s, TIMELIB_ERR_NUMBER_OUT_OF_RANGE, "Number out of range");
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Derick Rethans
* Copyright (c) 2015-2024 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 202210
#define TIMELIB_EXTENDED_VERSION 20221001
#define TIMELIB_ASCII_VERSION "2022.10"
#define TIMELIB_VERSION 202212
#define TIMELIB_EXTENDED_VERSION 20221201
#define TIMELIB_ASCII_VERSION "2022.12"
#include <stdlib.h>
#include <stdbool.h>

View File

@ -126,6 +126,15 @@
# define TIMELIB_BREAK_INTENTIONALLY_MISSING
#endif
#if defined(__has_builtin)
# if __has_builtin(__builtin_saddll_overflow)
# define TIMELIB_HAVE_BUILTIN_SADDLL_OVERFLOW 1
# endif
#endif
#ifndef TIMELIB_HAVE_BUILTIN_SADDLL_OVERFLOW
# define TIMELIB_HAVE_BUILTIN_SADDLL_OVERFLOW 0
#endif
struct _ttinfo
{
int32_t offset;

View File

@ -28,6 +28,6 @@ echo $result . "\n";
?>
--EXPECT--
2000-01-01 13:00:00
2000-01-01 13:00:00
2000-01-01 11:00:00
2000-01-01 13:00:00
2000-01-01 13:00:00