Skip to content

Commit b5e2564

Browse files
author
Derick Rethans
committed
- MFH: Fixed a bug with the YYYY-MM format not resetting the day correctly.
- MFH: Fixed a bug in the DateTime->modify() methods, it would not use the advanced relative time strings. - MFH: Fixed return values of all the modifying methods, they now properly return the object itself.
1 parent a041ddc commit b5e2564

File tree

6 files changed

+105
-67
lines changed

6 files changed

+105
-67
lines changed

ext/date/lib/parse_date.c

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Generated by re2c 0.13.5 on Wed Jul 23 21:45:26 2008 */
1+
/* Generated by re2c 0.13.5 on Wed Jul 30 13:39:05 2008 */
22
#line 1 "ext/date/lib/parse_date.re"
33
/*
44
+----------------------------------------------------------------------+
@@ -982,7 +982,7 @@ static int scan(Scanner *s)
982982
}
983983
yy3:
984984
YYDEBUG(3, *YYCURSOR);
985-
#line 1605 "ext/date/lib/parse_date.re"
985+
#line 1606 "ext/date/lib/parse_date.re"
986986
{
987987
int tz_not_found;
988988
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1306,7 +1306,7 @@ static int scan(Scanner *s)
13061306
if (yych <= '9') goto yy1343;
13071307
yy12:
13081308
YYDEBUG(12, *YYCURSOR);
1309-
#line 1700 "ext/date/lib/parse_date.re"
1309+
#line 1701 "ext/date/lib/parse_date.re"
13101310
{
13111311
add_error(s, "Unexpected character");
13121312
goto std;
@@ -2334,7 +2334,7 @@ static int scan(Scanner *s)
23342334
if (yych <= '9') goto yy52;
23352335
yy47:
23362336
YYDEBUG(47, *YYCURSOR);
2337-
#line 1689 "ext/date/lib/parse_date.re"
2337+
#line 1690 "ext/date/lib/parse_date.re"
23382338
{
23392339
goto std;
23402340
}
@@ -2347,7 +2347,7 @@ static int scan(Scanner *s)
23472347
YYDEBUG(49, *YYCURSOR);
23482348
++YYCURSOR;
23492349
YYDEBUG(50, *YYCURSOR);
2350-
#line 1694 "ext/date/lib/parse_date.re"
2350+
#line 1695 "ext/date/lib/parse_date.re"
23512351
{
23522352
s->pos = cursor; s->line++;
23532353
goto std;
@@ -2739,7 +2739,7 @@ static int scan(Scanner *s)
27392739
if (yych == 's') goto yy71;
27402740
yy70:
27412741
YYDEBUG(70, *YYCURSOR);
2742-
#line 1673 "ext/date/lib/parse_date.re"
2742+
#line 1674 "ext/date/lib/parse_date.re"
27432743
{
27442744
timelib_ull i;
27452745
DEBUG_OUTPUT("relative");
@@ -3507,7 +3507,7 @@ static int scan(Scanner *s)
35073507
}
35083508
yy165:
35093509
YYDEBUG(165, *YYCURSOR);
3510-
#line 1536 "ext/date/lib/parse_date.re"
3510+
#line 1537 "ext/date/lib/parse_date.re"
35113511
{
35123512
const timelib_relunit* relunit;
35133513
DEBUG_OUTPUT("daytext");
@@ -4001,7 +4001,7 @@ static int scan(Scanner *s)
40014001
}
40024002
yy192:
40034003
YYDEBUG(192, *YYCURSOR);
4004-
#line 1595 "ext/date/lib/parse_date.re"
4004+
#line 1596 "ext/date/lib/parse_date.re"
40054005
{
40064006
DEBUG_OUTPUT("monthtext");
40074007
TIMELIB_INIT;
@@ -4061,7 +4061,7 @@ static int scan(Scanner *s)
40614061
}
40624062
yy197:
40634063
YYDEBUG(197, *YYCURSOR);
4064-
#line 1345 "ext/date/lib/parse_date.re"
4064+
#line 1346 "ext/date/lib/parse_date.re"
40654065
{
40664066
DEBUG_OUTPUT("datetextual | datenoyear");
40674067
TIMELIB_INIT;
@@ -4342,7 +4342,7 @@ static int scan(Scanner *s)
43424342
}
43434343
yy221:
43444344
YYDEBUG(221, *YYCURSOR);
4345-
#line 1643 "ext/date/lib/parse_date.re"
4345+
#line 1644 "ext/date/lib/parse_date.re"
43464346
{
43474347
int tz_not_found;
43484348
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -5048,7 +5048,7 @@ static int scan(Scanner *s)
50485048
YYDEBUG(277, *YYCURSOR);
50495049
++YYCURSOR;
50505050
YYDEBUG(278, *YYCURSOR);
5051-
#line 1619 "ext/date/lib/parse_date.re"
5051+
#line 1620 "ext/date/lib/parse_date.re"
50525052
{
50535053
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
50545054
TIMELIB_INIT;
@@ -5244,7 +5244,7 @@ static int scan(Scanner *s)
52445244
++YYCURSOR;
52455245
yy294:
52465246
YYDEBUG(294, *YYCURSOR);
5247-
#line 1319 "ext/date/lib/parse_date.re"
5247+
#line 1320 "ext/date/lib/parse_date.re"
52485248
{
52495249
DEBUG_OUTPUT("datenoday");
52505250
TIMELIB_INIT;
@@ -6466,7 +6466,7 @@ static int scan(Scanner *s)
64666466
if (yych <= '9') goto yy364;
64676467
yy363:
64686468
YYDEBUG(363, *YYCURSOR);
6469-
#line 1459 "ext/date/lib/parse_date.re"
6469+
#line 1460 "ext/date/lib/parse_date.re"
64706470
{
64716471
DEBUG_OUTPUT("pgtextshort");
64726472
TIMELIB_INIT;
@@ -7062,7 +7062,7 @@ static int scan(Scanner *s)
70627062
}
70637063
yy390:
70647064
YYDEBUG(390, *YYCURSOR);
7065-
#line 1515 "ext/date/lib/parse_date.re"
7065+
#line 1516 "ext/date/lib/parse_date.re"
70667066
{
70677067
DEBUG_OUTPUT("ago");
70687068
TIMELIB_INIT;
@@ -9338,7 +9338,7 @@ static int scan(Scanner *s)
93389338
}
93399339
yy473:
93409340
YYDEBUG(473, *YYCURSOR);
9341-
#line 1358 "ext/date/lib/parse_date.re"
9341+
#line 1359 "ext/date/lib/parse_date.re"
93429342
{
93439343
DEBUG_OUTPUT("datenoyearrev");
93449344
TIMELIB_INIT;
@@ -9979,7 +9979,7 @@ static int scan(Scanner *s)
99799979
if (yych <= '9') goto yy538;
99809980
yy532:
99819981
YYDEBUG(532, *YYCURSOR);
9982-
#line 1280 "ext/date/lib/parse_date.re"
9982+
#line 1281 "ext/date/lib/parse_date.re"
99839983
{
99849984
DEBUG_OUTPUT("datefull");
99859985
TIMELIB_INIT;
@@ -10729,7 +10729,7 @@ static int scan(Scanner *s)
1072910729
YYDEBUG(603, *YYCURSOR);
1073010730
++YYCURSOR;
1073110731
YYDEBUG(604, *YYCURSOR);
10732-
#line 1294 "ext/date/lib/parse_date.re"
10732+
#line 1295 "ext/date/lib/parse_date.re"
1073310733
{
1073410734
DEBUG_OUTPUT("pointed date YYYY");
1073510735
TIMELIB_INIT;
@@ -10776,7 +10776,7 @@ static int scan(Scanner *s)
1077610776
if (yych <= '9') goto yy602;
1077710777
yy609:
1077810778
YYDEBUG(609, *YYCURSOR);
10779-
#line 1306 "ext/date/lib/parse_date.re"
10779+
#line 1307 "ext/date/lib/parse_date.re"
1078010780
{
1078110781
DEBUG_OUTPUT("pointed date YY");
1078210782
TIMELIB_INIT;
@@ -11429,7 +11429,7 @@ static int scan(Scanner *s)
1142911429
}
1143011430
yy654:
1143111431
YYDEBUG(654, *YYCURSOR);
11432-
#line 1267 "ext/date/lib/parse_date.re"
11432+
#line 1268 "ext/date/lib/parse_date.re"
1143311433
{
1143411434
DEBUG_OUTPUT("gnudateshort");
1143511435
TIMELIB_INIT;
@@ -11794,7 +11794,7 @@ static int scan(Scanner *s)
1179411794
if (yych <= ':') goto yy701;
1179511795
yy698:
1179611796
YYDEBUG(698, *YYCURSOR);
11797-
#line 1485 "ext/date/lib/parse_date.re"
11797+
#line 1486 "ext/date/lib/parse_date.re"
1179811798
{
1179911799
int tz_not_found;
1180011800
DEBUG_OUTPUT("clf");
@@ -12417,7 +12417,7 @@ static int scan(Scanner *s)
1241712417
YYDEBUG(768, *YYCURSOR);
1241812418
++YYCURSOR;
1241912419
YYDEBUG(769, *YYCURSOR);
12420-
#line 1472 "ext/date/lib/parse_date.re"
12420+
#line 1473 "ext/date/lib/parse_date.re"
1242112421
{
1242212422
DEBUG_OUTPUT("pgtextreverse");
1242312423
TIMELIB_INIT;
@@ -12567,7 +12567,7 @@ static int scan(Scanner *s)
1256712567
}
1256812568
yy781:
1256912569
YYDEBUG(781, *YYCURSOR);
12570-
#line 1506 "ext/date/lib/parse_date.re"
12570+
#line 1507 "ext/date/lib/parse_date.re"
1257112571
{
1257212572
DEBUG_OUTPUT("year4");
1257312573
TIMELIB_INIT;
@@ -12726,7 +12726,7 @@ static int scan(Scanner *s)
1272612726
}
1272712727
yy791:
1272812728
YYDEBUG(791, *YYCURSOR);
12729-
#line 1332 "ext/date/lib/parse_date.re"
12729+
#line 1333 "ext/date/lib/parse_date.re"
1273012730
{
1273112731
DEBUG_OUTPUT("datenodayrev");
1273212732
TIMELIB_INIT;
@@ -12953,7 +12953,7 @@ static int scan(Scanner *s)
1295312953
if (yych <= '7') goto yy814;
1295412954
yy812:
1295512955
YYDEBUG(812, *YYCURSOR);
12956-
#line 1440 "ext/date/lib/parse_date.re"
12956+
#line 1441 "ext/date/lib/parse_date.re"
1295712957
{
1295812958
timelib_sll w, d;
1295912959
DEBUG_OUTPUT("isoweek");
@@ -12981,7 +12981,7 @@ static int scan(Scanner *s)
1298112981
YYDEBUG(814, *YYCURSOR);
1298212982
++YYCURSOR;
1298312983
YYDEBUG(815, *YYCURSOR);
12984-
#line 1421 "ext/date/lib/parse_date.re"
12984+
#line 1422 "ext/date/lib/parse_date.re"
1298512985
{
1298612986
timelib_sll w, d;
1298712987
DEBUG_OUTPUT("isoweekday");
@@ -13063,7 +13063,7 @@ static int scan(Scanner *s)
1306313063
}
1306413064
yy819:
1306513065
YYDEBUG(819, *YYCURSOR);
13066-
#line 1408 "ext/date/lib/parse_date.re"
13066+
#line 1409 "ext/date/lib/parse_date.re"
1306713067
{
1306813068
DEBUG_OUTPUT("pgydotd");
1306913069
TIMELIB_INIT;
@@ -13178,7 +13178,7 @@ static int scan(Scanner *s)
1317813178
++YYCURSOR;
1317913179
yy840:
1318013180
YYDEBUG(840, *YYCURSOR);
13181-
#line 1382 "ext/date/lib/parse_date.re"
13181+
#line 1383 "ext/date/lib/parse_date.re"
1318213182
{
1318313183
int tz_not_found;
1318413184
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13465,7 +13465,7 @@ static int scan(Scanner *s)
1346513465
}
1346613466
yy846:
1346713467
YYDEBUG(846, *YYCURSOR);
13468-
#line 1370 "ext/date/lib/parse_date.re"
13468+
#line 1371 "ext/date/lib/parse_date.re"
1346913469
{
1347013470
DEBUG_OUTPUT("datenocolon");
1347113471
TIMELIB_INIT;
@@ -14403,11 +14403,12 @@ static int scan(Scanner *s)
1440314403
TIMELIB_HAVE_DATE();
1440414404
s->time->y = timelib_get_nr((char **) &ptr, 4);
1440514405
s->time->m = timelib_get_nr((char **) &ptr, 2);
14406+
s->time->d = 1;
1440614407
TIMELIB_PROCESS_YEAR(s->time->y);
1440714408
TIMELIB_DEINIT;
1440814409
return TIMELIB_ISO_DATE;
1440914410
}
14410-
#line 14411 "ext/date/lib/parse_date.c"
14411+
#line 14412 "ext/date/lib/parse_date.c"
1441114412
yy972:
1441214413
YYDEBUG(972, *YYCURSOR);
1441314414
yyaccept = 22;
@@ -15438,7 +15439,7 @@ static int scan(Scanner *s)
1543815439
TIMELIB_DEINIT;
1543915440
return TIMELIB_GNU_NOCOLON;
1544015441
}
15441-
#line 15442 "ext/date/lib/parse_date.c"
15442+
#line 15443 "ext/date/lib/parse_date.c"
1544215443
yy1066:
1544315444
YYDEBUG(1066, *YYCURSOR);
1544415445
yych = *++YYCURSOR;
@@ -15549,7 +15550,7 @@ static int scan(Scanner *s)
1554915550
TIMELIB_DEINIT;
1555015551
return TIMELIB_ISO_NOCOLON;
1555115552
}
15552-
#line 15553 "ext/date/lib/parse_date.c"
15553+
#line 15554 "ext/date/lib/parse_date.c"
1555315554
yy1074:
1555415555
YYDEBUG(1074, *YYCURSOR);
1555515556
yyaccept = 25;
@@ -16447,7 +16448,7 @@ static int scan(Scanner *s)
1644716448
}
1644816449
yy1115:
1644916450
YYDEBUG(1115, *YYCURSOR);
16450-
#line 1578 "ext/date/lib/parse_date.re"
16451+
#line 1579 "ext/date/lib/parse_date.re"
1645116452
{
1645216453
timelib_sll i;
1645316454
int behavior = 0;
@@ -16463,7 +16464,7 @@ static int scan(Scanner *s)
1646316464
TIMELIB_DEINIT;
1646416465
return TIMELIB_RELATIVE;
1646516466
}
16466-
#line 16467 "ext/date/lib/parse_date.c"
16467+
#line 16468 "ext/date/lib/parse_date.c"
1646716468
yy1116:
1646816469
YYDEBUG(1116, *YYCURSOR);
1646916470
++YYCURSOR;
@@ -16535,7 +16536,7 @@ static int scan(Scanner *s)
1653516536
TIMELIB_DEINIT;
1653616537
return TIMELIB_WEEK_DAY_OF_MONTH;
1653716538
}
16538-
#line 16539 "ext/date/lib/parse_date.c"
16539+
#line 16540 "ext/date/lib/parse_date.c"
1653916540
yy1125:
1654016541
YYDEBUG(1125, *YYCURSOR);
1654116542
yyaccept = 26;
@@ -16643,7 +16644,7 @@ static int scan(Scanner *s)
1664316644
}
1664416645
yy1139:
1664516646
YYDEBUG(1139, *YYCURSOR);
16646-
#line 1554 "ext/date/lib/parse_date.re"
16647+
#line 1555 "ext/date/lib/parse_date.re"
1664716648
{
1664816649
timelib_sll i;
1664916650
int behavior = 0;
@@ -16666,7 +16667,7 @@ static int scan(Scanner *s)
1666616667
TIMELIB_DEINIT;
1666716668
return TIMELIB_RELATIVE;
1666816669
}
16669-
#line 16670 "ext/date/lib/parse_date.c"
16670+
#line 16671 "ext/date/lib/parse_date.c"
1667016671
yy1140:
1667116672
YYDEBUG(1140, *YYCURSOR);
1667216673
yych = *++YYCURSOR;
@@ -19106,7 +19107,7 @@ static int scan(Scanner *s)
1910619107
TIMELIB_DEINIT;
1910719108
return TIMELIB_LF_DAY_OF_MONTH;
1910819109
}
19109-
#line 19110 "ext/date/lib/parse_date.c"
19110+
#line 19111 "ext/date/lib/parse_date.c"
1911019111
yy1290:
1911119112
YYDEBUG(1290, *YYCURSOR);
1911219113
yych = *++YYCURSOR;
@@ -20216,7 +20217,7 @@ static int scan(Scanner *s)
2021620217
TIMELIB_DEINIT;
2021720218
return TIMELIB_RELATIVE;
2021820219
}
20219-
#line 20220 "ext/date/lib/parse_date.c"
20220+
#line 20221 "ext/date/lib/parse_date.c"
2022020221
yy1346:
2022120222
YYDEBUG(1346, *YYCURSOR);
2022220223
yych = *++YYCURSOR;
@@ -20663,7 +20664,7 @@ static int scan(Scanner *s)
2066320664
TIMELIB_DEINIT;
2066420665
return TIMELIB_RELATIVE;
2066520666
}
20666-
#line 20667 "ext/date/lib/parse_date.c"
20667+
#line 20668 "ext/date/lib/parse_date.c"
2066720668
yy1376:
2066820669
YYDEBUG(1376, *YYCURSOR);
2066920670
yych = *++YYCURSOR;
@@ -20707,7 +20708,7 @@ static int scan(Scanner *s)
2070720708
TIMELIB_DEINIT;
2070820709
return TIMELIB_RELATIVE;
2070920710
}
20710-
#line 20711 "ext/date/lib/parse_date.c"
20711+
#line 20712 "ext/date/lib/parse_date.c"
2071120712
yy1379:
2071220713
YYDEBUG(1379, *YYCURSOR);
2071320714
yych = *++YYCURSOR;
@@ -22539,7 +22540,7 @@ static int scan(Scanner *s)
2253922540
TIMELIB_DEINIT;
2254022541
return TIMELIB_RELATIVE;
2254122542
}
22542-
#line 22543 "ext/date/lib/parse_date.c"
22543+
#line 22544 "ext/date/lib/parse_date.c"
2254322544
yy1459:
2254422545
YYDEBUG(1459, *YYCURSOR);
2254522546
yych = *++YYCURSOR;
@@ -22689,7 +22690,7 @@ static int scan(Scanner *s)
2268922690
TIMELIB_DEINIT;
2269022691
return TIMELIB_RELATIVE;
2269122692
}
22692-
#line 22693 "ext/date/lib/parse_date.c"
22693+
#line 22694 "ext/date/lib/parse_date.c"
2269322694
yy1467:
2269422695
YYDEBUG(1467, *YYCURSOR);
2269522696
yyaccept = 0;
@@ -23180,7 +23181,7 @@ static int scan(Scanner *s)
2318023181
TIMELIB_DEINIT;
2318123182
return TIMELIB_RELATIVE;
2318223183
}
23183-
#line 23184 "ext/date/lib/parse_date.c"
23184+
#line 23185 "ext/date/lib/parse_date.c"
2318423185
yy1490:
2318523186
YYDEBUG(1490, *YYCURSOR);
2318623187
yyaccept = 0;
@@ -23326,7 +23327,7 @@ static int scan(Scanner *s)
2332623327
goto yy1489;
2332723328
}
2332823329
}
23329-
#line 1704 "ext/date/lib/parse_date.re"
23330+
#line 1705 "ext/date/lib/parse_date.re"
2333023331

2333123332
}
2333223333

0 commit comments

Comments
 (0)