15#define sizeof_array(o) (sizeof o / sizeof o[0])
17#define f_negate(x) rb_funcall(x, rb_intern("-@"), 0)
18#define f_add(x,y) rb_funcall(x, '+', 1, y)
19#define f_sub(x,y) rb_funcall(x, '-', 1, y)
20#define f_mul(x,y) rb_funcall(x, '*', 1, y)
21#define f_div(x,y) rb_funcall(x, '/', 1, y)
22#define f_idiv(x,y) rb_funcall(x, rb_intern("div"), 1, y)
23#define f_mod(x,y) rb_funcall(x, '%', 1, y)
24#define f_expt(x,y) rb_funcall(x, rb_intern("**"), 1, y)
26#define f_lt_p(x,y) rb_funcall(x, '<', 1, y)
27#define f_gt_p(x,y) rb_funcall(x, '>', 1, y)
28#define f_le_p(x,y) rb_funcall(x, rb_intern("<="), 1, y)
29#define f_ge_p(x,y) rb_funcall(x, rb_intern(">="), 1, y)
31#define f_to_s(x) rb_funcall(x, rb_intern("to_s"), 0)
33#define f_match(r,s) rb_funcall(r, rb_intern("match"), 1, s)
34#define f_aref(o,i) rb_funcall(o, rb_intern("[]"), 1, i)
35#define f_aref2(o,i,j) rb_funcall(o, rb_intern("[]"), 2, i, j)
36#define f_begin(o,i) rb_funcall(o, rb_intern("begin"), 1, i)
37#define f_end(o,i) rb_funcall(o, rb_intern("end"), 1, i)
38#define f_aset(o,i,v) rb_funcall(o, rb_intern("[]="), 2, i, v)
39#define f_aset2(o,i,j,v) rb_funcall(o, rb_intern("[]="), 3, i, j, v)
40#define f_sub_bang(s,r,x) rb_funcall(s, rb_intern("sub!"), 2, r, x)
41#define f_gsub_bang(s,r,x) rb_funcall(s, rb_intern("gsub!"), 2, r, x)
43#define set_hash(k,v) rb_hash_aset(hash, ID2SYM(rb_intern(k"")), v)
44#define ref_hash(k) rb_hash_aref(hash, ID2SYM(rb_intern(k"")))
45#define del_hash(k) rb_hash_delete(hash, ID2SYM(rb_intern(k"")))
47#define cstr2num(s) rb_cstr_to_inum(s, 10, 0)
48#define str2num(s) rb_str_to_inum(s, 10, 0)
50static const char abbr_days[][4] = {
51 "sun",
"mon",
"tue",
"wed",
55static const char abbr_months[][4] = {
56 "jan",
"feb",
"mar",
"apr",
"may",
"jun",
57 "jul",
"aug",
"sep",
"oct",
"nov",
"dec"
60#define issign(c) ((c) == '-' || (c) == '+')
61#define asp_string() rb_str_new(" ", 1)
63#define asuba_string() rb_str_new("\001", 1)
64#define asubb_string() rb_str_new("\002", 1)
65#define asubw_string() rb_str_new("\027", 1)
66#define asubt_string() rb_str_new("\024", 1)
70digit_span(
const char *s,
const char *e)
73 while (s + i < e && isdigit((
unsigned char)s[i])) i++;
108 const char *s, *
bp, *ep;
113 while (s < ep && !
issign(*s) && !isdigit((
unsigned char)*s))
115 if (s >= ep)
goto no_date;
117 if (
issign((
unsigned char)*s))
119 l = digit_span(s, ep);
158 const char *s, *
bp, *ep;
165 while (s < ep && !
issign(*s) && !isdigit((
unsigned char)*s))
167 if (s >= ep)
goto no_year;
175 l = digit_span(s, ep);
196 const char *s, *
bp, *ep;
202 while (s < ep && !isdigit((
unsigned char)*s))
204 if (s >= ep)
goto no_month;
206 l = digit_span(s, ep);
222 const char *s, *
bp, *ep;
228 while (s < ep && !isdigit((
unsigned char)*s))
230 if (s >= ep)
goto no_mday;
232 l = digit_span(s, ep);
251#define DAYS "sunday|monday|tuesday|wednesday|thursday|friday|saturday"
252#define MONTHS "january|february|march|april|may|june|july|august|september|october|november|december"
253#define ABBR_DAYS "sun|mon|tue|wed|thu|fri|sat"
254#define ABBR_MONTHS "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec"
257#define VALID_DAYS "(?:" DAYS ")" "|(?:tues|wednes|thurs|thur|" ABBR_DAYS ")\\.?"
258#define VALID_MONTHS "(?:" MONTHS ")" "|(?:sept|" ABBR_MONTHS ")\\.?"
259#define DOTLESS_VALID_MONTHS "(?:" MONTHS ")" "|(?:sept|" ABBR_MONTHS ")"
265#define FPW_COM "\\s*(?:" FPW "\\s*,?)?\\s*"
266#define FPT_COM "\\s*(?:" FPT "\\s*,?)?\\s*"
267#define COM_FPW "\\s*(?:,?\\s*" FPW ")?\\s*"
268#define COM_FPT "\\s*(?:,?\\s*(?:@|\\b[aA][tT]\\b)?\\s*" FPT ")?\\s*"
269#define TEE_FPT "\\s*(?:[tT]?" FPT ")?"
274regcomp(
const char *source,
long len,
int opt)
284#define REGCOMP(pat,opt) \
287 pat = regcomp(pat##_source, sizeof pat##_source - 1, opt); \
290#define REGCOMP_0(pat) REGCOMP(pat, 0)
291#define REGCOMP_I(pat) REGCOMP(pat, ONIG_OPTION_IGNORECASE)
293#define MATCH(s,p,c) \
295 return match(s, p, hash, c); \
337 return subx(s, asp_string(), p, hash, c); \
343 return subx(s, asuba_string(), p, hash, c); \
348 return subx(s, asubb_string(), p, hash, c); \
353 return subx(s, asubw_string(), p, hash, c); \
358 return subx(s, asubt_string(), p, hash, c); \
365str_end_with_word(
const char *s,
long l,
const char *w)
368 if (l <= n || !isspace((
unsigned char)s[l - n - 1]))
return 0;
370 do ++n;
while (l > n && isspace((
unsigned char)s[l - n - 1]));
375shrunk_size(
const char *s,
long l)
379 for (i = ni = 0; i < l; ++i) {
380 if (!isspace((
unsigned char)s[i])) {
389 return ni < l ? ni : 0;
393shrink_space(
char *d,
const char *s,
long l)
397 for (i = ni = 0; i < l; ++i) {
398 if (!isspace((
unsigned char)s[i])) {
399 if (sp) d[ni++] =
' ';
422 if ((w = str_end_with_word(s, l,
"time")) > 0) {
425 if ((w = str_end_with_word(s, l,
"standard")) > 0) {
428 else if ((w = str_end_with_word(s, l,
"daylight")) > 0) {
436 else if ((w = str_end_with_word(s, l,
"dst")) > 0) {
441 long sl = shrunk_size(s, l);
444 l = shrink_space(d, s, l);
449 const struct zone *z =
zonetab(s, (
unsigned int)l);
461 long hour = 0, min = 0, sec = 0;
484 if (*p ==
',' || *p ==
'.') {
487 min =
STRTOUL(p, &e, 10) * 3600;
510 sec += min * 60 + hour * 3600;
511 if (sign) sec = -sec;
557 static const char pat_source[] =
570 SUBW(
str, pat, parse_day_cb);
620 static const char pat_source[] =
622 "(?:\\s*:?\\s*(\\d+)m?"
624 "\\s*:?\\s*(\\d+)(?:[,.](\\d+))?s?"
627 "(?:\\s*([ap])(?:m\\b|\\.m\\.))?";
644 parse_time2_cb(m, hash);
653 static const char pat_source[] =
659 "\\s*:\\s*\\d+(?:[,.]\\d*)?"
661 "\\s*:\\s*\\d+(?:[,.]\\d+)?"
665 "\\d+\\s*h(?:\\s*\\d+m?(?:\\s*\\d+s?)?)?"
669 "[ap](?:m\\b|\\.m\\.)"
672 "\\d+\\s*[ap](?:m\\b|\\.m\\.)"
677 "(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?"
679 "(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\stime\\b"
681 "(?-i:[[:alpha:]]+)(?:\\sdst)?\\b"
690 SUBT(
str, pat, parse_time_cb);
704 static const char pat_source[] =
709 SUBA(
str, pat, parse_era1_cb);
727 static const char pat_source[] =
728 "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|b(?:c|\\.c\\.))";
732 SUBB(
str, pat, parse_era2_cb);
738 if (parse_era1(
str, hash))
740 if (parse_era2(
str, hash))
750check_year_width(
VALUE y)
758 if (!isdigit((
unsigned char)s[1]))
return 0;
759 return (l == 2 || !isdigit((
unsigned char)s[2]));
768 if (!check_year_width(a))
773 if (!check_year_width(b))
780 if (!check_year_width(c))
803 s3e(hash, y, mon, d, !
NIL_P(b) &&
813 if (!check_apost(d, mon, y))
818 s3e(hash, y, mon, d, 0);
826 static const char pat_source[] =
832 "('?\\d+)[^-\\d\\s]*"
834 "(\\d+)(?:(?:st|nd|rd|th)\\b)?"
845 "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))?"
847 "('?-?\\d+(?:(?:st|nd|rd|th)\\b)?)"
853 "(?:" FPA
"|" FPB
")?"
881 s3e(hash, y, mon, d, !
NIL_P(b) &&
891 if (!check_apost(mon, d, y))
896 s3e(hash, y, mon, d, 0);
904 static const char pat_source[] =
912 "\\b(" VALID_MONTHS
")"
916 "('?\\d+)[^-\\d\\s']*"
918 "('?\\d+)(?:(?:st|nd|rd|th)\\b)?"
925 "(c(?:e|\\.e\\.)|b(?:ce|\\.c\\.e\\.)|a(?:d|\\.d\\.)|b(?:c|\\.c\\.))?"
933 "(?:" FPA
"|" FPB
")?"
957 if (!check_apost(y, mon, d))
961 s3e(hash, y, mon, d, 0);
968 static const char pat_source[] =
970 "('?[-+]?\\d+)-(\\d+)-('?-?\\d+)"
974 "([-+']?\\d+)-(\\d+)-([-']?\\d+)"
1006 static const char pat_source[] =
1008 "\\b(\\d{2}|\\d{4})?-?w(\\d{2})(?:-?(\\d))?\\b"
1012 "(\\d{2}|\\d{4})?-?w(\\d{2})(?:-?(\\d))?"
1020 SUBS(
str, pat, parse_iso21_cb);
1036 static const char pat_source[] =
1050 SUBS(
str, pat, parse_iso22_cb);
1071 static const char pat_source[] =
1073 "--(\\d{2})?-(\\d{2})\\b"
1077 "--(\\d{2})?-(\\d{2})"
1085 SUBS(
str, pat, parse_iso23_cb);
1106 static const char pat_source[] =
1108 "--(\\d{2})(\\d{2})?\\b"
1112 "--(\\d{2})(\\d{2})?"
1120 SUBS(
str, pat, parse_iso24_cb);
1140 static const char pat0_source[] =
1142 "[,.](\\d{2}|\\d{4})-\\d{3}\\b"
1146 "[,.](\\d{2}|\\d{4})-\\d{3}"
1152 static const char pat_source[] =
1154 "\\b(\\d{2}|\\d{4})-(\\d{3})\\b"
1158 "(\\d{2}|\\d{4})-(\\d{3})"
1170 SUBS(
str, pat, parse_iso25_cb);
1186 static const char pat0_source[] =
1198 static const char pat_source[] =
1216 SUBS(
str, pat, parse_iso26_cb);
1222 if (parse_iso21(
str, hash))
1224 if (parse_iso22(
str, hash))
1226 if (parse_iso23(
str, hash))
1228 if (parse_iso24(
str, hash))
1230 if (parse_iso25(
str, hash))
1232 if (parse_iso26(
str, hash))
1240#define JISX0301_ERA_INITIALS "mtshr"
1241#define JISX0301_DEFAULT_ERA 'H'
1249 case 'M':
case 'm': e = 1867;
break;
1250 case 'T':
case 't': e = 1911;
break;
1251 case 'S':
case 's': e = 1925;
break;
1252 case 'H':
case 'h': e = 1988;
break;
1253 case 'R':
case 'r': e = 2018;
break;
1254 default: e = 0;
break;
1282 static const char pat_source[] =
1309 if (!check_apost(d, mon, y))
1315 s3e(hash, y, mon, d, 0);
1322 static const char pat_source[] =
1329 "([-']?\\d+)-(" DOTLESS_VALID_MONTHS
")"
1338 SUBS(
str, pat, parse_vms11_cb);
1351 if (!check_apost(mon, d, y))
1357 s3e(hash, y, mon, d, 0);
1364 static const char pat_source[] =
1367 "-('?-?\\d+)(?:-('?-?\\d+))?"
1371 "(" DOTLESS_VALID_MONTHS
")"
1372 "-([-']?\\d+)(?:-([-']?\\d+))?"
1380 SUBS(
str, pat, parse_vms12_cb);
1386 if (parse_vms11(
str, hash))
1388 if (parse_vms12(
str, hash))
1406 if (!check_apost(y, mon, d))
1410 s3e(hash, y, mon, d, 0);
1417 static const char pat_source[] =
1419 "('?-?\\d+)/\\s*('?\\d+)(?:\\D\\s*('?-?\\d+))?"
1423 "([-']?\\d+)/\\s*('?\\d+)(?:(?:[-/]|\\s+)\\s*([-']?\\d+))?"
1444 if (!check_apost(d, mon, y))
1449 s3e(hash, y, mon, d, 0);
1456 static const char pat_source[] =
1459 "([-']?\\d+)/\\s*(" DOTLESS_VALID_MONTHS
")(?:(?:[-/]|\\s+)\\s*([-']?\\d+))?"
1466 SUBS(
str, pat, parse_sla2_cb);
1478 if (!check_apost(mon, d, y))
1483 s3e(hash, y, mon, d, 0);
1490 static const char pat_source[] =
1493 "(" DOTLESS_VALID_MONTHS
")/\\s*([-']?\\d+)(?:(?:[-/]|\\s+)\\s*([-']?\\d+))?"
1500 SUBS(
str, pat, parse_sla3_cb);
1514 if (!check_apost(y, mon, d))
1518 s3e(hash, y, mon, d, 0);
1525 static const char pat_source[] =
1527 "('?-?\\d+)\\.\\s*('?\\d+)\\.\\s*('?-?\\d+)"
1531 "([-']?\\d+)\\.\\s*(\\d+)\\.\\s*([-']?\\d+)"
1552 if (!check_apost(d, mon, y))
1557 s3e(hash, y, mon, d, 0);
1564 static const char pat_source[] =
1567 "([-']?\\d+)\\.\\s*(" DOTLESS_VALID_MONTHS
")(?:(?:[./])\\s*([-']?\\d+))?"
1574 SUBS(
str, pat, parse_dot2_cb);
1586 if (!check_apost(mon, d, y))
1591 s3e(hash, y, mon, d, 0);
1598 static const char pat_source[] =
1601 "(" DOTLESS_VALID_MONTHS
")\\.\\s*([-']?\\d+)(?:(?:[./])\\s*([-']?\\d+))?"
1608 SUBS(
str, pat, parse_dot3_cb);
1625 static const char pat_source[] =
1639 SUBS(
str, pat, parse_year_cb);
1655 static const char pat_source[] =
1661 "(" VALID_MONTHS
")"
1685 static const char pat_source[] =
1687 "(\\d+)(st|nd|rd|th)\\b"
1691 "(\\d+)(st|nd|rd|th)"
1699 SUBS(
str, pat, parse_mday_cb);
1703n2i(
const char *s,
long f,
long w)
1710 for (i =
f; i < e; i++) {
1720 VALUE s1, s2, s3, s4, s5;
1721 const char *cs2, *cs3, *cs5;
1722 long l2, l3, l4, l5;
1757 int y = n2i(cs2, 0, 2);
1777 int y = n2i(cs2, l2-12, 2);
1783 int y = n2i(cs2, l2-14, 4);
1791 int y = n2i(cs2, 0, 4);
1821 int y = n2i(cs2, 0, 2);
1836 int y = n2i(cs2, 0, 4);
1891 const char *s1, *s2;
1896 s2 = memchr(s1,
':', l5);
1904 if (isdigit((
unsigned char)*s1))
1921 static const char pat_source[] =
1925 "([-+]?)(\\d{2,14})"
1930 "(\\d{2,6})?(?:[,.](\\d*))?"
1939 "\\[[-+]?\\d[^\\]]*\\]"
1963 static const char pat_source[] =
1964 "\\b(bc\\b|bce\\b|b\\.c\\.|b\\.c\\.e\\.)";
1997 static const char pat_source[] =
"\\A\\s*(\\d{1,2})\\s*\\z";
2001 SUBS(
str, pat, parse_frag_cb);
2015 static const char pat_source[] =
"\\A\\s*" FPW
"\\s*\\z";
2019 SUBS(
str, pat, parse_dummy_cb);
2025 static const char pat_source[] =
"\\A\\s*" FPT "\\s*\\z";
2029 SUBS(
str, pat, parse_dummy_cb);
2035 static const char pat_source[] =
"\\A\\s*(" FPW
"\\s+" FPT "|" FPT "\\s+" FPW
")\\s*\\z";
2039 SUBS(
str, pat, parse_dummy_cb);
2043have_invalid_char_p(
VALUE s)
2055#define HAVE_ALPHA (1<<0)
2056#define HAVE_DIGIT (1<<1)
2057#define HAVE_DASH (1<<2)
2058#define HAVE_DOT (1<<3)
2059#define HAVE_SLASH (1<<4)
2083#define HAVE_ELEM_P(x) ((check_class(str) & (x)) == (x))
2086#define PARSER_ERROR return rb_hash_new()
2092 VALUE backref, hash;
2095 if (have_invalid_char_p(
str))
2103 static const char pat_source[] =
2105 "[^-+',./:@[:alnum:]\\[\\]]+"
2121 parse_day(
str, hash);
2123 parse_time(
str, hash);
2127 parse_era(
str, hash);
2131 if (parse_eu(
str, hash))
2133 if (parse_us(
str, hash))
2137 if (parse_iso(
str, hash))
2140 if (parse_jis(
str, hash))
2143 if (parse_vms(
str, hash))
2146 if (parse_sla(
str, hash))
2150 if (parse_sla2(
str, hash))
2152 if (parse_sla3(
str, hash))
2157 if (parse_dot(
str, hash))
2161 if (parse_dot2(
str, hash))
2163 if (parse_dot3(
str, hash))
2168 if (parse_iso2(
str, hash))
2171 if (parse_year(
str, hash))
2174 if (parse_mon(
str, hash))
2177 if (parse_mday(
str, hash))
2180 if (parse_ddd(
str, hash))
2184 if (parse_wday_only(
str, hash))
2186 if (parse_time_only(
str, hash))
2188 if (parse_wday_and_time(
str, hash))
2197 parse_bc(
str, hash);
2199 parse_frag(
str, hash);
2286 for (i = 1; i <=
SNUM; i++)
2305 else if (!
NIL_P(s[5])) {
2314 else if (!
NIL_P(s[8])) {
2324 else if (!
NIL_P(s[9])) {
2327 if (!
NIL_P(s[10])) {
2333 if (!
NIL_P(s[13])) {
2334 set_hash(
"sec_fraction", sec_fraction(s[13]));
2336 if (!
NIL_P(s[14])) {
2347 static const char pat_source[] =
2348 "\\A\\s*(?:([-+]?\\d{2,}|-)-(\\d{2})?(?:-(\\d{2}))?|"
2349 "([-+]?\\d{2,})?-(\\d{3})|"
2350 "(\\d{4}|\\d{2})?-w(\\d{2})-(\\d)|"
2353 "(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d+))?)?"
2354 "(z|[-+]\\d{2}(?::?\\d{2})?)?)?\\s*\\z";
2358 MATCH(
str, pat, iso8601_ext_datetime_cb);
2372 for (i = 1; i <=
SNUM; i++)
2391 else if (!
NIL_P(s[5])) {
2398 else if (!
NIL_P(s[6])) {
2401 else if (!
NIL_P(s[9])) {
2409 else if (!
NIL_P(s[11])) {
2413 else if (!
NIL_P(s[12])) {
2416 if (!
NIL_P(s[13])) {
2422 if (!
NIL_P(s[16])) {
2423 set_hash(
"sec_fraction", sec_fraction(s[16]));
2425 if (!
NIL_P(s[17])) {
2436 static const char pat_source[] =
2437 "\\A\\s*(?:([-+]?(?:\\d{4}|\\d{2})|--)(\\d{2}|-)(\\d{2})|"
2438 "([-+]?(?:\\d{4}|\\d{2}))(\\d{3})|"
2440 "(\\d{4}|\\d{2})w(\\d{2})(\\d)|"
2444 "(\\d{2})(\\d{2})(?:(\\d{2})(?:[,.](\\d+))?)?"
2445 "(z|[-+]\\d{2}(?:\\d{2})?)?)?\\s*\\z";
2449 MATCH(
str, pat, iso8601_bas_datetime_cb);
2463 for (i = 1; i <=
SNUM; i++)
2472 set_hash(
"sec_fraction", sec_fraction(s[4]));
2481#define iso8601_bas_time_cb iso8601_ext_time_cb
2486 static const char pat_source[] =
2487 "\\A\\s*(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d+))?"
2488 "(z|[-+]\\d{2}(:?\\d{2})?)?)?\\s*\\z";
2492 MATCH(
str, pat, iso8601_ext_time_cb);
2498 static const char pat_source[] =
2499 "\\A\\s*(\\d{2})(\\d{2})(?:(\\d{2})(?:[,.](\\d+))?"
2500 "(z|[-+]\\d{2}(\\d{2})?)?)?\\s*\\z";
2510 VALUE backref, hash;
2517 if (iso8601_ext_datetime(
str, hash))
2519 if (iso8601_bas_datetime(
str, hash))
2521 if (iso8601_ext_time(
str, hash))
2523 if (iso8601_bas_time(
str, hash))
2543 for (i = 1; i <=
SNUM; i++)
2556 set_hash(
"sec_fraction", sec_fraction(s[7]));
2564 static const char pat_source[] =
2565 "\\A\\s*(-?\\d{4})-(\\d{2})-(\\d{2})"
2567 "(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d+))?"
2568 "(z|[-+]\\d{2}:\\d{2})\\s*\\z";
2578 VALUE backref, hash;
2600 for (i = 1; i <=
SNUM; i++)
2616 set_hash(
"sec_fraction", sec_fraction(s[7]));
2628 static const char pat_source[] =
2629 "\\A\\s*(-?\\d{4,})(?:-(\\d{2})(?:-(\\d{2}))?)?"
2631 "(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d+))?)?"
2632 "(z|[-+]\\d{2}:\\d{2})?\\s*\\z";
2636 MATCH(
str, pat, xmlschema_datetime_cb);
2650 for (i = 1; i <=
SNUM; i++)
2659 set_hash(
"sec_fraction", sec_fraction(s[4]));
2671 static const char pat_source[] =
2672 "\\A\\s*(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d+))?"
2673 "(z|[-+]\\d{2}:\\d{2})?\\s*\\z";
2677 MATCH(
str, pat, xmlschema_time_cb);
2691 for (i = 1; i <=
SNUM; i++)
2712 static const char pat_source[] =
2713 "\\A\\s*(?:--(\\d{2})(?:-(\\d{2}))?|---(\\d{2}))"
2714 "(z|[-+]\\d{2}:\\d{2})?\\s*\\z";
2718 MATCH(
str, pat, xmlschema_trunc_cb);
2724 VALUE backref, hash;
2731 if (xmlschema_datetime(
str, hash))
2733 if (xmlschema_time(
str, hash))
2735 if (xmlschema_trunc(
str, hash))
2755 for (i = 1; i <=
SNUM; i++)
2781 static const char pat_source[] =
2786 "(\\d{2}):(\\d{2})(?::(\\d{2}))?\\s*"
2787 "([-+]\\d{4}|ut|gmt|e[sd]t|c[sd]t|m[sd]t|p[sd]t|[a-ik-z])\\s*\\z";
2797 VALUE backref, hash;
2819 for (i = 1; i <=
SNUM; i++)
2839 static const char pat_source[] =
2844 "(\\d{2}):(\\d{2}):(\\d{2})\\s+"
2849 MATCH(
str, pat, httpdate_type1_cb);
2863 for (i = 1; i <=
SNUM; i++)
2886 static const char pat_source[] =
2887 "\\A\\s*(" DAYS ")\\s*,\\s+"
2891 "(\\d{2}):(\\d{2}):(\\d{2})\\s+"
2896 MATCH(
str, pat, httpdate_type2_cb);
2910 for (i = 1; i <=
SNUM; i++)
2928 static const char pat_source[] =
2932 "(\\d{2}):(\\d{2}):(\\d{2})\\s+"
2937 MATCH(
str, pat, httpdate_type3_cb);
2943 VALUE backref, hash;
2950 if (httpdate_type1(
str, hash))
2952 if (httpdate_type2(
str, hash))
2954 if (httpdate_type3(
str, hash))
2975 for (i = 1; i <=
SNUM; i++)
2991 set_hash(
"sec_fraction", sec_fraction(s[8]));
3003 static const char pat_source[] =
3006 "(?:(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d*))?)?"
3007 "(z|[-+]\\d{2}(?::?\\d{2})?)?)?)?\\s*\\z";
3017 VALUE backref, hash;
3023 if (jisx0301(
str, hash))
Our own, locale independent, character handling routines.
VALUE date__iso8601(VALUE str)
VALUE date__xmlschema(VALUE str)
#define f_gsub_bang(s, r, x)
VALUE date__rfc2822(VALUE str)
#define JISX0301_ERA_INITIALS
VALUE date__httpdate(VALUE str)
VALUE rb_int_positive_pow(long x, unsigned long y)
VALUE date__parse(VALUE str, VALUE comp)
VALUE date__jisx0301(VALUE str)
#define JISX0301_DEFAULT_ERA
#define iso8601_bas_time_cb
unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow)
VALUE date__rfc3339(VALUE str)
#define f_aset2(o, i, j, v)
VALUE date_zone_to_diff(VALUE str)
char str[HTML_ESCAPE_MAX_LEN+1]
#define RSTRING_LEN(string)
#define RSTRING_PTR(string)
void rb_gc_register_mark_object(VALUE obj)
Inform the garbage collector that object is a live Ruby object that should not be moved.
VALUE rb_obj_freeze(VALUE)
Make the object unmodifiable.
unsigned char match[65280+2]
VALUE rb_backref_get(void)
void rb_backref_set(VALUE)
VALUE rb_rational_new(VALUE, VALUE)
#define rb_rational_new2(x, y)
void rb_match_busy(VALUE)
VALUE rb_reg_new(const char *, long, int)
VALUE rb_reg_nth_match(int, VALUE)
#define rb_str_new(str, len)
VALUE rb_str_subseq(VALUE, long, long)
VALUE rb_str_append(VALUE, VALUE)
#define rb_str_new_cstr(str)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
size_t strlen(const char *)
const struct zone * zonetab(register const char *str, register size_t len)