Browse Source

- MFH: Fixed an issue with the * format specifier for parsing from a

user-defined format.
PECL
Derick Rethans 18 years ago
parent
commit
1c08ae1c8e
  1. 197
      ext/date/lib/parse_date.c
  2. 1
      ext/date/lib/parse_date.re
  3. 51
      ext/date/tests/date-parse-by-format001.phpt

197
ext/date/lib/parse_date.c

@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Fri Aug 29 13:57:38 2008 */
/* Generated by re2c 0.13.5 on Wed Nov 5 11:30:55 2008 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
@ -626,6 +626,7 @@ static void timelib_eat_spaces(char **ptr)
static void timelib_eat_until_separator(char **ptr)
{
++*ptr;
while (strchr(" \t.,:;/-0123456789", **ptr) == NULL) {
++*ptr;
}
@ -838,11 +839,11 @@ static int scan(Scanner *s)
std:
s->tok = cursor;
s->len = 0;
#line 964 "ext/date/lib/parse_date.re"
#line 965 "ext/date/lib/parse_date.re"
#line 846 "ext/date/lib/parse_date.c"
#line 847 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@ -982,7 +983,7 @@ yy2:
}
yy3:
YYDEBUG(3, *YYCURSOR);
#line 1631 "ext/date/lib/parse_date.re"
#line 1632 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@ -995,7 +996,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 999 "ext/date/lib/parse_date.c"
#line 1000 "ext/date/lib/parse_date.c"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@ -1306,12 +1307,12 @@ yy11:
if (yych <= '9') goto yy1383;
yy12:
YYDEBUG(12, *YYCURSOR);
#line 1726 "ext/date/lib/parse_date.re"
#line 1727 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
}
#line 1315 "ext/date/lib/parse_date.c"
#line 1316 "ext/date/lib/parse_date.c"
yy13:
YYDEBUG(13, *YYCURSOR);
yych = *++YYCURSOR;
@ -2368,11 +2369,11 @@ yy48:
if (yych <= '9') goto yy54;
yy49:
YYDEBUG(49, *YYCURSOR);
#line 1715 "ext/date/lib/parse_date.re"
#line 1716 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2376 "ext/date/lib/parse_date.c"
#line 2377 "ext/date/lib/parse_date.c"
yy50:
YYDEBUG(50, *YYCURSOR);
yych = *++YYCURSOR;
@ -2381,12 +2382,12 @@ yy51:
YYDEBUG(51, *YYCURSOR);
++YYCURSOR;
YYDEBUG(52, *YYCURSOR);
#line 1720 "ext/date/lib/parse_date.re"
#line 1721 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2390 "ext/date/lib/parse_date.c"
#line 2391 "ext/date/lib/parse_date.c"
yy53:
YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
@ -2777,7 +2778,7 @@ yy71:
if (yych == 's') goto yy73;
yy72:
YYDEBUG(72, *YYCURSOR);
#line 1699 "ext/date/lib/parse_date.re"
#line 1700 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@ -2792,7 +2793,7 @@ yy72:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 2796 "ext/date/lib/parse_date.c"
#line 2797 "ext/date/lib/parse_date.c"
yy73:
YYDEBUG(73, *YYCURSOR);
yych = *++YYCURSOR;
@ -3545,7 +3546,7 @@ yy166:
}
yy167:
YYDEBUG(167, *YYCURSOR);
#line 1562 "ext/date/lib/parse_date.re"
#line 1563 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@ -3562,7 +3563,7 @@ yy167:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 3566 "ext/date/lib/parse_date.c"
#line 3567 "ext/date/lib/parse_date.c"
yy168:
YYDEBUG(168, *YYCURSOR);
yych = *++YYCURSOR;
@ -4039,7 +4040,7 @@ yy193:
}
yy194:
YYDEBUG(194, *YYCURSOR);
#line 1621 "ext/date/lib/parse_date.re"
#line 1622 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@ -4048,7 +4049,7 @@ yy194:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4052 "ext/date/lib/parse_date.c"
#line 4053 "ext/date/lib/parse_date.c"
yy195:
YYDEBUG(195, *YYCURSOR);
++YYCURSOR;
@ -4099,7 +4100,7 @@ yy198:
}
yy199:
YYDEBUG(199, *YYCURSOR);
#line 1371 "ext/date/lib/parse_date.re"
#line 1372 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datetextual | datenoyear");
TIMELIB_INIT;
@ -4111,7 +4112,7 @@ yy199:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4115 "ext/date/lib/parse_date.c"
#line 4116 "ext/date/lib/parse_date.c"
yy200:
YYDEBUG(200, *YYCURSOR);
yyaccept = 6;
@ -4380,7 +4381,7 @@ yy222:
}
yy223:
YYDEBUG(223, *YYCURSOR);
#line 1669 "ext/date/lib/parse_date.re"
#line 1670 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@ -4409,7 +4410,7 @@ yy223:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 4413 "ext/date/lib/parse_date.c"
#line 4414 "ext/date/lib/parse_date.c"
yy224:
YYDEBUG(224, *YYCURSOR);
yyaccept = 7;
@ -5086,7 +5087,7 @@ yy279:
YYDEBUG(279, *YYCURSOR);
++YYCURSOR;
YYDEBUG(280, *YYCURSOR);
#line 1645 "ext/date/lib/parse_date.re"
#line 1646 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@ -5109,7 +5110,7 @@ yy279:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5113 "ext/date/lib/parse_date.c"
#line 5114 "ext/date/lib/parse_date.c"
yy281:
YYDEBUG(281, *YYCURSOR);
yych = *++YYCURSOR;
@ -5282,7 +5283,7 @@ yy295:
++YYCURSOR;
yy296:
YYDEBUG(296, *YYCURSOR);
#line 1345 "ext/date/lib/parse_date.re"
#line 1346 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoday");
TIMELIB_INIT;
@ -5294,7 +5295,7 @@ yy296:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 5298 "ext/date/lib/parse_date.c"
#line 5299 "ext/date/lib/parse_date.c"
yy297:
YYDEBUG(297, *YYCURSOR);
yych = *++YYCURSOR;
@ -6504,7 +6505,7 @@ yy363:
if (yych <= '9') goto yy366;
yy365:
YYDEBUG(365, *YYCURSOR);
#line 1485 "ext/date/lib/parse_date.re"
#line 1486 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pgtextshort");
TIMELIB_INIT;
@ -6516,7 +6517,7 @@ yy365:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6520 "ext/date/lib/parse_date.c"
#line 6521 "ext/date/lib/parse_date.c"
yy366:
YYDEBUG(366, *YYCURSOR);
yych = *++YYCURSOR;
@ -7100,7 +7101,7 @@ yy391:
}
yy392:
YYDEBUG(392, *YYCURSOR);
#line 1541 "ext/date/lib/parse_date.re"
#line 1542 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@ -7120,7 +7121,7 @@ yy392:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 7124 "ext/date/lib/parse_date.c"
#line 7125 "ext/date/lib/parse_date.c"
yy393:
YYDEBUG(393, *YYCURSOR);
yyaccept = 5;
@ -8805,7 +8806,7 @@ yy453:
++YYCURSOR;
yy454:
YYDEBUG(454, *YYCURSOR);
#line 1255 "ext/date/lib/parse_date.re"
#line 1256 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@ -8816,7 +8817,7 @@ yy454:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8820 "ext/date/lib/parse_date.c"
#line 8821 "ext/date/lib/parse_date.c"
yy455:
YYDEBUG(455, *YYCURSOR);
yyaccept = 0;
@ -9376,7 +9377,7 @@ yy474:
}
yy475:
YYDEBUG(475, *YYCURSOR);
#line 1384 "ext/date/lib/parse_date.re"
#line 1385 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@ -9387,7 +9388,7 @@ yy475:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9391 "ext/date/lib/parse_date.c"
#line 9392 "ext/date/lib/parse_date.c"
yy476:
YYDEBUG(476, *YYCURSOR);
yyaccept = 10;
@ -9528,7 +9529,7 @@ yy487:
YYDEBUG(487, *YYCURSOR);
++YYCURSOR;
YYDEBUG(488, *YYCURSOR);
#line 1111 "ext/date/lib/parse_date.re"
#line 1112 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@ -9544,7 +9545,7 @@ yy487:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9548 "ext/date/lib/parse_date.c"
#line 9549 "ext/date/lib/parse_date.c"
yy489:
YYDEBUG(489, *YYCURSOR);
yyaccept = 11;
@ -9557,7 +9558,7 @@ yy489:
}
yy490:
YYDEBUG(490, *YYCURSOR);
#line 1148 "ext/date/lib/parse_date.re"
#line 1149 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@ -9582,7 +9583,7 @@ yy490:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9586 "ext/date/lib/parse_date.c"
#line 9587 "ext/date/lib/parse_date.c"
yy491:
YYDEBUG(491, *YYCURSOR);
yyaccept = 11;
@ -9892,7 +9893,7 @@ yy522:
YYDEBUG(522, *YYCURSOR);
++YYCURSOR;
YYDEBUG(523, *YYCURSOR);
#line 1128 "ext/date/lib/parse_date.re"
#line 1129 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@ -9911,7 +9912,7 @@ yy522:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9915 "ext/date/lib/parse_date.c"
#line 9916 "ext/date/lib/parse_date.c"
yy524:
YYDEBUG(524, *YYCURSOR);
yyaccept = 11;
@ -10017,7 +10018,7 @@ yy533:
if (yych <= '9') goto yy540;
yy534:
YYDEBUG(534, *YYCURSOR);
#line 1306 "ext/date/lib/parse_date.re"
#line 1307 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datefull");
TIMELIB_INIT;
@ -10030,7 +10031,7 @@ yy534:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 10034 "ext/date/lib/parse_date.c"
#line 10035 "ext/date/lib/parse_date.c"
yy535:
YYDEBUG(535, *YYCURSOR);
yych = *++YYCURSOR;
@ -10767,7 +10768,7 @@ yy604:
YYDEBUG(605, *YYCURSOR);
++YYCURSOR;
YYDEBUG(606, *YYCURSOR);
#line 1320 "ext/date/lib/parse_date.re"
#line 1321 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@ -10778,7 +10779,7 @@ yy604:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 10782 "ext/date/lib/parse_date.c"
#line 10783 "ext/date/lib/parse_date.c"
yy607:
YYDEBUG(607, *YYCURSOR);
yyaccept = 11;
@ -10814,7 +10815,7 @@ yy610:
if (yych <= '9') goto yy604;
yy611:
YYDEBUG(611, *YYCURSOR);
#line 1332 "ext/date/lib/parse_date.re"
#line 1333 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YY");
TIMELIB_INIT;
@ -10826,7 +10827,7 @@ yy611:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 10830 "ext/date/lib/parse_date.c"
#line 10831 "ext/date/lib/parse_date.c"
yy612:
YYDEBUG(612, *YYCURSOR);
yyaccept = 11;
@ -11467,7 +11468,7 @@ yy655:
}
yy656:
YYDEBUG(656, *YYCURSOR);
#line 1293 "ext/date/lib/parse_date.re"
#line 1294 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnudateshort");
TIMELIB_INIT;
@ -11479,7 +11480,7 @@ yy656:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11483 "ext/date/lib/parse_date.c"
#line 11484 "ext/date/lib/parse_date.c"
yy657:
YYDEBUG(657, *YYCURSOR);
yyaccept = 13;
@ -11585,7 +11586,7 @@ yy665:
}
yy666:
YYDEBUG(666, *YYCURSOR);
#line 1240 "ext/date/lib/parse_date.re"
#line 1241 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("americanshort | american");
TIMELIB_INIT;
@ -11599,7 +11600,7 @@ yy666:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11603 "ext/date/lib/parse_date.c"
#line 11604 "ext/date/lib/parse_date.c"
yy667:
YYDEBUG(667, *YYCURSOR);
yyaccept = 14;
@ -11832,7 +11833,7 @@ yy699:
if (yych <= ':') goto yy703;
yy700:
YYDEBUG(700, *YYCURSOR);
#line 1511 "ext/date/lib/parse_date.re"
#line 1512 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@ -11852,7 +11853,7 @@ yy700:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 11856 "ext/date/lib/parse_date.c"
#line 11857 "ext/date/lib/parse_date.c"
yy701:
YYDEBUG(701, *YYCURSOR);
yych = *++YYCURSOR;
@ -12404,7 +12405,7 @@ yy762:
}
yy763:
YYDEBUG(763, *YYCURSOR);
#line 1267 "ext/date/lib/parse_date.re"
#line 1268 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date2");
TIMELIB_INIT;
@ -12416,7 +12417,7 @@ yy763:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 12420 "ext/date/lib/parse_date.c"
#line 12421 "ext/date/lib/parse_date.c"
yy764:
YYDEBUG(764, *YYCURSOR);
yych = *++YYCURSOR;
@ -12455,7 +12456,7 @@ yy770:
YYDEBUG(770, *YYCURSOR);
++YYCURSOR;
YYDEBUG(771, *YYCURSOR);
#line 1498 "ext/date/lib/parse_date.re"
#line 1499 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pgtextreverse");
TIMELIB_INIT;
@ -12467,7 +12468,7 @@ yy770:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 12471 "ext/date/lib/parse_date.c"
#line 12472 "ext/date/lib/parse_date.c"
yy772:
YYDEBUG(772, *YYCURSOR);
yych = *++YYCURSOR;
@ -12605,7 +12606,7 @@ yy782:
}
yy783:
YYDEBUG(783, *YYCURSOR);
#line 1532 "ext/date/lib/parse_date.re"
#line 1533 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@ -12613,7 +12614,7 @@ yy783:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12617 "ext/date/lib/parse_date.c"
#line 12618 "ext/date/lib/parse_date.c"
yy784:
YYDEBUG(784, *YYCURSOR);
yych = *++YYCURSOR;
@ -12764,7 +12765,7 @@ yy792:
}
yy793:
YYDEBUG(793, *YYCURSOR);
#line 1358 "ext/date/lib/parse_date.re"
#line 1359 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenodayrev");
TIMELIB_INIT;
@ -12776,7 +12777,7 @@ yy793:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 12780 "ext/date/lib/parse_date.c"
#line 12781 "ext/date/lib/parse_date.c"
yy794:
YYDEBUG(794, *YYCURSOR);
yych = *++YYCURSOR;
@ -12991,7 +12992,7 @@ yy813:
if (yych <= '7') goto yy816;
yy814:
YYDEBUG(814, *YYCURSOR);
#line 1466 "ext/date/lib/parse_date.re"
#line 1467 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@ -13009,7 +13010,7 @@ yy814:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13013 "ext/date/lib/parse_date.c"
#line 13014 "ext/date/lib/parse_date.c"
yy815:
YYDEBUG(815, *YYCURSOR);
yych = *++YYCURSOR;
@ -13019,7 +13020,7 @@ yy816:
YYDEBUG(816, *YYCURSOR);
++YYCURSOR;
YYDEBUG(817, *YYCURSOR);
#line 1447 "ext/date/lib/parse_date.re"
#line 1448 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@ -13037,7 +13038,7 @@ yy816:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13041 "ext/date/lib/parse_date.c"
#line 13042 "ext/date/lib/parse_date.c"
yy818:
YYDEBUG(818, *YYCURSOR);
yych = *++YYCURSOR;
@ -13101,7 +13102,7 @@ yy820:
}
yy821:
YYDEBUG(821, *YYCURSOR);
#line 1434 "ext/date/lib/parse_date.re"
#line 1435 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pgydotd");
TIMELIB_INIT;
@ -13113,7 +13114,7 @@ yy821:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 13117 "ext/date/lib/parse_date.c"
#line 13118 "ext/date/lib/parse_date.c"
yy822:
YYDEBUG(822, *YYCURSOR);
yych = *++YYCURSOR;
@ -13216,7 +13217,7 @@ yy841:
++YYCURSOR;
yy842:
YYDEBUG(842, *YYCURSOR);
#line 1408 "ext/date/lib/parse_date.re"
#line 1409 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@ -13241,7 +13242,7 @@ yy842:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 13245 "ext/date/lib/parse_date.c"
#line 13246 "ext/date/lib/parse_date.c"
yy843:
YYDEBUG(843, *YYCURSOR);
yych = *++YYCURSOR;
@ -13503,7 +13504,7 @@ yy847:
}
yy848:
YYDEBUG(848, *YYCURSOR);
#line 1396 "ext/date/lib/parse_date.re"
#line 1397 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@ -13514,7 +13515,7 @@ yy848:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 13518 "ext/date/lib/parse_date.c"
#line 13519 "ext/date/lib/parse_date.c"
yy849:
YYDEBUG(849, *YYCURSOR);
yych = *++YYCURSOR;
@ -14434,7 +14435,7 @@ yy972:
if (yych <= '9') goto yy995;
yy973:
YYDEBUG(973, *YYCURSOR);
#line 1280 "ext/date/lib/parse_date.re"
#line 1281 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnudateshorter");
TIMELIB_INIT;
@ -14446,7 +14447,7 @@ yy973:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14450 "ext/date/lib/parse_date.c"
#line 14451 "ext/date/lib/parse_date.c"
yy974:
YYDEBUG(974, *YYCURSOR);
yyaccept = 22;
@ -15455,7 +15456,7 @@ yy1065:
}
yy1067:
YYDEBUG(1067, *YYCURSOR);
#line 1174 "ext/date/lib/parse_date.re"
#line 1175 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@ -15477,7 +15478,7 @@ yy1067:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 15481 "ext/date/lib/parse_date.c"
#line 15482 "ext/date/lib/parse_date.c"
yy1068:
YYDEBUG(1068, *YYCURSOR);
yych = *++YYCURSOR;
@ -15569,7 +15570,7 @@ yy1074:
}
yy1075:
YYDEBUG(1075, *YYCURSOR);
#line 1220 "ext/date/lib/parse_date.re"
#line 1221 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@ -15588,7 +15589,7 @@ yy1075:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 15592 "ext/date/lib/parse_date.c"
#line 15593 "ext/date/lib/parse_date.c"
yy1076:
YYDEBUG(1076, *YYCURSOR);
yyaccept = 25;
@ -16486,7 +16487,7 @@ yy1116:
}
yy1117:
YYDEBUG(1117, *YYCURSOR);
#line 1604 "ext/date/lib/parse_date.re"
#line 1605 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -16502,7 +16503,7 @@ yy1117:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16506 "ext/date/lib/parse_date.c"
#line 16507 "ext/date/lib/parse_date.c"
yy1118:
YYDEBUG(1118, *YYCURSOR);
++YYCURSOR;
@ -16553,7 +16554,7 @@ yy1125:
YYDEBUG(1125, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1126, *YYCURSOR);
#line 1089 "ext/date/lib/parse_date.re"
#line 1090 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -16574,7 +16575,7 @@ yy1125:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 16578 "ext/date/lib/parse_date.c"
#line 16579 "ext/date/lib/parse_date.c"
yy1127:
YYDEBUG(1127, *YYCURSOR);
yyaccept = 26;
@ -16682,7 +16683,7 @@ yy1140:
}
yy1141:
YYDEBUG(1141, *YYCURSOR);
#line 1580 "ext/date/lib/parse_date.re"
#line 1581 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -16705,7 +16706,7 @@ yy1141:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16709 "ext/date/lib/parse_date.c"
#line 16710 "ext/date/lib/parse_date.c"
yy1142:
YYDEBUG(1142, *YYCURSOR);
yych = *++YYCURSOR;
@ -19128,7 +19129,7 @@ yy1291:
goto yy1295;
yy1292:
YYDEBUG(1292, *YYCURSOR);
#line 1066 "ext/date/lib/parse_date.re"
#line 1067 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@ -19150,7 +19151,7 @@ yy1292:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 19154 "ext/date/lib/parse_date.c"
#line 19155 "ext/date/lib/parse_date.c"
yy1293:
YYDEBUG(1293, *YYCURSOR);
yyaccept = 28;
@ -19386,7 +19387,7 @@ yy1310:
}
yy1311:
YYDEBUG(1311, *YYCURSOR);
#line 1049 "ext/date/lib/parse_date.re"
#line 1050 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@ -19402,7 +19403,7 @@ yy1311:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 19406 "ext/date/lib/parse_date.c"
#line 19407 "ext/date/lib/parse_date.c"
yy1312:
YYDEBUG(1312, *YYCURSOR);
yych = *++YYCURSOR;
@ -20735,7 +20736,7 @@ yy1383:
if (yych <= '9') goto yy1383;
yy1385:
YYDEBUG(1385, *YYCURSOR);
#line 1024 "ext/date/lib/parse_date.re"
#line 1025 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@ -20759,7 +20760,7 @@ yy1385:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20763 "ext/date/lib/parse_date.c"
#line 20764 "ext/date/lib/parse_date.c"
yy1386:
YYDEBUG(1386, *YYCURSOR);
yych = *++YYCURSOR;
@ -21195,7 +21196,7 @@ yy1414:
++YYCURSOR;
yy1415:
YYDEBUG(1415, *YYCURSOR);
#line 1012 "ext/date/lib/parse_date.re"
#line 1013 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@ -21206,7 +21207,7 @@ yy1415:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21210 "ext/date/lib/parse_date.c"
#line 21211 "ext/date/lib/parse_date.c"
yy1416:
YYDEBUG(1416, *YYCURSOR);
yych = *++YYCURSOR;
@ -21241,7 +21242,7 @@ yy1417:
}
yy1418:
YYDEBUG(1418, *YYCURSOR);
#line 1002 "ext/date/lib/parse_date.re"
#line 1003 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@ -21250,7 +21251,7 @@ yy1418:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21254 "ext/date/lib/parse_date.c"
#line 21255 "ext/date/lib/parse_date.c"
yy1419:
YYDEBUG(1419, *YYCURSOR);
yych = *++YYCURSOR;
@ -23074,7 +23075,7 @@ yy1497:
}
yy1498:
YYDEBUG(1498, *YYCURSOR);
#line 981 "ext/date/lib/parse_date.re"
#line 982 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@ -23082,7 +23083,7 @@ yy1498:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23086 "ext/date/lib/parse_date.c"
#line 23087 "ext/date/lib/parse_date.c"
yy1499:
YYDEBUG(1499, *YYCURSOR);
yych = *++YYCURSOR;
@ -23221,7 +23222,7 @@ yy1505:
}
yy1506:
YYDEBUG(1506, *YYCURSOR);
#line 990 "ext/date/lib/parse_date.re"
#line 991 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@ -23232,7 +23233,7 @@ yy1506:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23236 "ext/date/lib/parse_date.c"
#line 23237 "ext/date/lib/parse_date.c"
yy1507:
YYDEBUG(1507, *YYCURSOR);
yyaccept = 0;
@ -23712,7 +23713,7 @@ yy1528:
++YYCURSOR;
yy1529:
YYDEBUG(1529, *YYCURSOR);
#line 969 "ext/date/lib/parse_date.re"
#line 970 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@ -23723,7 +23724,7 @@ yy1529:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23727 "ext/date/lib/parse_date.c"
#line 23728 "ext/date/lib/parse_date.c"
yy1530:
YYDEBUG(1530, *YYCURSOR);
yyaccept = 0;
@ -23869,7 +23870,7 @@ yy1535:
goto yy1529;
}
}
#line 1730 "ext/date/lib/parse_date.re"
#line 1731 "ext/date/lib/parse_date.re"
}

1
ext/date/lib/parse_date.re

@ -624,6 +624,7 @@ static void timelib_eat_spaces(char **ptr)
static void timelib_eat_until_separator(char **ptr)
{
++*ptr;
while (strchr(" \t.,:;/-0123456789", **ptr) == NULL) {
++*ptr;
}

51
ext/date/tests/date-parse-by-format001.phpt

@ -0,0 +1,51 @@
--TEST--
Test for date_parse_by_format()
--FILE--
<?php
$date = "06/08/04";
print_r( date_parse_from_format( '!m/d/y', $date ) );
print_r( date_parse_from_format( '!m*d*y', $date ) );
?>
--EXPECT--
Array
(
[year] => 2004
[month] => 6
[day] => 8
[hour] => 0
[minute] => 0
[second] => 0
[fraction] => 0
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] =>
)
Array
(
[year] => 2004
[month] => 6
[day] => 8
[hour] => 0
[minute] => 0
[second] => 0
[fraction] => 0
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] =>
)
Loading…
Cancel
Save