Commit 2270f786022 for php
commit 2270f786022bf4b4563d6560ec9e8b6aac7ed5c2
Author: Derick Rethans <github@derickrethans.nl>
Date: Thu Nov 5 15:35:24 2026 +0000
Upgrade timelib to 2026.03
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index 41566f94ed6..f317d4aa898 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -1,9 +1,9 @@
-/* Generated by re2c 1.0.3 on Thu Oct 1 17:09:49 2026 */
+/* Generated by re2c 1.0.3 on Thu Nov 5 15:34:09 2026 */
#line 1 "ext/date/lib/parse_date.re"
/*
* The MIT License (MIT)
*
- * Copyright (c) 2015-2023 Derick Rethans
+ * Copyright (c) 2015-2026 Derick Rethans
* Copyright (c) 2018 MongoDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -68,7 +68,11 @@
#define TIMELIB_RELATIVE 310
#define TIMELIB_ERROR 999
-#define TIMELIB_MAX_ERRORS 1000
+#define TIMELIB_MAX_ERRORS 16
+#define TIMELIB_MAX_ERRORS_S "16"
+
+#define TIMELIB_WARN_TOO_MANY_WARNINGS_S "There are more than " TIMELIB_MAX_ERRORS_S " warnings, which are not returned"
+#define TIMELIB_ERR_TOO_MANY_ERRORS_S "There are more than " TIMELIB_MAX_ERRORS_S " errors, which are not returned"
/* Some compilers like AIX, defines uchar in sys/types.h */
#undef uchar
@@ -363,12 +367,20 @@ static timelib_error_message *alloc_error_message(timelib_error_message **messag
static void add_warning(Scanner *s, int error_code, const char *error)
{
+ timelib_error_message *message;
+
+ if (s->errors->warning_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
+ message->error_code = TIMELIB_WARN_TOO_MANY_WARNINGS;
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_WARN_TOO_MANY_WARNINGS_S);
+ }
if (s->errors->warning_count >= TIMELIB_MAX_ERRORS) {
return;
}
- timelib_error_message *message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
-
+ message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
message->error_code = error_code;
message->position = s->tok ? s->tok - s->str : 0;
message->character = s->tok ? *s->tok : 0;
@@ -377,12 +389,20 @@ static void add_warning(Scanner *s, int error_code, const char *error)
static void add_error(Scanner *s, int error_code, const char *error)
{
+ timelib_error_message *message;
+
+ if (s->errors->error_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
+ message->error_code = TIMELIB_ERR_TOO_MANY_ERRORS;
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_ERR_TOO_MANY_ERRORS_S);
+ }
if (s->errors->error_count >= TIMELIB_MAX_ERRORS) {
return;
}
- timelib_error_message *message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
-
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
message->error_code = error_code;
message->position = s->tok ? s->tok - s->str : 0;
message->character = s->tok ? *s->tok : 0;
@@ -391,12 +411,20 @@ static void add_error(Scanner *s, int error_code, const char *error)
static void add_pbf_warning(Scanner *s, int error_code, const char *error, const char *sptr, const char *cptr)
{
+ timelib_error_message *message;
+
+ if (s->errors->warning_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
+ message->error_code = TIMELIB_WARN_TOO_MANY_WARNINGS;
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_WARN_TOO_MANY_WARNINGS_S);
+ }
if (s->errors->warning_count >= TIMELIB_MAX_ERRORS) {
return;
}
- timelib_error_message *message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
-
+ message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
message->error_code = error_code;
message->position = cptr - sptr;
message->character = *cptr;
@@ -405,12 +433,20 @@ static void add_pbf_warning(Scanner *s, int error_code, const char *error, const
static void add_pbf_error(Scanner *s, int error_code, const char *error, const char *sptr, const char *cptr)
{
+ timelib_error_message *message;
+
+ if (s->errors->error_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
+ message->error_code = TIMELIB_ERR_TOO_MANY_ERRORS;
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_ERR_TOO_MANY_ERRORS_S);
+ }
if (s->errors->error_count >= TIMELIB_MAX_ERRORS) {
return;
}
- timelib_error_message *message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
-
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
message->error_code = error_code;
message->position = cptr - sptr;
message->character = *cptr;
@@ -1035,11 +1071,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
-#line 1168 "ext/date/lib/parse_date.re"
+#line 1204 "ext/date/lib/parse_date.re"
-#line 1043 "ext/date/lib/parse_date.c"
+#line 1079 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -1220,23 +1256,23 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(2, *YYCURSOR);
++YYCURSOR;
YYDEBUG(3, *YYCURSOR);
-#line 2001 "ext/date/lib/parse_date.re"
+#line 2037 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
-#line 1229 "ext/date/lib/parse_date.c"
+#line 1265 "ext/date/lib/parse_date.c"
yy4:
YYDEBUG(4, *YYCURSOR);
++YYCURSOR;
yy5:
YYDEBUG(5, *YYCURSOR);
-#line 2007 "ext/date/lib/parse_date.re"
+#line 2043 "ext/date/lib/parse_date.re"
{
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
goto std;
}
-#line 1240 "ext/date/lib/parse_date.c"
+#line 1276 "ext/date/lib/parse_date.c"
yy6:
YYDEBUG(6, *YYCURSOR);
yyaccept = 0;
@@ -1251,11 +1287,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych <= '9') goto yy58;
yy8:
YYDEBUG(8, *YYCURSOR);
-#line 1996 "ext/date/lib/parse_date.re"
+#line 2032 "ext/date/lib/parse_date.re"
{
goto std;
}
-#line 1259 "ext/date/lib/parse_date.c"
+#line 1295 "ext/date/lib/parse_date.c"
yy9:
YYDEBUG(9, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1289,11 +1325,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(11, *YYCURSOR);
++YYCURSOR;
YYDEBUG(12, *YYCURSOR);
-#line 1991 "ext/date/lib/parse_date.re"
+#line 2027 "ext/date/lib/parse_date.re"
{
goto std;
}
-#line 1297 "ext/date/lib/parse_date.c"
+#line 1333 "ext/date/lib/parse_date.c"
yy13:
YYDEBUG(13, *YYCURSOR);
yyaccept = 1;
@@ -1794,7 +1830,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy20:
YYDEBUG(20, *YYCURSOR);
-#line 1906 "ext/date/lib/parse_date.re"
+#line 1942 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1808,7 +1844,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
-#line 1812 "ext/date/lib/parse_date.c"
+#line 1848 "ext/date/lib/parse_date.c"
yy21:
YYDEBUG(21, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3613,7 +3649,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy81:
YYDEBUG(81, *YYCURSOR);
-#line 1653 "ext/date/lib/parse_date.re"
+#line 1689 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -3624,7 +3660,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 3628 "ext/date/lib/parse_date.c"
+#line 3664 "ext/date/lib/parse_date.c"
yy82:
YYDEBUG(82, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4139,7 +4175,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
if (yych == '.') goto yy289;
YYDEBUG(114, *YYCURSOR);
-#line 1228 "ext/date/lib/parse_date.re"
+#line 1264 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -4164,7 +4200,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 4168 "ext/date/lib/parse_date.c"
+#line 4204 "ext/date/lib/parse_date.c"
yy115:
YYDEBUG(115, *YYCURSOR);
++YYCURSOR;
@@ -5890,7 +5926,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy177:
YYDEBUG(177, *YYCURSOR);
-#line 1394 "ext/date/lib/parse_date.re"
+#line 1430 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timetiny24 | timeshort24 | timelong24 | iso8601long");
@@ -5917,7 +5953,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 5921 "ext/date/lib/parse_date.c"
+#line 5957 "ext/date/lib/parse_date.c"
yy178:
YYDEBUG(178, *YYCURSOR);
yyaccept = 4;
@@ -6946,7 +6982,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy224:
YYDEBUG(224, *YYCURSOR);
-#line 1488 "ext/date/lib/parse_date.re"
+#line 1524 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -6961,7 +6997,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
-#line 6965 "ext/date/lib/parse_date.c"
+#line 7001 "ext/date/lib/parse_date.c"
yy225:
YYDEBUG(225, *YYCURSOR);
yyaccept = 5;
@@ -7204,7 +7240,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych <= '9') goto yy431;
yy251:
YYDEBUG(251, *YYCURSOR);
-#line 1570 "ext/date/lib/parse_date.re"
+#line 1606 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -7218,7 +7254,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
-#line 7222 "ext/date/lib/parse_date.c"
+#line 7258 "ext/date/lib/parse_date.c"
yy252:
YYDEBUG(252, *YYCURSOR);
yyaccept = 3;
@@ -7332,7 +7368,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych == 'e') goto yy440;
yy260:
YYDEBUG(260, *YYCURSOR);
-#line 1975 "ext/date/lib/parse_date.re"
+#line 2011 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -7347,7 +7383,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 7351 "ext/date/lib/parse_date.c"
+#line 7387 "ext/date/lib/parse_date.c"
yy261:
YYDEBUG(261, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7793,7 +7829,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych <= '9') goto yy471;
yy290:
YYDEBUG(290, *YYCURSOR);
-#line 1254 "ext/date/lib/parse_date.re"
+#line 1290 "ext/date/lib/parse_date.re"
{
timelib_sll i;
timelib_ull us;
@@ -7832,7 +7868,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 7836 "ext/date/lib/parse_date.c"
+#line 7872 "ext/date/lib/parse_date.c"
yy291:
YYDEBUG(291, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7857,7 +7893,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy293:
YYDEBUG(293, *YYCURSOR);
-#line 1816 "ext/date/lib/parse_date.re"
+#line 1852 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -7877,7 +7913,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
-#line 7881 "ext/date/lib/parse_date.c"
+#line 7917 "ext/date/lib/parse_date.c"
yy294:
YYDEBUG(294, *YYCURSOR);
yyaccept = 7;
@@ -7916,7 +7952,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy295:
YYDEBUG(295, *YYCURSOR);
-#line 1896 "ext/date/lib/parse_date.re"
+#line 1932 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -7925,7 +7961,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 7929 "ext/date/lib/parse_date.c"
+#line 7965 "ext/date/lib/parse_date.c"
yy296:
YYDEBUG(296, *YYCURSOR);
yyaccept = 7;
@@ -8500,7 +8536,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy315:
YYDEBUG(315, *YYCURSOR);
-#line 1837 "ext/date/lib/parse_date.re"
+#line 1873 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -8517,7 +8553,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
-#line 8521 "ext/date/lib/parse_date.c"
+#line 8557 "ext/date/lib/parse_date.c"
yy316:
YYDEBUG(316, *YYCURSOR);
yych = *++YYCURSOR;
@@ -8785,7 +8821,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy325:
YYDEBUG(325, *YYCURSOR);
-#line 1639 "ext/date/lib/parse_date.re"
+#line 1675 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -8798,7 +8834,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 8802 "ext/date/lib/parse_date.c"
+#line 8838 "ext/date/lib/parse_date.c"
yy326:
YYDEBUG(326, *YYCURSOR);
yyaccept = 10;
@@ -9492,7 +9528,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy351:
YYDEBUG(351, *YYCURSOR);
-#line 1185 "ext/date/lib/parse_date.re"
+#line 1221 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -9500,7 +9536,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 9504 "ext/date/lib/parse_date.c"
+#line 9540 "ext/date/lib/parse_date.c"
yy352:
YYDEBUG(352, *YYCURSOR);
yyaccept = 2;
@@ -11003,7 +11039,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy420:
YYDEBUG(420, *YYCURSOR);
-#line 1422 "ext/date/lib/parse_date.re"
+#line 1458 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -11025,7 +11061,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
-#line 11029 "ext/date/lib/parse_date.c"
+#line 11065 "ext/date/lib/parse_date.c"
yy421:
YYDEBUG(421, *YYCURSOR);
yyaccept = 13;
@@ -11106,7 +11142,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy422:
YYDEBUG(422, *YYCURSOR);
-#line 1807 "ext/date/lib/parse_date.re"
+#line 1843 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -11114,7 +11150,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 11118 "ext/date/lib/parse_date.c"
+#line 11154 "ext/date/lib/parse_date.c"
yy423:
YYDEBUG(423, *YYCURSOR);
yyaccept = 3;
@@ -11721,7 +11757,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(456, *YYCURSOR);
++YYCURSOR;
YYDEBUG(457, *YYCURSOR);
-#line 1356 "ext/date/lib/parse_date.re"
+#line 1392 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -11738,7 +11774,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
-#line 11742 "ext/date/lib/parse_date.c"
+#line 11778 "ext/date/lib/parse_date.c"
yy458:
YYDEBUG(458, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13065,7 +13101,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy526:
YYDEBUG(526, *YYCURSOR);
-#line 1194 "ext/date/lib/parse_date.re"
+#line 1230 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -13076,7 +13112,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 13080 "ext/date/lib/parse_date.c"
+#line 13116 "ext/date/lib/parse_date.c"
yy527:
YYDEBUG(527, *YYCURSOR);
yyaccept = 2;
@@ -14122,7 +14158,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy567:
YYDEBUG(567, *YYCURSOR);
-#line 1556 "ext/date/lib/parse_date.re"
+#line 1592 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -14135,7 +14171,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 14139 "ext/date/lib/parse_date.c"
+#line 14175 "ext/date/lib/parse_date.c"
yy568:
YYDEBUG(568, *YYCURSOR);
yyaccept = 15;
@@ -14586,7 +14622,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy600:
YYDEBUG(600, *YYCURSOR);
-#line 1625 "ext/date/lib/parse_date.re"
+#line 1661 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -14599,7 +14635,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 14603 "ext/date/lib/parse_date.c"
+#line 14639 "ext/date/lib/parse_date.c"
yy601:
YYDEBUG(601, *YYCURSOR);
yych = *++YYCURSOR;
@@ -15974,7 +16010,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(696, *YYCURSOR);
++YYCURSOR;
YYDEBUG(697, *YYCURSOR);
-#line 1611 "ext/date/lib/parse_date.re"
+#line 1647 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -15987,7 +16023,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 15991 "ext/date/lib/parse_date.c"
+#line 16027 "ext/date/lib/parse_date.c"
yy698:
YYDEBUG(698, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16548,7 +16584,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy722:
YYDEBUG(722, *YYCURSOR);
-#line 1206 "ext/date/lib/parse_date.re"
+#line 1242 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -16557,7 +16593,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 16561 "ext/date/lib/parse_date.c"
+#line 16597 "ext/date/lib/parse_date.c"
yy723:
YYDEBUG(723, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16867,7 +16903,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych <= '9') goto yy897;
yy739:
YYDEBUG(739, *YYCURSOR);
-#line 1597 "ext/date/lib/parse_date.re"
+#line 1633 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -16880,7 +16916,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 16884 "ext/date/lib/parse_date.c"
+#line 16920 "ext/date/lib/parse_date.c"
yy740:
YYDEBUG(740, *YYCURSOR);
yyaccept = 15;
@@ -16992,7 +17028,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy752:
YYDEBUG(752, *YYCURSOR);
-#line 1542 "ext/date/lib/parse_date.re"
+#line 1578 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -17005,7 +17041,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 17009 "ext/date/lib/parse_date.c"
+#line 17045 "ext/date/lib/parse_date.c"
yy753:
YYDEBUG(753, *YYCURSOR);
yyaccept = 18;
@@ -17254,7 +17290,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy777:
YYDEBUG(777, *YYCURSOR);
-#line 1468 "ext/date/lib/parse_date.re"
+#line 1504 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -17273,7 +17309,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
-#line 17277 "ext/date/lib/parse_date.c"
+#line 17313 "ext/date/lib/parse_date.c"
yy778:
YYDEBUG(778, *YYCURSOR);
yyaccept = 19;
@@ -18501,7 +18537,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy849:
YYDEBUG(849, *YYCURSOR);
-#line 1945 "ext/date/lib/parse_date.re"
+#line 1981 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -18530,7 +18566,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 18534 "ext/date/lib/parse_date.c"
+#line 18570 "ext/date/lib/parse_date.c"
yy850:
YYDEBUG(850, *YYCURSOR);
yyaccept = 20;
@@ -19574,7 +19610,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy926:
YYDEBUG(926, *YYCURSOR);
-#line 1703 "ext/date/lib/parse_date.re"
+#line 1739 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -19587,7 +19623,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
-#line 19591 "ext/date/lib/parse_date.c"
+#line 19627 "ext/date/lib/parse_date.c"
yy927:
YYDEBUG(927, *YYCURSOR);
yyaccept = 21;
@@ -19841,7 +19877,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych <= '7') goto yy1059;
yy942:
YYDEBUG(942, *YYCURSOR);
-#line 1736 "ext/date/lib/parse_date.re"
+#line 1772 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -19859,7 +19895,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 19863 "ext/date/lib/parse_date.c"
+#line 19899 "ext/date/lib/parse_date.c"
yy943:
YYDEBUG(943, *YYCURSOR);
yych = *++YYCURSOR;
@@ -20335,7 +20371,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych == 'e') goto yy1094;
yy982:
YYDEBUG(982, *YYCURSOR);
-#line 1879 "ext/date/lib/parse_date.re"
+#line 1915 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -20351,7 +20387,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 20355 "ext/date/lib/parse_date.c"
+#line 20391 "ext/date/lib/parse_date.c"
yy983:
YYDEBUG(983, *YYCURSOR);
yych = *++YYCURSOR;
@@ -20698,7 +20734,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(1020, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1021, *YYCURSOR);
-#line 1585 "ext/date/lib/parse_date.re"
+#line 1621 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -20709,7 +20745,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 20713 "ext/date/lib/parse_date.c"
+#line 20749 "ext/date/lib/parse_date.c"
yy1022:
YYDEBUG(1022, *YYCURSOR);
++YYCURSOR;
@@ -20738,7 +20774,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy1025:
YYDEBUG(1025, *YYCURSOR);
-#line 1516 "ext/date/lib/parse_date.re"
+#line 1552 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -20751,7 +20787,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 20755 "ext/date/lib/parse_date.c"
+#line 20791 "ext/date/lib/parse_date.c"
yy1026:
YYDEBUG(1026, *YYCURSOR);
yyaccept = 15;
@@ -20971,7 +21007,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy1043:
YYDEBUG(1043, *YYCURSOR);
-#line 1504 "ext/date/lib/parse_date.re"
+#line 1540 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -20982,7 +21018,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 20986 "ext/date/lib/parse_date.c"
+#line 21022 "ext/date/lib/parse_date.c"
yy1044:
YYDEBUG(1044, *YYCURSOR);
yyaccept = 26;
@@ -21097,7 +21133,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy1048:
YYDEBUG(1048, *YYCURSOR);
-#line 1665 "ext/date/lib/parse_date.re"
+#line 1701 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -21108,7 +21144,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
-#line 21112 "ext/date/lib/parse_date.c"
+#line 21148 "ext/date/lib/parse_date.c"
yy1049:
YYDEBUG(1049, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21178,7 +21214,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(1059, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1060, *YYCURSOR);
-#line 1717 "ext/date/lib/parse_date.re"
+#line 1753 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -21196,7 +21232,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 21200 "ext/date/lib/parse_date.c"
+#line 21236 "ext/date/lib/parse_date.c"
yy1061:
YYDEBUG(1061, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21259,7 +21295,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych <= '9') goto yy1143;
yy1070:
YYDEBUG(1070, *YYCURSOR);
-#line 1755 "ext/date/lib/parse_date.re"
+#line 1791 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -21272,7 +21308,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 21276 "ext/date/lib/parse_date.c"
+#line 21312 "ext/date/lib/parse_date.c"
yy1071:
YYDEBUG(1071, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21745,7 +21781,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
++YYCURSOR;
yy1107:
YYDEBUG(1107, *YYCURSOR);
-#line 1216 "ext/date/lib/parse_date.re"
+#line 1252 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -21756,7 +21792,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21760 "ext/date/lib/parse_date.c"
+#line 21796 "ext/date/lib/parse_date.c"
yy1108:
YYDEBUG(1108, *YYCURSOR);
yyaccept = 28;
@@ -22093,7 +22129,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(1140, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1141, *YYCURSOR);
-#line 1769 "ext/date/lib/parse_date.re"
+#line 1805 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -22106,7 +22142,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 22110 "ext/date/lib/parse_date.c"
+#line 22146 "ext/date/lib/parse_date.c"
yy1142:
YYDEBUG(1142, *YYCURSOR);
++YYCURSOR;
@@ -22150,7 +22186,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy1145:
YYDEBUG(1145, *YYCURSOR);
-#line 1311 "ext/date/lib/parse_date.re"
+#line 1347 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -22172,7 +22208,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
-#line 22176 "ext/date/lib/parse_date.c"
+#line 22212 "ext/date/lib/parse_date.c"
yy1146:
YYDEBUG(1146, *YYCURSOR);
yyaccept = 29;
@@ -22496,7 +22532,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
}
yy1172:
YYDEBUG(1172, *YYCURSOR);
-#line 1855 "ext/date/lib/parse_date.re"
+#line 1891 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -22519,7 +22555,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 22523 "ext/date/lib/parse_date.c"
+#line 22559 "ext/date/lib/parse_date.c"
yy1173:
YYDEBUG(1173, *YYCURSOR);
yych = *++YYCURSOR;
@@ -22531,7 +22567,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
++YYCURSOR;
yy1175:
YYDEBUG(1175, *YYCURSOR);
-#line 1173 "ext/date/lib/parse_date.re"
+#line 1209 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -22542,7 +22578,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 22546 "ext/date/lib/parse_date.c"
+#line 22582 "ext/date/lib/parse_date.c"
yy1176:
YYDEBUG(1176, *YYCURSOR);
yyaccept = 31;
@@ -23035,7 +23071,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(1222, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1223, *YYCURSOR);
-#line 1921 "ext/date/lib/parse_date.re"
+#line 1957 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -23058,7 +23094,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 23062 "ext/date/lib/parse_date.c"
+#line 23098 "ext/date/lib/parse_date.c"
yy1224:
YYDEBUG(1224, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23560,7 +23596,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(1268, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1269, *YYCURSOR);
-#line 1334 "ext/date/lib/parse_date.re"
+#line 1370 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -23581,7 +23617,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
-#line 23585 "ext/date/lib/parse_date.c"
+#line 23621 "ext/date/lib/parse_date.c"
yy1270:
YYDEBUG(1270, *YYCURSOR);
yyaccept = 24;
@@ -23628,7 +23664,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(1273, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1274, *YYCURSOR);
-#line 1294 "ext/date/lib/parse_date.re"
+#line 1330 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -23644,12 +23680,12 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
-#line 23648 "ext/date/lib/parse_date.c"
+#line 23684 "ext/date/lib/parse_date.c"
yy1275:
YYDEBUG(1275, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1276, *YYCURSOR);
-#line 1530 "ext/date/lib/parse_date.re"
+#line 1566 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601datex");
TIMELIB_INIT;
@@ -23660,7 +23696,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 23664 "ext/date/lib/parse_date.c"
+#line 23700 "ext/date/lib/parse_date.c"
yy1277:
YYDEBUG(1277, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23763,7 +23799,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
YYDEBUG(1290, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1291, *YYCURSOR);
-#line 1374 "ext/date/lib/parse_date.re"
+#line 1410 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -23782,7 +23818,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 23786 "ext/date/lib/parse_date.c"
+#line 23822 "ext/date/lib/parse_date.c"
yy1292:
YYDEBUG(1292, *YYCURSOR);
yych = *++YYCURSOR;
@@ -24206,7 +24242,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych <= '9') goto yy1331;
yy1329:
YYDEBUG(1329, *YYCURSOR);
-#line 1677 "ext/date/lib/parse_date.re"
+#line 1713 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -24231,7 +24267,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
-#line 24235 "ext/date/lib/parse_date.c"
+#line 24271 "ext/date/lib/parse_date.c"
yy1330:
YYDEBUG(1330, *YYCURSOR);
yych = *++YYCURSOR;
@@ -24601,7 +24637,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych <= ':') goto yy1383;
yy1375:
YYDEBUG(1375, *YYCURSOR);
-#line 1783 "ext/date/lib/parse_date.re"
+#line 1819 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -24624,7 +24660,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 24628 "ext/date/lib/parse_date.c"
+#line 24664 "ext/date/lib/parse_date.c"
yy1376:
YYDEBUG(1376, *YYCURSOR);
yyaccept = 33;
@@ -24856,7 +24892,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
if (yych == ':') goto yy1286;
goto yy1329;
}
-#line 2011 "ext/date/lib/parse_date.re"
+#line 2047 "ext/date/lib/parse_date.re"
}
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index 0459037c7f8..6acd6ccad32 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2015-2023 Derick Rethans
+ * Copyright (c) 2015-2026 Derick Rethans
* Copyright (c) 2018 MongoDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -66,7 +66,11 @@
#define TIMELIB_RELATIVE 310
#define TIMELIB_ERROR 999
-#define TIMELIB_MAX_ERRORS 1000
+#define TIMELIB_MAX_ERRORS 16
+#define TIMELIB_MAX_ERRORS_S "16"
+
+#define TIMELIB_WARN_TOO_MANY_WARNINGS_S "There are more than " TIMELIB_MAX_ERRORS_S " warnings, which are not returned"
+#define TIMELIB_ERR_TOO_MANY_ERRORS_S "There are more than " TIMELIB_MAX_ERRORS_S " errors, which are not returned"
/* Some compilers like AIX, defines uchar in sys/types.h */
#undef uchar
@@ -361,12 +365,20 @@ static timelib_error_message *alloc_error_message(timelib_error_message **messag
static void add_warning(Scanner *s, int error_code, const char *error)
{
+ timelib_error_message *message;
+
+ if (s->errors->warning_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
+ message->error_code = TIMELIB_WARN_TOO_MANY_WARNINGS;
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_WARN_TOO_MANY_WARNINGS_S);
+ }
if (s->errors->warning_count >= TIMELIB_MAX_ERRORS) {
return;
}
- timelib_error_message *message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
-
+ message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
message->error_code = error_code;
message->position = s->tok ? s->tok - s->str : 0;
message->character = s->tok ? *s->tok : 0;
@@ -375,12 +387,20 @@ static void add_warning(Scanner *s, int error_code, const char *error)
static void add_error(Scanner *s, int error_code, const char *error)
{
+ timelib_error_message *message;
+
+ if (s->errors->error_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
+ message->error_code = TIMELIB_ERR_TOO_MANY_ERRORS;
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_ERR_TOO_MANY_ERRORS_S);
+ }
if (s->errors->error_count >= TIMELIB_MAX_ERRORS) {
return;
}
- timelib_error_message *message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
-
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
message->error_code = error_code;
message->position = s->tok ? s->tok - s->str : 0;
message->character = s->tok ? *s->tok : 0;
@@ -389,12 +409,20 @@ static void add_error(Scanner *s, int error_code, const char *error)
static void add_pbf_warning(Scanner *s, int error_code, const char *error, const char *sptr, const char *cptr)
{
+ timelib_error_message *message;
+
+ if (s->errors->warning_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
+ message->error_code = TIMELIB_WARN_TOO_MANY_WARNINGS;
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_WARN_TOO_MANY_WARNINGS_S);
+ }
if (s->errors->warning_count >= TIMELIB_MAX_ERRORS) {
return;
}
- timelib_error_message *message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
-
+ message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
message->error_code = error_code;
message->position = cptr - sptr;
message->character = *cptr;
@@ -403,12 +431,20 @@ static void add_pbf_warning(Scanner *s, int error_code, const char *error, const
static void add_pbf_error(Scanner *s, int error_code, const char *error, const char *sptr, const char *cptr)
{
+ timelib_error_message *message;
+
+ if (s->errors->error_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
+ message->error_code = TIMELIB_ERR_TOO_MANY_ERRORS;
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_ERR_TOO_MANY_ERRORS_S);
+ }
if (s->errors->error_count >= TIMELIB_MAX_ERRORS) {
return;
}
- timelib_error_message *message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
-
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
message->error_code = error_code;
message->position = cptr - sptr;
message->character = *cptr;
diff --git a/ext/date/lib/parse_iso_intervals.c b/ext/date/lib/parse_iso_intervals.c
index 0ae4888caac..cc3a365c936 100644
--- a/ext/date/lib/parse_iso_intervals.c
+++ b/ext/date/lib/parse_iso_intervals.c
@@ -1,9 +1,9 @@
-/* Generated by re2c 1.0.3 on Thu Oct 1 17:09:40 2026 */
+/* Generated by re2c 1.0.3 on Thu Nov 5 15:34:22 2026 */
#line 1 "ext/date/lib/parse_iso_intervals.re"
/*
* The MIT License (MIT)
*
- * Copyright (c) 2015-2019 Derick Rethans
+ * Copyright (c) 2015-2026 Derick Rethans
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,12 +29,15 @@
#include <ctype.h>
-#define EOI 257
+#define EOI 257
-#define TIMELIB_PERIOD 260
+#define TIMELIB_PERIOD 260
#define TIMELIB_ISO_DATE 261
-#define TIMELIB_ERROR 999
-#define TIMELIB_MAX_ERRORS 1000
+#define TIMELIB_ERROR 999
+
+#define TIMELIB_MAX_ERRORS 16
+#define TIMELIB_MAX_ERRORS_S "16"
+#define TIMELIB_ERR_TOO_MANY_ERRORS_S "There are more than " TIMELIB_MAX_ERRORS_S " errors, which are not returned"
typedef unsigned char uchar;
@@ -79,17 +82,37 @@ typedef struct _Scanner {
int have_end_date;
} Scanner;
+static timelib_error_message *alloc_error_message(timelib_error_message **messages, int *count)
+{
+ /* Realloc in power of two increments */
+ int is_pow2 = (*count & (*count - 1)) == 0;
+
+ if (is_pow2) {
+ size_t alloc_size = *count ? (*count * 2) : 1;
+
+ *messages = timelib_realloc(*messages, alloc_size * sizeof(timelib_error_message));
+ }
+ return *messages + (*count)++;
+}
+
static void add_error(Scanner *s, const char *error)
{
- if (s->errors->error_count >= TIMELIB_MAX_ERRORS) {
+ timelib_error_message *message;
+
+ if (s->errors->error_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_ERR_TOO_MANY_ERRORS_S);
+ }
+ if (s->errors->error_count > TIMELIB_MAX_ERRORS) {
return;
}
- s->errors->error_count++;
- s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
- s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
- s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
- s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
+ message->position = s->tok ? s->tok - s->str : 0;
+ message->character = s->tok ? *s->tok : 0;
+ message->message = timelib_strdup(error);
}
static char *timelib_string(Scanner *s)
@@ -171,11 +194,11 @@ static int scan(Scanner *s)
std:
s->tok = cursor;
s->len = 0;
-#line 199 "ext/date/lib/parse_iso_intervals.re"
+#line 222 "ext/date/lib/parse_iso_intervals.re"
-#line 179 "ext/date/lib/parse_iso_intervals.c"
+#line 202 "ext/date/lib/parse_iso_intervals.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -242,32 +265,32 @@ static int scan(Scanner *s)
YYDEBUG(2, *YYCURSOR);
++YYCURSOR;
YYDEBUG(3, *YYCURSOR);
-#line 306 "ext/date/lib/parse_iso_intervals.re"
+#line 329 "ext/date/lib/parse_iso_intervals.re"
{
s->pos = cursor; s->line++;
goto std;
}
-#line 251 "ext/date/lib/parse_iso_intervals.c"
+#line 274 "ext/date/lib/parse_iso_intervals.c"
yy4:
YYDEBUG(4, *YYCURSOR);
++YYCURSOR;
yy5:
YYDEBUG(5, *YYCURSOR);
-#line 312 "ext/date/lib/parse_iso_intervals.re"
+#line 335 "ext/date/lib/parse_iso_intervals.re"
{
add_error(s, "Unexpected character");
goto std;
}
-#line 262 "ext/date/lib/parse_iso_intervals.c"
+#line 285 "ext/date/lib/parse_iso_intervals.c"
yy6:
YYDEBUG(6, *YYCURSOR);
++YYCURSOR;
YYDEBUG(7, *YYCURSOR);
-#line 301 "ext/date/lib/parse_iso_intervals.re"
+#line 324 "ext/date/lib/parse_iso_intervals.re"
{
goto std;
}
-#line 271 "ext/date/lib/parse_iso_intervals.c"
+#line 294 "ext/date/lib/parse_iso_intervals.c"
yy8:
YYDEBUG(8, *YYCURSOR);
yyaccept = 0;
@@ -284,7 +307,7 @@ static int scan(Scanner *s)
if (yych == 'T') goto yy15;
yy10:
YYDEBUG(10, *YYCURSOR);
-#line 239 "ext/date/lib/parse_iso_intervals.re"
+#line 262 "ext/date/lib/parse_iso_intervals.re"
{
timelib_sll nr;
int in_time = 0;
@@ -325,7 +348,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
-#line 329 "ext/date/lib/parse_iso_intervals.c"
+#line 352 "ext/date/lib/parse_iso_intervals.c"
yy11:
YYDEBUG(11, *YYCURSOR);
yych = *++YYCURSOR;
@@ -384,7 +407,7 @@ static int scan(Scanner *s)
goto yy16;
}
YYDEBUG(18, *YYCURSOR);
-#line 204 "ext/date/lib/parse_iso_intervals.re"
+#line 227 "ext/date/lib/parse_iso_intervals.re"
{
DEBUG_OUTPUT("recurrences");
TIMELIB_INIT;
@@ -394,7 +417,7 @@ static int scan(Scanner *s)
s->have_recurrences = 1;
return TIMELIB_PERIOD;
}
-#line 398 "ext/date/lib/parse_iso_intervals.c"
+#line 421 "ext/date/lib/parse_iso_intervals.c"
yy19:
YYDEBUG(19, *YYCURSOR);
yych = *++YYCURSOR;
@@ -889,7 +912,7 @@ static int scan(Scanner *s)
YYDEBUG(89, *YYCURSOR);
++YYCURSOR;
YYDEBUG(90, *YYCURSOR);
-#line 215 "ext/date/lib/parse_iso_intervals.re"
+#line 238 "ext/date/lib/parse_iso_intervals.re"
{
timelib_time *current;
@@ -912,7 +935,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 916 "ext/date/lib/parse_iso_intervals.c"
+#line 939 "ext/date/lib/parse_iso_intervals.c"
yy91:
YYDEBUG(91, *YYCURSOR);
yych = *++YYCURSOR;
@@ -932,7 +955,7 @@ static int scan(Scanner *s)
YYDEBUG(95, *YYCURSOR);
++YYCURSOR;
YYDEBUG(96, *YYCURSOR);
-#line 281 "ext/date/lib/parse_iso_intervals.re"
+#line 304 "ext/date/lib/parse_iso_intervals.re"
{
DEBUG_OUTPUT("combinedrep");
TIMELIB_INIT;
@@ -951,9 +974,9 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
-#line 955 "ext/date/lib/parse_iso_intervals.c"
+#line 978 "ext/date/lib/parse_iso_intervals.c"
}
-#line 316 "ext/date/lib/parse_iso_intervals.re"
+#line 339 "ext/date/lib/parse_iso_intervals.re"
}
#ifdef PHP_WIN32
diff --git a/ext/date/lib/parse_iso_intervals.re b/ext/date/lib/parse_iso_intervals.re
index 06d07ab6396..5a5268d54e5 100644
--- a/ext/date/lib/parse_iso_intervals.re
+++ b/ext/date/lib/parse_iso_intervals.re
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2015-2019 Derick Rethans
+ * Copyright (c) 2015-2026 Derick Rethans
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -27,12 +27,15 @@
#include <ctype.h>
-#define EOI 257
+#define EOI 257
-#define TIMELIB_PERIOD 260
+#define TIMELIB_PERIOD 260
#define TIMELIB_ISO_DATE 261
-#define TIMELIB_ERROR 999
-#define TIMELIB_MAX_ERRORS 1000
+#define TIMELIB_ERROR 999
+
+#define TIMELIB_MAX_ERRORS 16
+#define TIMELIB_MAX_ERRORS_S "16"
+#define TIMELIB_ERR_TOO_MANY_ERRORS_S "There are more than " TIMELIB_MAX_ERRORS_S " errors, which are not returned"
typedef unsigned char uchar;
@@ -77,17 +80,37 @@ typedef struct _Scanner {
int have_end_date;
} Scanner;
+static timelib_error_message *alloc_error_message(timelib_error_message **messages, int *count)
+{
+ /* Realloc in power of two increments */
+ int is_pow2 = (*count & (*count - 1)) == 0;
+
+ if (is_pow2) {
+ size_t alloc_size = *count ? (*count * 2) : 1;
+
+ *messages = timelib_realloc(*messages, alloc_size * sizeof(timelib_error_message));
+ }
+ return *messages + (*count)++;
+}
+
static void add_error(Scanner *s, const char *error)
{
- if (s->errors->error_count >= TIMELIB_MAX_ERRORS) {
+ timelib_error_message *message;
+
+ if (s->errors->error_count == TIMELIB_MAX_ERRORS) {
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
+ message->position = -1;
+ message->character = 0;
+ message->message = timelib_strdup(TIMELIB_ERR_TOO_MANY_ERRORS_S);
+ }
+ if (s->errors->error_count > TIMELIB_MAX_ERRORS) {
return;
}
- s->errors->error_count++;
- s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
- s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
- s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
- s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
+ message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
+ message->position = s->tok ? s->tok - s->str : 0;
+ message->character = s->tok ? *s->tok : 0;
+ message->message = timelib_strdup(error);
}
static char *timelib_string(Scanner *s)
diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h
index 87fefe1f2e2..01087c79fe6 100644
--- a/ext/date/lib/timelib.h
+++ b/ext/date/lib/timelib.h
@@ -30,9 +30,9 @@
# include "timelib_config.h"
#endif
-#define TIMELIB_VERSION 202602
-#define TIMELIB_EXTENDED_VERSION 20260201
-#define TIMELIB_ASCII_VERSION "2026.02"
+#define TIMELIB_VERSION 202603
+#define TIMELIB_EXTENDED_VERSION 20260301
+#define TIMELIB_ASCII_VERSION "2026.03"
#include <stdlib.h>
#include <stdbool.h>
@@ -223,6 +223,7 @@ typedef struct _timelib_duration {
#define TIMELIB_WARN_INVALID_TIME 0x102
#define TIMELIB_WARN_INVALID_DATE 0x103
#define TIMELIB_WARN_TRAILING_DATA 0x11a
+#define TIMELIB_WARN_TOO_MANY_WARNINGS 0x1ff
#define TIMELIB_ERR_DOUBLE_TZ 0x201
#define TIMELIB_ERR_TZID_NOT_FOUND 0x202
@@ -262,6 +263,7 @@ typedef struct _timelib_duration {
#define TIMELIB_ERR_FORMAT_LITERAL_MISMATCH 0x224
#define TIMELIB_ERR_MIX_ISO_WITH_NATURAL 0x225
#define TIMELIB_ERR_NUMBER_OUT_OF_RANGE 0x226
+#define TIMELIB_ERR_TOO_MANY_ERRORS 0x2ff
#define TIMELIB_ZONETYPE_NONE 0
#define TIMELIB_ZONETYPE_OFFSET 1