Merge branch 'PHP-8.2'

This commit is contained in:
Derick Rethans 2023-01-25 10:50:32 +00:00
commit 48db3423a5
3 changed files with 123 additions and 108 deletions

View file

@ -1,9 +1,9 @@
/* Generated by re2c 0.15.3 on Tue Jan 10 15:16:26 2023 */
/* Generated by re2c 0.15.3 on Wed Jan 25 10:49:23 2023 */
#line 1 "ext/date/lib/parse_date.re"
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2019 Derick Rethans
* Copyright (c) 2015-2023 Derick Rethans
* Copyright (c) 2018 MongoDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@ -29,6 +29,7 @@
#include "timelib_private.h"
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include <assert.h>
#include <limits.h>
@ -582,7 +583,13 @@ static timelib_ull timelib_get_signed_nr(Scanner *s, const char **ptr, int max_l
++len;
}
errno = 0;
tmp_nr = strtoll(str, NULL, 10);
if (errno == ERANGE) {
timelib_free(str);
add_error(s, TIMELIB_ERR_NUMBER_OUT_OF_RANGE, "Number out of range");
return 0;
}
timelib_free(str);
@ -984,11 +991,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 1115 "ext/date/lib/parse_date.re"
#line 1122 "ext/date/lib/parse_date.re"
#line 992 "<stdout>"
#line 999 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@ -1126,7 +1133,7 @@ yy2:
}
yy3:
YYDEBUG(3, *YYCURSOR);
#line 1849 "ext/date/lib/parse_date.re"
#line 1856 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@ -1139,7 +1146,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 1143 "<stdout>"
#line 1150 "<stdout>"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@ -1446,12 +1453,12 @@ yy11:
if (yych <= '9') goto yy1483;
yy12:
YYDEBUG(12, *YYCURSOR);
#line 1944 "ext/date/lib/parse_date.re"
#line 1951 "ext/date/lib/parse_date.re"
{
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
goto std;
}
#line 1455 "<stdout>"
#line 1462 "<stdout>"
yy13:
YYDEBUG(13, *YYCURSOR);
yych = *++YYCURSOR;
@ -2695,11 +2702,11 @@ yy48:
if (yych <= '9') goto yy54;
yy49:
YYDEBUG(49, *YYCURSOR);
#line 1933 "ext/date/lib/parse_date.re"
#line 1940 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2703 "<stdout>"
#line 2710 "<stdout>"
yy50:
YYDEBUG(50, *YYCURSOR);
yych = *++YYCURSOR;
@ -2708,12 +2715,12 @@ yy51:
YYDEBUG(51, *YYCURSOR);
++YYCURSOR;
YYDEBUG(52, *YYCURSOR);
#line 1938 "ext/date/lib/parse_date.re"
#line 1945 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2717 "<stdout>"
#line 2724 "<stdout>"
yy53:
YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
@ -3135,7 +3142,7 @@ yy83:
if (yych == 's') goto yy85;
yy84:
YYDEBUG(84, *YYCURSOR);
#line 1917 "ext/date/lib/parse_date.re"
#line 1924 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@ -3150,7 +3157,7 @@ yy84:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 3154 "<stdout>"
#line 3161 "<stdout>"
yy85:
YYDEBUG(85, *YYCURSOR);
yych = *++YYCURSOR;
@ -4159,7 +4166,7 @@ yy218:
}
yy219:
YYDEBUG(219, *YYCURSOR);
#line 1780 "ext/date/lib/parse_date.re"
#line 1787 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@ -4176,7 +4183,7 @@ yy219:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 4180 "<stdout>"
#line 4187 "<stdout>"
yy220:
YYDEBUG(220, *YYCURSOR);
yych = *++YYCURSOR;
@ -4722,7 +4729,7 @@ yy247:
}
yy248:
YYDEBUG(248, *YYCURSOR);
#line 1839 "ext/date/lib/parse_date.re"
#line 1846 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@ -4731,7 +4738,7 @@ yy248:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4735 "<stdout>"
#line 4742 "<stdout>"
yy249:
YYDEBUG(249, *YYCURSOR);
++YYCURSOR;
@ -4980,7 +4987,7 @@ yy261:
goto yy267;
yy262:
YYDEBUG(262, *YYCURSOR);
#line 1585 "ext/date/lib/parse_date.re"
#line 1592 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@ -4993,7 +5000,7 @@ yy262:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4997 "<stdout>"
#line 5004 "<stdout>"
yy263:
YYDEBUG(263, *YYCURSOR);
yyaccept = 6;
@ -5120,7 +5127,7 @@ yy275:
}
yy276:
YYDEBUG(276, *YYCURSOR);
#line 1887 "ext/date/lib/parse_date.re"
#line 1894 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@ -5149,7 +5156,7 @@ yy276:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5153 "<stdout>"
#line 5160 "<stdout>"
yy277:
YYDEBUG(277, *YYCURSOR);
yyaccept = 7;
@ -5447,7 +5454,7 @@ yy300:
YYDEBUG(300, *YYCURSOR);
++YYCURSOR;
YYDEBUG(301, *YYCURSOR);
#line 1863 "ext/date/lib/parse_date.re"
#line 1870 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@ -5470,7 +5477,7 @@ yy300:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5474 "<stdout>"
#line 5481 "<stdout>"
yy302:
YYDEBUG(302, *YYCURSOR);
yych = *++YYCURSOR;
@ -6148,7 +6155,7 @@ yy361:
YYDEBUG(362, *YYCURSOR);
++YYCURSOR;
YYDEBUG(363, *YYCURSOR);
#line 1557 "ext/date/lib/parse_date.re"
#line 1564 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@ -6161,7 +6168,7 @@ yy361:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 6165 "<stdout>"
#line 6172 "<stdout>"
yy364:
YYDEBUG(364, *YYCURSOR);
yych = *++YYCURSOR;
@ -6392,7 +6399,7 @@ yy368:
if (yych <= '9') goto yy372;
yy371:
YYDEBUG(371, *YYCURSOR);
#line 1701 "ext/date/lib/parse_date.re"
#line 1708 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@ -6405,7 +6412,7 @@ yy371:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6409 "<stdout>"
#line 6416 "<stdout>"
yy372:
YYDEBUG(372, *YYCURSOR);
yych = *++YYCURSOR;
@ -6987,7 +6994,7 @@ yy397:
}
yy398:
YYDEBUG(398, *YYCURSOR);
#line 1759 "ext/date/lib/parse_date.re"
#line 1766 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@ -7007,7 +7014,7 @@ yy398:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 7011 "<stdout>"
#line 7018 "<stdout>"
yy399:
YYDEBUG(399, *YYCURSOR);
yyaccept = 5;
@ -8796,7 +8803,7 @@ yy460:
++YYCURSOR;
yy461:
YYDEBUG(461, *YYCURSOR);
#line 1450 "ext/date/lib/parse_date.re"
#line 1457 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@ -8807,7 +8814,7 @@ yy461:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8811 "<stdout>"
#line 8818 "<stdout>"
yy462:
YYDEBUG(462, *YYCURSOR);
yych = *++YYCURSOR;
@ -8929,7 +8936,7 @@ yy484:
YYDEBUG(484, *YYCURSOR);
++YYCURSOR;
YYDEBUG(485, *YYCURSOR);
#line 1476 "ext/date/lib/parse_date.re"
#line 1483 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601datex");
TIMELIB_INIT;
@ -8940,7 +8947,7 @@ yy484:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8944 "<stdout>"
#line 8951 "<stdout>"
yy486:
YYDEBUG(486, *YYCURSOR);
yyaccept = 1;
@ -9694,7 +9701,7 @@ yy508:
}
yy509:
YYDEBUG(509, *YYCURSOR);
#line 1599 "ext/date/lib/parse_date.re"
#line 1606 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@ -9705,7 +9712,7 @@ yy509:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9709 "<stdout>"
#line 9716 "<stdout>"
yy510:
YYDEBUG(510, *YYCURSOR);
yyaccept = 9;
@ -9846,7 +9853,7 @@ yy521:
YYDEBUG(521, *YYCURSOR);
++YYCURSOR;
YYDEBUG(522, *YYCURSOR);
#line 1303 "ext/date/lib/parse_date.re"
#line 1310 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@ -9862,7 +9869,7 @@ yy521:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9866 "<stdout>"
#line 9873 "<stdout>"
yy523:
YYDEBUG(523, *YYCURSOR);
yyaccept = 10;
@ -9875,7 +9882,7 @@ yy523:
}
yy524:
YYDEBUG(524, *YYCURSOR);
#line 1340 "ext/date/lib/parse_date.re"
#line 1347 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timetiny24 | timeshort24 | timelong24 | iso8601long");
@ -9902,7 +9909,7 @@ yy524:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9906 "<stdout>"
#line 9913 "<stdout>"
yy525:
YYDEBUG(525, *YYCURSOR);
yyaccept = 10;
@ -10215,7 +10222,7 @@ yy556:
YYDEBUG(556, *YYCURSOR);
++YYCURSOR;
YYDEBUG(557, *YYCURSOR);
#line 1320 "ext/date/lib/parse_date.re"
#line 1327 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@ -10234,7 +10241,7 @@ yy556:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 10238 "<stdout>"
#line 10245 "<stdout>"
yy558:
YYDEBUG(558, *YYCURSOR);
yyaccept = 10;
@ -10340,7 +10347,7 @@ yy567:
if (yych <= '9') goto yy574;
yy568:
YYDEBUG(568, *YYCURSOR);
#line 1516 "ext/date/lib/parse_date.re"
#line 1523 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@ -10354,7 +10361,7 @@ yy568:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 10358 "<stdout>"
#line 10365 "<stdout>"
yy569:
YYDEBUG(569, *YYCURSOR);
yych = *++YYCURSOR;
@ -11090,7 +11097,7 @@ yy638:
YYDEBUG(639, *YYCURSOR);
++YYCURSOR;
YYDEBUG(640, *YYCURSOR);
#line 1531 "ext/date/lib/parse_date.re"
#line 1538 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@ -11101,7 +11108,7 @@ yy638:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11105 "<stdout>"
#line 11112 "<stdout>"
yy641:
YYDEBUG(641, *YYCURSOR);
yyaccept = 10;
@ -11137,7 +11144,7 @@ yy644:
if (yych <= '9') goto yy638;
yy645:
YYDEBUG(645, *YYCURSOR);
#line 1543 "ext/date/lib/parse_date.re"
#line 1550 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@ -11150,7 +11157,7 @@ yy645:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11154 "<stdout>"
#line 11161 "<stdout>"
yy646:
YYDEBUG(646, *YYCURSOR);
yyaccept = 10;
@ -11791,7 +11798,7 @@ yy689:
}
yy690:
YYDEBUG(690, *YYCURSOR);
#line 1502 "ext/date/lib/parse_date.re"
#line 1509 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@ -11804,7 +11811,7 @@ yy690:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11808 "<stdout>"
#line 11815 "<stdout>"
yy691:
YYDEBUG(691, *YYCURSOR);
yyaccept = 12;
@ -11910,7 +11917,7 @@ yy699:
}
yy700:
YYDEBUG(700, *YYCURSOR);
#line 1434 "ext/date/lib/parse_date.re"
#line 1441 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@ -11925,7 +11932,7 @@ yy700:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11929 "<stdout>"
#line 11936 "<stdout>"
yy701:
YYDEBUG(701, *YYCURSOR);
yyaccept = 13;
@ -12159,7 +12166,7 @@ yy733:
if (yych <= ':') goto yy737;
yy734:
YYDEBUG(734, *YYCURSOR);
#line 1729 "ext/date/lib/parse_date.re"
#line 1736 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@ -12179,7 +12186,7 @@ yy734:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12183 "<stdout>"
#line 12190 "<stdout>"
yy735:
YYDEBUG(735, *YYCURSOR);
yyaccept = 14;
@ -12799,7 +12806,7 @@ yy807:
}
yy808:
YYDEBUG(808, *YYCURSOR);
#line 1462 "ext/date/lib/parse_date.re"
#line 1469 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@ -12812,7 +12819,7 @@ yy808:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 12816 "<stdout>"
#line 12823 "<stdout>"
yy809:
YYDEBUG(809, *YYCURSOR);
yych = *++YYCURSOR;
@ -12851,7 +12858,7 @@ yy815:
YYDEBUG(815, *YYCURSOR);
++YYCURSOR;
YYDEBUG(816, *YYCURSOR);
#line 1715 "ext/date/lib/parse_date.re"
#line 1722 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@ -12864,7 +12871,7 @@ yy815:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 12868 "<stdout>"
#line 12875 "<stdout>"
yy817:
YYDEBUG(817, *YYCURSOR);
yych = *++YYCURSOR;
@ -13029,7 +13036,7 @@ yy827:
}
yy828:
YYDEBUG(828, *YYCURSOR);
#line 1750 "ext/date/lib/parse_date.re"
#line 1757 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@ -13037,7 +13044,7 @@ yy828:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 13041 "<stdout>"
#line 13048 "<stdout>"
yy829:
YYDEBUG(829, *YYCURSOR);
yych = *++YYCURSOR;
@ -13242,7 +13249,7 @@ yy837:
}
yy838:
YYDEBUG(838, *YYCURSOR);
#line 1571 "ext/date/lib/parse_date.re"
#line 1578 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@ -13255,7 +13262,7 @@ yy838:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 13259 "<stdout>"
#line 13266 "<stdout>"
yy839:
YYDEBUG(839, *YYCURSOR);
yych = *++YYCURSOR;
@ -13476,7 +13483,7 @@ yy858:
if (yych <= '7') goto yy861;
yy859:
YYDEBUG(859, *YYCURSOR);
#line 1682 "ext/date/lib/parse_date.re"
#line 1689 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@ -13494,7 +13501,7 @@ yy859:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13498 "<stdout>"
#line 13505 "<stdout>"
yy860:
YYDEBUG(860, *YYCURSOR);
yych = *++YYCURSOR;
@ -13504,7 +13511,7 @@ yy861:
YYDEBUG(861, *YYCURSOR);
++YYCURSOR;
YYDEBUG(862, *YYCURSOR);
#line 1663 "ext/date/lib/parse_date.re"
#line 1670 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@ -13522,7 +13529,7 @@ yy861:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13526 "<stdout>"
#line 13533 "<stdout>"
yy863:
YYDEBUG(863, *YYCURSOR);
yych = *++YYCURSOR;
@ -13594,7 +13601,7 @@ yy865:
}
yy866:
YYDEBUG(866, *YYCURSOR);
#line 1649 "ext/date/lib/parse_date.re"
#line 1656 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@ -13607,7 +13614,7 @@ yy866:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 13611 "<stdout>"
#line 13618 "<stdout>"
yy867:
YYDEBUG(867, *YYCURSOR);
yych = *++YYCURSOR;
@ -13710,7 +13717,7 @@ yy886:
++YYCURSOR;
yy887:
YYDEBUG(887, *YYCURSOR);
#line 1623 "ext/date/lib/parse_date.re"
#line 1630 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@ -13735,7 +13742,7 @@ yy887:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 13739 "<stdout>"
#line 13746 "<stdout>"
yy888:
YYDEBUG(888, *YYCURSOR);
yych = *++YYCURSOR;
@ -14031,7 +14038,7 @@ yy892:
}
yy893:
YYDEBUG(893, *YYCURSOR);
#line 1611 "ext/date/lib/parse_date.re"
#line 1618 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@ -14042,7 +14049,7 @@ yy893:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 14046 "<stdout>"
#line 14053 "<stdout>"
yy894:
YYDEBUG(894, *YYCURSOR);
yych = *++YYCURSOR;
@ -14964,7 +14971,7 @@ yy1017:
}
yy1018:
YYDEBUG(1018, *YYCURSOR);
#line 1488 "ext/date/lib/parse_date.re"
#line 1495 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@ -14977,7 +14984,7 @@ yy1018:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14981 "<stdout>"
#line 14988 "<stdout>"
yy1019:
YYDEBUG(1019, *YYCURSOR);
yyaccept = 22;
@ -16185,7 +16192,7 @@ yy1125:
}
yy1127:
YYDEBUG(1127, *YYCURSOR);
#line 1368 "ext/date/lib/parse_date.re"
#line 1375 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@ -16207,7 +16214,7 @@ yy1127:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 16211 "<stdout>"
#line 16218 "<stdout>"
yy1128:
YYDEBUG(1128, *YYCURSOR);
yych = *++YYCURSOR;
@ -16307,7 +16314,7 @@ yy1134:
}
yy1135:
YYDEBUG(1135, *YYCURSOR);
#line 1414 "ext/date/lib/parse_date.re"
#line 1421 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@ -16326,7 +16333,7 @@ yy1135:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 16330 "<stdout>"
#line 16337 "<stdout>"
yy1136:
YYDEBUG(1136, *YYCURSOR);
yyaccept = 25;
@ -17302,7 +17309,7 @@ yy1178:
}
yy1179:
YYDEBUG(1179, *YYCURSOR);
#line 1822 "ext/date/lib/parse_date.re"
#line 1829 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -17318,7 +17325,7 @@ yy1179:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 17322 "<stdout>"
#line 17329 "<stdout>"
yy1180:
YYDEBUG(1180, *YYCURSOR);
++YYCURSOR;
@ -17384,7 +17391,7 @@ yy1188:
YYDEBUG(1188, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1189, *YYCURSOR);
#line 1281 "ext/date/lib/parse_date.re"
#line 1288 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -17405,7 +17412,7 @@ yy1188:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 17409 "<stdout>"
#line 17416 "<stdout>"
yy1190:
YYDEBUG(1190, *YYCURSOR);
yyaccept = 26;
@ -17545,7 +17552,7 @@ yy1205:
}
yy1206:
YYDEBUG(1206, *YYCURSOR);
#line 1798 "ext/date/lib/parse_date.re"
#line 1805 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -17568,7 +17575,7 @@ yy1206:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 17572 "<stdout>"
#line 17579 "<stdout>"
yy1207:
YYDEBUG(1207, *YYCURSOR);
yych = *++YYCURSOR;
@ -20517,7 +20524,7 @@ yy1387:
}
yy1388:
YYDEBUG(1388, *YYCURSOR);
#line 1258 "ext/date/lib/parse_date.re"
#line 1265 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@ -20539,7 +20546,7 @@ yy1388:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 20543 "<stdout>"
#line 20550 "<stdout>"
yy1389:
YYDEBUG(1389, *YYCURSOR);
yyaccept = 28;
@ -20838,7 +20845,7 @@ yy1410:
YYDEBUG(1410, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1411, *YYCURSOR);
#line 1241 "ext/date/lib/parse_date.re"
#line 1248 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@ -20854,7 +20861,7 @@ yy1410:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 20858 "<stdout>"
#line 20865 "<stdout>"
yy1412:
YYDEBUG(1412, *YYCURSOR);
yyaccept = 1;
@ -22376,7 +22383,7 @@ yy1483:
if (yych <= '9') goto yy1483;
yy1485:
YYDEBUG(1485, *YYCURSOR);
#line 1175 "ext/date/lib/parse_date.re"
#line 1182 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@ -22401,7 +22408,7 @@ yy1485:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22405 "<stdout>"
#line 22412 "<stdout>"
yy1486:
YYDEBUG(1486, *YYCURSOR);
++YYCURSOR;
@ -22409,7 +22416,7 @@ yy1486:
if (yych <= '9') goto yy1488;
yy1487:
YYDEBUG(1487, *YYCURSOR);
#line 1201 "ext/date/lib/parse_date.re"
#line 1208 "ext/date/lib/parse_date.re"
{
timelib_sll i;
timelib_ull us;
@ -22448,7 +22455,7 @@ yy1487:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22452 "<stdout>"
#line 22459 "<stdout>"
yy1488:
YYDEBUG(1488, *YYCURSOR);
yych = *++YYCURSOR;
@ -22917,7 +22924,7 @@ yy1523:
++YYCURSOR;
yy1524:
YYDEBUG(1524, *YYCURSOR);
#line 1163 "ext/date/lib/parse_date.re"
#line 1170 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@ -22928,7 +22935,7 @@ yy1524:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22932 "<stdout>"
#line 22939 "<stdout>"
yy1525:
YYDEBUG(1525, *YYCURSOR);
yych = *++YYCURSOR;
@ -22963,7 +22970,7 @@ yy1526:
}
yy1527:
YYDEBUG(1527, *YYCURSOR);
#line 1153 "ext/date/lib/parse_date.re"
#line 1160 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@ -22972,7 +22979,7 @@ yy1527:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22976 "<stdout>"
#line 22983 "<stdout>"
yy1528:
YYDEBUG(1528, *YYCURSOR);
yych = *++YYCURSOR;
@ -25067,7 +25074,7 @@ yy1611:
}
yy1612:
YYDEBUG(1612, *YYCURSOR);
#line 1132 "ext/date/lib/parse_date.re"
#line 1139 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@ -25075,7 +25082,7 @@ yy1612:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25079 "<stdout>"
#line 25086 "<stdout>"
yy1613:
YYDEBUG(1613, *YYCURSOR);
yych = *++YYCURSOR;
@ -25214,7 +25221,7 @@ yy1619:
}
yy1620:
YYDEBUG(1620, *YYCURSOR);
#line 1141 "ext/date/lib/parse_date.re"
#line 1148 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@ -25225,7 +25232,7 @@ yy1620:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25229 "<stdout>"
#line 25236 "<stdout>"
yy1621:
YYDEBUG(1621, *YYCURSOR);
yyaccept = 1;
@ -25758,7 +25765,7 @@ yy1642:
++YYCURSOR;
yy1643:
YYDEBUG(1643, *YYCURSOR);
#line 1120 "ext/date/lib/parse_date.re"
#line 1127 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@ -25769,7 +25776,7 @@ yy1643:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25773 "<stdout>"
#line 25780 "<stdout>"
yy1644:
YYDEBUG(1644, *YYCURSOR);
yyaccept = 1;
@ -25942,7 +25949,7 @@ yy1649:
goto yy1643;
}
}
#line 1948 "ext/date/lib/parse_date.re"
#line 1955 "ext/date/lib/parse_date.re"
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2019 Derick Rethans
* Copyright (c) 2015-2023 Derick Rethans
* Copyright (c) 2018 MongoDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@ -27,6 +27,7 @@
#include "timelib_private.h"
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include <assert.h>
#include <limits.h>
@ -580,7 +581,13 @@ static timelib_ull timelib_get_signed_nr(Scanner *s, const char **ptr, int max_l
++len;
}
errno = 0;
tmp_nr = strtoll(str, NULL, 10);
if (errno == ERANGE) {
timelib_free(str);
add_error(s, TIMELIB_ERR_NUMBER_OUT_OF_RANGE, "Number out of range");
return 0;
}
timelib_free(str);

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Derick Rethans
* Copyright (c) 2015-2023 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 202204
#define TIMELIB_EXTENDED_VERSION 20220401
#define TIMELIB_ASCII_VERSION "2022.04"
#define TIMELIB_VERSION 202205
#define TIMELIB_EXTENDED_VERSION 20220501
#define TIMELIB_ASCII_VERSION "2022.05"
#include <stdlib.h>
#include <stdbool.h>
@ -321,6 +321,7 @@ typedef struct _timelib_abbr_info {
#define TIMELIB_ERR_INVALID_TZ_OFFSET 0x223
#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_ZONETYPE_NONE 0
#define TIMELIB_ZONETYPE_OFFSET 1