12 #define sizeof_array(o) (sizeof o / sizeof o[0])
14 #define f_negate(x) rb_funcall(x, rb_intern("-@"), 0)
15 #define f_add(x,y) rb_funcall(x, '+', 1, y)
16 #define f_sub(x,y) rb_funcall(x, '-', 1, y)
17 #define f_mul(x,y) rb_funcall(x, '*', 1, y)
18 #define f_div(x,y) rb_funcall(x, '/', 1, y)
19 #define f_idiv(x,y) rb_funcall(x, rb_intern("div"), 1, y)
20 #define f_mod(x,y) rb_funcall(x, '%', 1, y)
21 #define f_expt(x,y) rb_funcall(x, rb_intern("**"), 1, y)
23 #define f_lt_p(x,y) rb_funcall(x, '<', 1, y)
24 #define f_gt_p(x,y) rb_funcall(x, '>', 1, y)
25 #define f_le_p(x,y) rb_funcall(x, rb_intern("<="), 1, y)
26 #define f_ge_p(x,y) rb_funcall(x, rb_intern(">="), 1, y)
28 #define f_to_s(x) rb_funcall(x, rb_intern("to_s"), 0)
30 #define f_match(r,s) rb_funcall(r, rb_intern("match"), 1, s)
31 #define f_aref(o,i) rb_funcall(o, rb_intern("[]"), 1, i)
32 #define f_aref2(o,i,j) rb_funcall(o, rb_intern("[]"), 2, i, j)
33 #define f_begin(o,i) rb_funcall(o, rb_intern("begin"), 1, i)
34 #define f_end(o,i) rb_funcall(o, rb_intern("end"), 1, i)
35 #define f_aset(o,i,v) rb_funcall(o, rb_intern("[]="), 2, i, v)
36 #define f_aset2(o,i,j,v) rb_funcall(o, rb_intern("[]="), 3, i, j, v)
37 #define f_sub_bang(s,r,x) rb_funcall(s, rb_intern("sub!"), 2, r, x)
38 #define f_gsub_bang(s,r,x) rb_funcall(s, rb_intern("gsub!"), 2, r, x)
40 #define set_hash(k,v) rb_hash_aset(hash, ID2SYM(rb_intern(k)), v)
41 #define ref_hash(k) rb_hash_aref(hash, ID2SYM(rb_intern(k)))
42 #define del_hash(k) rb_hash_delete(hash, ID2SYM(rb_intern(k)))
44 #define cstr2num(s) rb_cstr_to_inum(s, 10, 0)
45 #define str2num(s) rb_str_to_inum(s, 10, 0)
48 "sun",
"mon",
"tue",
"wed",
53 "jan",
"feb",
"mar",
"apr",
"may",
"jun",
54 "jul",
"aug",
"sep",
"oct",
"nov",
"dec"
57 #define issign(c) ((c) == '-' || (c) == '+')
58 #define asp_string() rb_str_new(" ", 1)
60 #define asuba_string() rb_str_new("\001", 1)
61 #define asubb_string() rb_str_new("\002", 1)
62 #define asubw_string() rb_str_new("\027", 1)
63 #define asubt_string() rb_str_new("\024", 1)
66 #define DECDIGIT "0123456789"
98 const char *
s, *
bp, *ep;
102 while (!
issign((
unsigned char)*s) && !isdigit((
unsigned char)*s))
105 if (
issign((
unsigned char)*s))
145 const char *
s, *
bp, *ep;
151 while (!
issign((
unsigned char)*s) && !isdigit((
unsigned char)*s))
179 const char *
s, *
bp, *ep;
184 while (!isdigit((
unsigned char)*s))
201 const char *
s, *
bp, *ep;
206 while (!isdigit((
unsigned char)*s))
226 #define DAYS "sunday|monday|tuesday|wednesday|thursday|friday|saturday"
227 #define MONTHS "january|february|march|april|may|june|july|august|september|october|november|december"
228 #define ABBR_DAYS "sun|mon|tue|wed|thu|fri|sat"
229 #define ABBR_MONTHS "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec"
232 #define VALID_DAYS "(?:" DAYS ")" "|(?:tues|wednes|thurs|thur|" ABBR_DAYS ")\\.?"
233 #define VALID_MONTHS "(?:" MONTHS ")" "|(?:sept|" ABBR_MONTHS ")\\.?"
234 #define DOTLESS_VALID_MONTHS "(?:" MONTHS ")" "|(?:sept|" ABBR_MONTHS ")"
235 #define BOS "\\A\\s*"
240 #define FPW_COM "\\s*(?:" FPW "\\s*,?)?\\s*"
241 #define FPT_COM "\\s*(?:" FPT "\\s*,?)?\\s*"
242 #define COM_FPW "\\s*(?:,?\\s*" FPW ")?\\s*"
243 #define COM_FPT "\\s*(?:,?\\s*(?:@|\\b[aA][tT]\\b)?\\s*" FPT ")?\\s*"
244 #define TEE_FPT "\\s*(?:[tT]?" FPT ")?"
245 #define EOS "\\s*\\z"
258 #define REGCOMP(pat,opt) \
261 pat = regcomp(pat##_source, sizeof pat##_source - 1, opt); \
264 #define REGCOMP_0(pat) REGCOMP(pat, 0)
265 #define REGCOMP_I(pat) REGCOMP(pat, ONIG_OPTION_IGNORECASE)
267 #define MATCH(s,p,c) \
269 return match(s, p, hash, c); \
309 #define SUBS(s,p,c) \
311 return subx(s, asp_string(), p, hash, c); \
315 #define SUBA(s,p,c) \
317 return subx(s, asuba_string(), p, hash, c); \
320 #define SUBB(s,p,c) \
322 return subx(s, asubb_string(), p, hash, c); \
325 #define SUBW(s,p,c) \
327 return subx(s, asubw_string(), p, hash, c); \
330 #define SUBT(s,p,c) \
332 return subx(s, asubt_string(), p, hash, c); \
342 {
"ut", 0*3600}, {
"gmt", 0*3600}, {
"est", -5*3600}, {
"edt", -4*3600},
343 {
"cst", -6*3600}, {
"cdt", -5*3600}, {
"mst", -7*3600}, {
"mdt", -6*3600},
344 {
"pst", -8*3600}, {
"pdt", -7*3600},
345 {
"a", 1*3600}, {
"b", 2*3600}, {
"c", 3*3600}, {
"d", 4*3600},
346 {
"e", 5*3600}, {
"f", 6*3600}, {
"g", 7*3600}, {
"h", 8*3600},
347 {
"i", 9*3600}, {
"k", 10*3600}, {
"l", 11*3600}, {
"m", 12*3600},
348 {
"n", -1*3600}, {
"o", -2*3600}, {
"p", -3*3600}, {
"q", -4*3600},
349 {
"r", -5*3600}, {
"s", -6*3600}, {
"t", -7*3600}, {
"u", -8*3600},
350 {
"v", -9*3600}, {
"w", -10*3600}, {
"x", -11*3600}, {
"y", -12*3600},
353 {
"utc", 0*3600}, {
"wet", 0*3600},
354 {
"at", -2*3600}, {
"brst",-2*3600}, {
"ndt", -(2*3600+1800)},
355 {
"art", -3*3600}, {
"adt", -3*3600}, {
"brt", -3*3600}, {
"clst",-3*3600},
356 {
"nst", -(3*3600+1800)},
357 {
"ast", -4*3600}, {
"clt", -4*3600},
358 {
"akdt",-8*3600}, {
"ydt", -8*3600},
359 {
"akst",-9*3600}, {
"hadt",-9*3600}, {
"hdt", -9*3600}, {
"yst", -9*3600},
360 {
"ahst",-10*3600},{
"cat",-10*3600}, {
"hast",-10*3600},{
"hst",-10*3600},
363 {
"bst", 1*3600}, {
"cet", 1*3600}, {
"fwt", 1*3600}, {
"met", 1*3600},
364 {
"mewt", 1*3600}, {
"mez", 1*3600}, {
"swt", 1*3600}, {
"wat", 1*3600},
366 {
"cest", 2*3600}, {
"eet", 2*3600}, {
"fst", 2*3600}, {
"mest", 2*3600},
367 {
"mesz", 2*3600}, {
"sast", 2*3600}, {
"sst", 2*3600},
368 {
"bt", 3*3600}, {
"eat", 3*3600}, {
"eest", 3*3600}, {
"msk", 3*3600},
369 {
"msd", 4*3600}, {
"zp4", 4*3600},
370 {
"zp5", 5*3600}, {
"ist", (5*3600+1800)},
373 {
"cct", 8*3600}, {
"sgt", 8*3600}, {
"wadt", 8*3600},
374 {
"jst", 9*3600}, {
"kst", 9*3600},
375 {
"east",10*3600}, {
"gst", 10*3600},
377 {
"idle",12*3600}, {
"nzst",12*3600}, {
"nzt", 12*3600},
380 {
"afghanistan", 16200}, {
"alaskan", -32400},
381 {
"arab", 10800}, {
"arabian", 14400},
382 {
"arabic", 10800}, {
"atlantic", -14400},
383 {
"aus central", 34200}, {
"aus eastern", 36000},
384 {
"azores", -3600}, {
"canada central", -21600},
385 {
"cape verde", -3600}, {
"caucasus", 14400},
386 {
"cen. australia", 34200}, {
"central america", -21600},
387 {
"central asia", 21600}, {
"central europe", 3600},
388 {
"central european", 3600}, {
"central pacific", 39600},
389 {
"central", -21600}, {
"china", 28800},
390 {
"dateline", -43200}, {
"e. africa", 10800},
391 {
"e. australia", 36000}, {
"e. europe", 7200},
392 {
"e. south america", -10800}, {
"eastern", -18000},
393 {
"egypt", 7200}, {
"ekaterinburg", 18000},
394 {
"fiji", 43200}, {
"fle", 7200},
395 {
"greenland", -10800}, {
"greenwich", 0},
396 {
"gtb", 7200}, {
"hawaiian", -36000},
397 {
"india", 19800}, {
"iran", 12600},
398 {
"jerusalem", 7200}, {
"korea", 32400},
399 {
"mexico", -21600}, {
"mid-atlantic", -7200},
400 {
"mountain", -25200}, {
"myanmar", 23400},
401 {
"n. central asia", 21600}, {
"nepal", 20700},
402 {
"new zealand", 43200}, {
"newfoundland", -12600},
403 {
"north asia east", 28800}, {
"north asia", 25200},
404 {
"pacific sa", -14400}, {
"pacific", -28800},
405 {
"romance", 3600}, {
"russian", 10800},
406 {
"sa eastern", -10800}, {
"sa pacific", -18000},
407 {
"sa western", -14400}, {
"samoa", -39600},
408 {
"se asia", 25200}, {
"malay peninsula", 28800},
409 {
"south africa", 7200}, {
"sri lanka", 21600},
410 {
"taipei", 28800}, {
"tasmania", 36000},
411 {
"tokyo", 32400}, {
"tonga", 46800},
412 {
"us eastern", -18000}, {
"us mountain", -25200},
413 {
"vladivostok", 36000}, {
"w. australia", 28800},
414 {
"w. central africa", 3600}, {
"w. europe", 3600},
415 {
"west asia", 18000}, {
"west pacific", 36000},
433 for (i = 0; i < l; i++) {
434 if (isspace((
unsigned char)s[i]) || s[i] ==
'\0') {
440 if (isalpha((
unsigned char)s[i]))
441 *d++ = tolower((
unsigned char)s[i]);
454 #define STD " standard time"
455 #define DST " daylight time"
465 if (sl >= 0 && strcmp(ss,
STD) == 0) {
468 else if (dl >= 0 && strcmp(ds,
DST) == 0) {
482 if (dl >= 0 && strcmp(ds,
DST) == 0) {
503 offset =
f_aref(zones, str);
504 if (!
NIL_P(offset)) {
519 if (strncmp(s,
"gmt", 3) == 0 ||
520 strncmp(s,
"utc", 3) == 0)
550 b = strpbrk(a,
",.");
646 static const char pat_source[] =
709 static const char pat_source[] =
711 "(?:\\s*:?\\s*(\\d+)m?"
713 "\\s*:?\\s*(\\d+)(?:[,.](\\d+))?s?"
716 "(?:\\s*([ap])(?:m\\b|\\.m\\.))?";
742 static const char pat_source[] =
748 "\\s*:\\s*\\d+(?:[,.]\\d*)?"
750 "\\s*:\\s*\\d+(?:[,.]\\d+)?"
754 "\\d+\\s*h(?:\\s*\\d+m?(?:\\s*\\d+s?)?)?"
758 "[ap](?:m\\b|\\.m\\.)"
761 "\\d+\\s*[ap](?:m\\b|\\.m\\.)"
766 "(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?"
768 "(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\stime\\b"
770 "(?-i:[[:alpha:]]+)(?:\\sdst)?\\b"
793 static const char pat_source[] =
798 SUBA(str, pat, parse_era1_cb);
816 static const char pat_source[] =
817 "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|b(?:c|\\.c\\.))";
821 SUBB(str, pat, parse_era2_cb);
827 if (parse_era1(str, hash))
829 if (parse_era2(str, hash))
839 check_year_width(
VALUE y)
859 if (!check_year_width(a))
864 if (!check_year_width(b))
871 if (!check_year_width(c))
904 if (!check_apost(d, mon, y))
909 s3e(hash, y, mon, d, 0);
917 static const char pat_source[] =
923 "('?\\d+)[^-\\d\\s]*"
925 "(\\d+)(?:(?:st|nd|rd|th)\\b)?"
936 "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))?"
938 "('?-?\\d+(?:(?:st|nd|rd|th)\\b)?)"
944 "(?:" FPA
"|" FPB
")?"
982 if (!check_apost(mon, d, y))
987 s3e(hash, y, mon, d, 0);
995 static const char pat_source[] =
1000 #ifndef TIGHT_PARSER
1003 "\\b(" VALID_MONTHS
")"
1006 #ifndef TIGHT_PARSER
1007 "('?\\d+)[^-\\d\\s']*"
1009 "('?\\d+)(?:(?:st|nd|rd|th)\\b)?"
1015 #ifndef TIGHT_PARSER
1016 "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))?"
1024 "(?:" FPA
"|" FPB
")?"
1048 if (!check_apost(y, mon, d))
1052 s3e(hash, y, mon, d, 0);
1059 static const char pat_source[] =
1060 #ifndef TIGHT_PARSER
1061 "('?[-+]?\\d+)-(\\d+)-('?-?\\d+)"
1065 "([-+']?\\d+)-(\\d+)-([-']?\\d+)"
1097 static const char pat_source[] =
1098 #ifndef TIGHT_PARSER
1099 "\\b(\\d{2}|\\d{4})?-?w(\\d{2})(?:-?(\\d))?\\b"
1103 "(\\d{2}|\\d{4})?-?w(\\d{2})(?:-?(\\d))?"
1127 static const char pat_source[] =
1128 #ifndef TIGHT_PARSER
1162 static const char pat_source[] =
1163 #ifndef TIGHT_PARSER
1164 "--(\\d{2})?-(\\d{2})\\b"
1168 "--(\\d{2})?-(\\d{2})"
1197 static const char pat_source[] =
1198 #ifndef TIGHT_PARSER
1199 "--(\\d{2})(\\d{2})?\\b"
1203 "--(\\d{2})(\\d{2})?"
1231 static const char pat0_source[] =
1232 #ifndef TIGHT_PARSER
1233 "[,.](\\d{2}|\\d{4})-\\d{3}\\b"
1237 "[,.](\\d{2}|\\d{4})-\\d{3}"
1243 static const char pat_source[] =
1244 #ifndef TIGHT_PARSER
1245 "\\b(\\d{2}|\\d{4})-(\\d{3})\\b"
1249 "(\\d{2}|\\d{4})-(\\d{3})"
1277 static const char pat0_source[] =
1278 #ifndef TIGHT_PARSER
1289 static const char pat_source[] =
1290 #ifndef TIGHT_PARSER
1337 case 'M':
case 'm': e = 1867;
break;
1338 case 'T':
case 't': e = 1911;
break;
1339 case 'S':
case 's': e = 1925;
break;
1340 case 'H':
case 'h': e = 1988;
break;
1341 default: e = 0;
break;
1369 static const char pat_source[] =
1370 #ifndef TIGHT_PARSER
1371 "\\b([mtsh])(\\d+)\\.(\\d+)\\.(\\d+)"
1375 "([mtsh])(\\d+)\\.(\\d+)\\.(\\d+)"
1396 if (!check_apost(d, mon, y))
1402 s3e(hash, y, mon, d, 0);
1409 static const char pat_source[] =
1410 #ifndef TIGHT_PARSER
1416 "([-']?\\d+)-(" DOTLESS_VALID_MONTHS
")"
1438 if (!check_apost(mon, d, y))
1444 s3e(hash, y, mon, d, 0);
1451 static const char pat_source[] =
1452 #ifndef TIGHT_PARSER
1454 "-('?-?\\d+)(?:-('?-?\\d+))?"
1458 "(" DOTLESS_VALID_MONTHS
")"
1459 "-([-']?\\d+)(?:-([-']?\\d+))?"
1493 if (!check_apost(y, mon, d))
1497 s3e(hash, y, mon, d, 0);
1504 static const char pat_source[] =
1505 #ifndef TIGHT_PARSER
1506 "('?-?\\d+)/\\s*('?\\d+)(?:\\D\\s*('?-?\\d+))?"
1510 "([-']?\\d+)/\\s*('?\\d+)(?:(?:[-/]|\\s+)\\s*([-']?\\d+))?"
1531 if (!check_apost(d, mon, y))
1536 s3e(hash, y, mon, d, 0);
1543 static const char pat_source[] =
1546 "([-']?\\d+)/\\s*(" DOTLESS_VALID_MONTHS
")(?:(?:[-/]|\\s+)\\s*([-']?\\d+))?"
1553 SUBS(str, pat, parse_sla2_cb);
1565 if (!check_apost(mon, d, y))
1570 s3e(hash, y, mon, d, 0);
1577 static const char pat_source[] =
1580 "(" DOTLESS_VALID_MONTHS
")/\\s*([-']?\\d+)(?:(?:[-/]|\\s+)\\s*([-']?\\d+))?"
1587 SUBS(str, pat, parse_sla3_cb);
1601 if (!check_apost(y, mon, d))
1605 s3e(hash, y, mon, d, 0);
1612 static const char pat_source[] =
1613 #ifndef TIGHT_PARSER
1614 "('?-?\\d+)\\.\\s*('?\\d+)\\.\\s*('?-?\\d+)"
1618 "([-']?\\d+)\\.\\s*(\\d+)\\.\\s*([-']?\\d+)"
1639 if (!check_apost(d, mon, y))
1644 s3e(hash, y, mon, d, 0);
1651 static const char pat_source[] =
1654 "([-']?\\d+)\\.\\s*(" DOTLESS_VALID_MONTHS
")(?:(?:[./])\\s*([-']?\\d+))?"
1661 SUBS(str, pat, parse_dot2_cb);
1673 if (!check_apost(mon, d, y))
1678 s3e(hash, y, mon, d, 0);
1685 static const char pat_source[] =
1688 "(" DOTLESS_VALID_MONTHS
")\\.\\s*([-']?\\d+)(?:(?:[./])\\s*([-']?\\d+))?"
1695 SUBS(str, pat, parse_dot3_cb);
1712 static const char pat_source[] =
1713 #ifndef TIGHT_PARSER
1742 static const char pat_source[] =
1743 #ifndef TIGHT_PARSER
1748 "(" VALID_MONTHS
")"
1772 static const char pat_source[] =
1773 #ifndef TIGHT_PARSER
1774 "(\\d+)(st|nd|rd|th)\\b"
1778 "(\\d+)(st|nd|rd|th)"
1790 n2i(
const char *s,
long f,
long w)
1797 for (i = f; i <
e; i++) {
1807 VALUE s1, s2, s3, s4, s5;
1808 const char *cs2, *cs3, *cs5;
1809 long l2, l3, l4, l5;
1844 int y =
n2i(cs2, 0, 2);
1864 int y =
n2i(cs2, l2-12, 2);
1870 int y =
n2i(cs2, l2-14, 4);
1878 int y =
n2i(cs2, 0, 4);
1908 int y =
n2i(cs2, 0, 2);
1923 int y =
n2i(cs2, 0, 4);
1997 if (isdigit((
unsigned char)*s1))
2010 static const char pat_source[] =
2014 "([-+]?)(\\d{2,14})"
2019 "(\\d{2,6})?(?:[,.](\\d*))?"
2028 "\\[[-+]?\\d[^\\]]*\\]"
2041 #ifndef TIGHT_PARSER
2052 static const char pat_source[] =
2053 "\\b(bc\\b|bce\\b|b\\.c\\.|b\\.c\\.e\\.)";
2086 static const char pat_source[] =
"\\A\\s*(\\d{1,2})\\s*\\z";
2104 static const char pat_source[] =
"\\A\\s*" FPW
"\\s*\\z";
2108 SUBS(str, pat, parse_dummy_cb);
2114 static const char pat_source[] =
"\\A\\s*" FPT "\\s*\\z";
2118 SUBS(str, pat, parse_dummy_cb);
2124 static const char pat_source[] =
"\\A\\s*(" FPW
"\\s+" FPT "|" FPT "\\s+" FPW
")\\s*\\z";
2128 SUBS(str, pat, parse_dummy_cb);
2132 have_invalid_char_p(
VALUE s)
2144 #define HAVE_ALPHA (1<<0)
2145 #define HAVE_DIGIT (1<<1)
2146 #define HAVE_DASH (1<<2)
2147 #define HAVE_DOT (1<<3)
2148 #define HAVE_SLASH (1<<4)
2172 #define HAVE_ELEM_P(x) ((check_class(str) & (x)) == (x))
2175 #define PARSER_ERROR return rb_hash_new()
2184 if (have_invalid_char_p(str))
2192 static const char pat_source[] =
2193 #ifndef TIGHT_PARSER
2194 "[^-+',./:@[:alnum:]\\[\\]]+"
2216 parse_era(str, hash);
2239 if (parse_sla2(str, hash))
2241 if (parse_sla3(str, hash))
2250 if (parse_dot2(str, hash))
2252 if (parse_dot3(str, hash))
2273 if (parse_wday_only(str, hash))
2275 if (parse_time_only(str, hash))
2277 if (parse_wday_and_time(str, hash))
2284 #ifndef TIGHT_PARSER
2378 for (i = 1; i <=
SNUM; i++)
2397 else if (!
NIL_P(s[5])) {
2406 else if (!
NIL_P(s[8])) {
2416 else if (!
NIL_P(s[9])) {
2419 if (!
NIL_P(s[10])) {
2425 if (!
NIL_P(s[13])) {
2428 if (!
NIL_P(s[14])) {
2439 static const char pat_source[] =
2440 "\\A\\s*(?:([-+]?\\d{2,}|-)-(\\d{2})?-(\\d{2})|"
2441 "([-+]?\\d{2,})?-(\\d{3})|"
2442 "(\\d{4}|\\d{2})?-w(\\d{2})-(\\d)|"
2445 "(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d+))?)?"
2446 "(z|[-+]\\d{2}(?::?\\d{2})?)?)?\\s*\\z";
2464 for (i = 1; i <=
SNUM; i++)
2483 else if (!
NIL_P(s[5])) {
2490 else if (!
NIL_P(s[6])) {
2493 else if (!
NIL_P(s[9])) {
2501 else if (!
NIL_P(s[11])) {
2505 else if (!
NIL_P(s[12])) {
2508 if (!
NIL_P(s[13])) {
2514 if (!
NIL_P(s[16])) {
2517 if (!
NIL_P(s[17])) {
2528 static const char pat_source[] =
2529 "\\A\\s*(?:([-+]?(?:\\d{4}|\\d{2})|--)(\\d{2}|-)(\\d{2})|"
2530 "([-+]?(?:\\d{4}|\\d{2}))(\\d{3})|"
2532 "(\\d{4}|\\d{2})w(\\d{2})(\\d)|"
2536 "(\\d{2})(\\d{2})(?:(\\d{2})(?:[,.](\\d+))?)?"
2537 "(z|[-+]\\d{2}(?:\\d{2})?)?)?\\s*\\z";
2555 for (i = 1; i <=
SNUM; i++)
2573 #define iso8601_bas_time_cb iso8601_ext_time_cb
2578 static const char pat_source[] =
2579 "\\A\\s*(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d+))?"
2580 "(z|[-+]\\d{2}(:?\\d{2})?)?)?\\s*\\z";
2590 static const char pat_source[] =
2591 "\\A\\s*(\\d{2})(\\d{2})(?:(\\d{2})(?:[,.](\\d+))?"
2592 "(z|[-+]\\d{2}(\\d{2})?)?)?\\s*\\z";
2635 for (i = 1; i <=
SNUM; i++)
2656 static const char pat_source[] =
2657 "\\A\\s*(-?\\d{4})-(\\d{2})-(\\d{2})"
2659 "(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d+))?"
2660 "(z|[-+]\\d{2}:\\d{2})\\s*\\z";
2692 for (i = 1; i <=
SNUM; i++)
2720 static const char pat_source[] =
2721 "\\A\\s*(-?\\d{4,})(?:-(\\d{2})(?:-(\\d{2}))?)?"
2723 "(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d+))?)?"
2724 "(z|[-+]\\d{2}:\\d{2})?\\s*\\z";
2742 for (i = 1; i <=
SNUM; i++)
2763 static const char pat_source[] =
2764 "\\A\\s*(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d+))?"
2765 "(z|[-+]\\d{2}:\\d{2})?\\s*\\z";
2783 for (i = 1; i <=
SNUM; i++)
2804 static const char pat_source[] =
2805 "\\A\\s*(?:--(\\d{2})(?:-(\\d{2}))?|---(\\d{2}))"
2806 "(z|[-+]\\d{2}:\\d{2})?\\s*\\z";
2847 for (i = 1; i <=
SNUM; i++)
2873 static const char pat_source[] =
2878 "(\\d{2}):(\\d{2})(?::(\\d{2}))?\\s*"
2879 "([-+]\\d{4}|ut|gmt|e[sd]t|c[sd]t|m[sd]t|p[sd]t|[a-ik-z])\\s*\\z";
2911 for (i = 1; i <=
SNUM; i++)
2931 static const char pat_source[] =
2936 "(\\d{2}):(\\d{2}):(\\d{2})\\s+"
2955 for (i = 1; i <=
SNUM; i++)
2978 static const char pat_source[] =
2979 "\\A\\s*(" DAYS ")\\s*,\\s+"
2983 "(\\d{2}):(\\d{2}):(\\d{2})\\s+"
3002 for (i = 1; i <=
SNUM; i++)
3020 static const char pat_source[] =
3024 "(\\d{2}):(\\d{2}):(\\d{2})\\s+"
3067 for (i = 1; i <=
SNUM; i++)
3095 static const char pat_source[] =
3096 "\\A\\s*([mtsh])?(\\d{2})\\.(\\d{2})\\.(\\d{2})"
3098 "(?:(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d*))?)?"
3099 "(z|[-+]\\d{2}(?::?\\d{2})?)?)?)?\\s*\\z";
static unsigned check_class(VALUE s)
static int parse_time2_cb(VALUE m, VALUE hash)
void rb_match_busy(VALUE)
static int parse_sla_cb(VALUE m, VALUE hash)
static int httpdate_type2(VALUE str, VALUE hash)
static int parse_bc_cb(VALUE m, VALUE hash)
size_t strlen(const char *)
static int parse_iso22_cb(VALUE m, VALUE hash)
static int parse_bc(VALUE str, VALUE hash)
static int xmlschema_trunc_cb(VALUE m, VALUE hash)
static int parse_us(VALUE str, VALUE hash)
static int parse_iso24(VALUE str, VALUE hash)
static int subx(VALUE str, VALUE rep, VALUE pat, VALUE hash, int(*cb)(VALUE, VALUE))
static int parse_year_cb(VALUE m, VALUE hash)
static int parse_day(VALUE str, VALUE hash)
static int parse_year(VALUE str, VALUE hash)
static const char * abbr_months[]
static void s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
static int parse_day_cb(VALUE m, VALUE hash)
static int iso8601_bas_datetime_cb(VALUE m, VALUE hash)
static int xmlschema_trunc(VALUE str, VALUE hash)
static int parse_iso21(VALUE str, VALUE hash)
VALUE date__rfc3339(VALUE)
VALUE rb_reg_nth_match(int, VALUE)
static int jisx0301_cb(VALUE m, VALUE hash)
static VALUE regcomp(const char *source, long len, int opt)
static int parse_jis_cb(VALUE m, VALUE hash)
static int jisx0301(VALUE str, VALUE hash)
static int parse_iso25(VALUE str, VALUE hash)
static int httpdate_type1_cb(VALUE m, VALUE hash)
static int rfc3339(VALUE str, VALUE hash)
VALUE date__jisx0301(VALUE)
static int parse_time(VALUE str, VALUE hash)
static int parse_iso22(VALUE str, VALUE hash)
static int parse_jis(VALUE str, VALUE hash)
static int parse_iso26_cb(VALUE m, VALUE hash)
static int iso8601_bas_datetime(VALUE str, VALUE hash)
static int day_num(VALUE s)
static int parse_sla(VALUE str, VALUE hash)
VALUE rb_reg_new(const char *, long, int)
static int parse_vms12_cb(VALUE m, VALUE hash)
static int iso8601_ext_datetime_cb(VALUE m, VALUE hash)
static VALUE comp_year50(VALUE y)
static int parse_ddd(VALUE str, VALUE hash)
static int rfc2822_cb(VALUE m, VALUE hash)
static int parse_mday_cb(VALUE m, VALUE hash)
static int xmlschema_datetime_cb(VALUE m, VALUE hash)
void rb_backref_set(VALUE)
static int parse_time_cb(VALUE m, VALUE hash)
static int parse_iso_cb(VALUE m, VALUE hash)
static int xmlschema_time(VALUE str, VALUE hash)
VALUE date__parse(VALUE str, VALUE comp)
unsigned char buf[MIME_BUF_SIZE]
#define ALLOCA_N(type, n)
static int parse_vms(VALUE str, VALUE hash)
VALUE rb_hash_aset(VALUE, VALUE, VALUE)
static int parse_iso24_cb(VALUE m, VALUE hash)
static int mon_num(VALUE s)
static int parse_frag(VALUE str, VALUE hash)
static VALUE sec_fraction(VALUE f)
void rb_gc_register_mark_object(VALUE)
static int iso8601_bas_time(VALUE str, VALUE hash)
VALUE date__iso8601(VALUE)
static int rfc2822(VALUE str, VALUE hash)
static int parse_iso25_cb(VALUE m, VALUE hash)
static int min(int a, int b)
static int parse_dot(VALUE str, VALUE hash)
static int xmlschema_time_cb(VALUE m, VALUE hash)
static int parse_dot_cb(VALUE m, VALUE hash)
static int parse_iso(VALUE str, VALUE hash)
char * strchr(char *, char)
static struct zone zones_source[]
static int parse_us_cb(VALUE m, VALUE hash)
static int parse_eu_cb(VALUE m, VALUE hash)
static int parse_ddd_cb(VALUE m, VALUE hash)
static int xmlschema_datetime(VALUE str, VALUE hash)
#define iso8601_bas_time_cb
static const char * abbr_days[]
static int parse_mday(VALUE str, VALUE hash)
static VALUE comp_year69(VALUE y)
static int httpdate_type1(VALUE str, VALUE hash)
static int rfc3339_cb(VALUE m, VALUE hash)
#define f_gsub_bang(s, r, x)
static int iso8601_ext_time_cb(VALUE m, VALUE hash)
static int parse_vms11_cb(VALUE m, VALUE hash)
static int parse_frag_cb(VALUE m, VALUE hash)
static int parse_iso21_cb(VALUE m, VALUE hash)
#define f_aset2(o, i, j, v)
static int parse_mon_cb(VALUE m, VALUE hash)
VALUE date__httpdate(VALUE)
static int n2i(const char *s, long f, long w)
VALUE rb_backref_get(void)
static int parse_iso23_cb(VALUE m, VALUE hash)
static int parse_vms11(VALUE str, VALUE hash)
static int parse_iso2(VALUE str, VALUE hash)
VALUE rb_str_new(const char *, long)
static int iso8601_ext_datetime(VALUE str, VALUE hash)
static int parse_iso26(VALUE str, VALUE hash)
VALUE date__rfc2822(VALUE)
VALUE date__xmlschema(VALUE)
static int parse_vms12(VALUE str, VALUE hash)
static int parse_iso23(VALUE str, VALUE hash)
static int httpdate_type3_cb(VALUE m, VALUE hash)
static int httpdate_type2_cb(VALUE m, VALUE hash)
static int match(VALUE str, VALUE pat, VALUE hash, int(*cb)(VALUE, VALUE))
VALUE date_zone_to_diff(VALUE)
static int httpdate_type3(VALUE str, VALUE hash)
#define rb_rational_new2(x, y)
static int parse_mon(VALUE str, VALUE hash)
static int parse_eu(VALUE str, VALUE hash)
static int iso8601_ext_time(VALUE str, VALUE hash)