Skip to content

Commit

Permalink
- Fixed a bug with the YYYY-MM format not resetting the day correctly.
Browse files Browse the repository at this point in the history
- Fixed a bug in the DateTime->modify() methods, it would not use the advanced
  relative time strings.
- Fixed return values of all the modifying methods, they now properly return
  the object itself.
  • Loading branch information
Derick Rethans committed Jul 30, 2008
1 parent 664bb14 commit 0ae51b1
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 67 deletions.
89 changes: 45 additions & 44 deletions ext/date/lib/parse_date.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Wed Jul 23 21:49:54 2008 */
/* Generated by re2c 0.13.5 on Wed Jul 30 19:25:10 2008 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
Expand Down Expand Up @@ -982,7 +982,7 @@ static int scan(Scanner *s)
}
yy3:
YYDEBUG(3, *YYCURSOR);
#line 1605 "ext/date/lib/parse_date.re"
#line 1606 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
Expand Down Expand Up @@ -1306,7 +1306,7 @@ static int scan(Scanner *s)
if (yych <= '9') goto yy1343;
yy12:
YYDEBUG(12, *YYCURSOR);
#line 1700 "ext/date/lib/parse_date.re"
#line 1701 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
Expand Down Expand Up @@ -2334,7 +2334,7 @@ static int scan(Scanner *s)
if (yych <= '9') goto yy52;
yy47:
YYDEBUG(47, *YYCURSOR);
#line 1689 "ext/date/lib/parse_date.re"
#line 1690 "ext/date/lib/parse_date.re"
{
goto std;
}
Expand All @@ -2347,7 +2347,7 @@ static int scan(Scanner *s)
YYDEBUG(49, *YYCURSOR);
++YYCURSOR;
YYDEBUG(50, *YYCURSOR);
#line 1694 "ext/date/lib/parse_date.re"
#line 1695 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
Expand Down Expand Up @@ -2739,7 +2739,7 @@ static int scan(Scanner *s)
if (yych == 's') goto yy71;
yy70:
YYDEBUG(70, *YYCURSOR);
#line 1673 "ext/date/lib/parse_date.re"
#line 1674 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
Expand Down Expand Up @@ -3507,7 +3507,7 @@ static int scan(Scanner *s)
}
yy165:
YYDEBUG(165, *YYCURSOR);
#line 1536 "ext/date/lib/parse_date.re"
#line 1537 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
Expand Down Expand Up @@ -4001,7 +4001,7 @@ static int scan(Scanner *s)
}
yy192:
YYDEBUG(192, *YYCURSOR);
#line 1595 "ext/date/lib/parse_date.re"
#line 1596 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
Expand Down Expand Up @@ -4061,7 +4061,7 @@ static int scan(Scanner *s)
}
yy197:
YYDEBUG(197, *YYCURSOR);
#line 1345 "ext/date/lib/parse_date.re"
#line 1346 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datetextual | datenoyear");
TIMELIB_INIT;
Expand Down Expand Up @@ -4342,7 +4342,7 @@ static int scan(Scanner *s)
}
yy221:
YYDEBUG(221, *YYCURSOR);
#line 1643 "ext/date/lib/parse_date.re"
#line 1644 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
Expand Down Expand Up @@ -5048,7 +5048,7 @@ static int scan(Scanner *s)
YYDEBUG(277, *YYCURSOR);
++YYCURSOR;
YYDEBUG(278, *YYCURSOR);
#line 1619 "ext/date/lib/parse_date.re"
#line 1620 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
Expand Down Expand Up @@ -5244,7 +5244,7 @@ static int scan(Scanner *s)
++YYCURSOR;
yy294:
YYDEBUG(294, *YYCURSOR);
#line 1319 "ext/date/lib/parse_date.re"
#line 1320 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoday");
TIMELIB_INIT;
Expand Down Expand Up @@ -6466,7 +6466,7 @@ static int scan(Scanner *s)
if (yych <= '9') goto yy364;
yy363:
YYDEBUG(363, *YYCURSOR);
#line 1459 "ext/date/lib/parse_date.re"
#line 1460 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pgtextshort");
TIMELIB_INIT;
Expand Down Expand Up @@ -7062,7 +7062,7 @@ static int scan(Scanner *s)
}
yy390:
YYDEBUG(390, *YYCURSOR);
#line 1515 "ext/date/lib/parse_date.re"
#line 1516 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
Expand Down Expand Up @@ -9338,7 +9338,7 @@ static int scan(Scanner *s)
}
yy473:
YYDEBUG(473, *YYCURSOR);
#line 1358 "ext/date/lib/parse_date.re"
#line 1359 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
Expand Down Expand Up @@ -9979,7 +9979,7 @@ static int scan(Scanner *s)
if (yych <= '9') goto yy538;
yy532:
YYDEBUG(532, *YYCURSOR);
#line 1280 "ext/date/lib/parse_date.re"
#line 1281 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datefull");
TIMELIB_INIT;
Expand Down Expand Up @@ -10729,7 +10729,7 @@ static int scan(Scanner *s)
YYDEBUG(603, *YYCURSOR);
++YYCURSOR;
YYDEBUG(604, *YYCURSOR);
#line 1294 "ext/date/lib/parse_date.re"
#line 1295 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
Expand Down Expand Up @@ -10776,7 +10776,7 @@ static int scan(Scanner *s)
if (yych <= '9') goto yy602;
yy609:
YYDEBUG(609, *YYCURSOR);
#line 1306 "ext/date/lib/parse_date.re"
#line 1307 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YY");
TIMELIB_INIT;
Expand Down Expand Up @@ -11429,7 +11429,7 @@ static int scan(Scanner *s)
}
yy654:
YYDEBUG(654, *YYCURSOR);
#line 1267 "ext/date/lib/parse_date.re"
#line 1268 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnudateshort");
TIMELIB_INIT;
Expand Down Expand Up @@ -11794,7 +11794,7 @@ static int scan(Scanner *s)
if (yych <= ':') goto yy701;
yy698:
YYDEBUG(698, *YYCURSOR);
#line 1485 "ext/date/lib/parse_date.re"
#line 1486 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
Expand Down Expand Up @@ -12417,7 +12417,7 @@ static int scan(Scanner *s)
YYDEBUG(768, *YYCURSOR);
++YYCURSOR;
YYDEBUG(769, *YYCURSOR);
#line 1472 "ext/date/lib/parse_date.re"
#line 1473 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pgtextreverse");
TIMELIB_INIT;
Expand Down Expand Up @@ -12567,7 +12567,7 @@ static int scan(Scanner *s)
}
yy781:
YYDEBUG(781, *YYCURSOR);
#line 1506 "ext/date/lib/parse_date.re"
#line 1507 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
Expand Down Expand Up @@ -12726,7 +12726,7 @@ static int scan(Scanner *s)
}
yy791:
YYDEBUG(791, *YYCURSOR);
#line 1332 "ext/date/lib/parse_date.re"
#line 1333 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenodayrev");
TIMELIB_INIT;
Expand Down Expand Up @@ -12953,7 +12953,7 @@ static int scan(Scanner *s)
if (yych <= '7') goto yy814;
yy812:
YYDEBUG(812, *YYCURSOR);
#line 1440 "ext/date/lib/parse_date.re"
#line 1441 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
Expand Down Expand Up @@ -12981,7 +12981,7 @@ static int scan(Scanner *s)
YYDEBUG(814, *YYCURSOR);
++YYCURSOR;
YYDEBUG(815, *YYCURSOR);
#line 1421 "ext/date/lib/parse_date.re"
#line 1422 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
Expand Down Expand Up @@ -13063,7 +13063,7 @@ static int scan(Scanner *s)
}
yy819:
YYDEBUG(819, *YYCURSOR);
#line 1408 "ext/date/lib/parse_date.re"
#line 1409 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pgydotd");
TIMELIB_INIT;
Expand Down Expand Up @@ -13178,7 +13178,7 @@ static int scan(Scanner *s)
++YYCURSOR;
yy840:
YYDEBUG(840, *YYCURSOR);
#line 1382 "ext/date/lib/parse_date.re"
#line 1383 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
Expand Down Expand Up @@ -13465,7 +13465,7 @@ static int scan(Scanner *s)
}
yy846:
YYDEBUG(846, *YYCURSOR);
#line 1370 "ext/date/lib/parse_date.re"
#line 1371 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
Expand Down Expand Up @@ -14403,11 +14403,12 @@ static int scan(Scanner *s)
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
s->time->m = timelib_get_nr((char **) &ptr, 2);
s->time->d = 1;
TIMELIB_PROCESS_YEAR(s->time->y);
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14411 "ext/date/lib/parse_date.c"
#line 14412 "ext/date/lib/parse_date.c"
yy972:
YYDEBUG(972, *YYCURSOR);
yyaccept = 22;
Expand Down Expand Up @@ -15438,7 +15439,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 15442 "ext/date/lib/parse_date.c"
#line 15443 "ext/date/lib/parse_date.c"
yy1066:
YYDEBUG(1066, *YYCURSOR);
yych = *++YYCURSOR;
Expand Down Expand Up @@ -15549,7 +15550,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 15553 "ext/date/lib/parse_date.c"
#line 15554 "ext/date/lib/parse_date.c"
yy1074:
YYDEBUG(1074, *YYCURSOR);
yyaccept = 25;
Expand Down Expand Up @@ -16447,7 +16448,7 @@ static int scan(Scanner *s)
}
yy1115:
YYDEBUG(1115, *YYCURSOR);
#line 1578 "ext/date/lib/parse_date.re"
#line 1579 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
Expand All @@ -16463,7 +16464,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16467 "ext/date/lib/parse_date.c"
#line 16468 "ext/date/lib/parse_date.c"
yy1116:
YYDEBUG(1116, *YYCURSOR);
++YYCURSOR;
Expand Down Expand Up @@ -16535,7 +16536,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 16539 "ext/date/lib/parse_date.c"
#line 16540 "ext/date/lib/parse_date.c"
yy1125:
YYDEBUG(1125, *YYCURSOR);
yyaccept = 26;
Expand Down Expand Up @@ -16643,7 +16644,7 @@ static int scan(Scanner *s)
}
yy1139:
YYDEBUG(1139, *YYCURSOR);
#line 1554 "ext/date/lib/parse_date.re"
#line 1555 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
Expand All @@ -16666,7 +16667,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16670 "ext/date/lib/parse_date.c"
#line 16671 "ext/date/lib/parse_date.c"
yy1140:
YYDEBUG(1140, *YYCURSOR);
yych = *++YYCURSOR;
Expand Down Expand Up @@ -19106,7 +19107,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 19110 "ext/date/lib/parse_date.c"
#line 19111 "ext/date/lib/parse_date.c"
yy1290:
YYDEBUG(1290, *YYCURSOR);
yych = *++YYCURSOR;
Expand Down Expand Up @@ -20216,7 +20217,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20220 "ext/date/lib/parse_date.c"
#line 20221 "ext/date/lib/parse_date.c"
yy1346:
YYDEBUG(1346, *YYCURSOR);
yych = *++YYCURSOR;
Expand Down Expand Up @@ -20663,7 +20664,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20667 "ext/date/lib/parse_date.c"
#line 20668 "ext/date/lib/parse_date.c"
yy1376:
YYDEBUG(1376, *YYCURSOR);
yych = *++YYCURSOR;
Expand Down Expand Up @@ -20707,7 +20708,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20711 "ext/date/lib/parse_date.c"
#line 20712 "ext/date/lib/parse_date.c"
yy1379:
YYDEBUG(1379, *YYCURSOR);
yych = *++YYCURSOR;
Expand Down Expand Up @@ -22539,7 +22540,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22543 "ext/date/lib/parse_date.c"
#line 22544 "ext/date/lib/parse_date.c"
yy1459:
YYDEBUG(1459, *YYCURSOR);
yych = *++YYCURSOR;
Expand Down Expand Up @@ -22689,7 +22690,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22693 "ext/date/lib/parse_date.c"
#line 22694 "ext/date/lib/parse_date.c"
yy1467:
YYDEBUG(1467, *YYCURSOR);
yyaccept = 0;
Expand Down Expand Up @@ -23180,7 +23181,7 @@ static int scan(Scanner *s)
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23184 "ext/date/lib/parse_date.c"
#line 23185 "ext/date/lib/parse_date.c"
yy1490:
YYDEBUG(1490, *YYCURSOR);
yyaccept = 0;
Expand Down Expand Up @@ -23326,7 +23327,7 @@ static int scan(Scanner *s)
goto yy1489;
}
}
#line 1704 "ext/date/lib/parse_date.re"
#line 1705 "ext/date/lib/parse_date.re"

}

Expand Down
Loading

0 comments on commit 0ae51b1

Please sign in to comment.