8 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
9 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
10 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1,
11 -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1,
12 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
13 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
14 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
15 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
16 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
17 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
18 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
19 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
20 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
21 -1, -1, -1, -1, -1, -1, -1
30 result = (result << 4) | b;
32 result = (result << 4) | b;
35 result = (result << 4) | b;
38 result = (result << 4) | b;
48 }
else if (ch <= 0x07FF) {
49 buf[0] = (char) ((ch >> 6) | 0xC0);
50 buf[1] = (char) ((ch & 0x3F) | 0x80);
52 }
else if (ch <= 0xFFFF) {
53 buf[0] = (char) ((ch >> 12) | 0xE0);
54 buf[1] = (char) (((ch >> 6) & 0x3F) | 0x80);
55 buf[2] = (char) ((ch & 0x3F) | 0x80);
57 }
else if (ch <= 0x1fffff) {
58 buf[0] =(char) ((ch >> 18) | 0xF0);
59 buf[1] =(char) (((ch >> 12) & 0x3F) | 0x80);
60 buf[2] =(char) (((ch >> 6) & 0x3F) | 0x80);
61 buf[3] =(char) ((ch & 0x3F) | 0x80);
69 #ifdef HAVE_RUBY_ENCODING_H
70 static VALUE CEncoding_ASCII_8BIT, CEncoding_UTF_8, CEncoding_UTF_16BE,
71 CEncoding_UTF_16LE, CEncoding_UTF_32BE, CEncoding_UTF_32LE;
72 static ID i_encoding, i_encode;
119 #line 165 "parser.rl"
145 if ( 9 <= (*p) && (*p) <= 10 )
149 #line 132 "parser.rl"
155 if (np ==
NULL) { p--; {p++; cs = 3;
goto _out;} }
else {p = (( np))-1;}
169 if ( 9 <= (*p) && (*p) <= 10 )
223 if ( 48 <= (*p) && (*p) <= 57 )
225 }
else if ( (*p) >= 9 )
229 #line 117 "parser.rl"
234 p--; {p++; cs = 9;
goto _out;}
257 if ( 9 <= (*p) && (*p) <= 10 )
270 if ( 9 <= (*p) && (*p) <= 10 )
338 #line 140 "parser.rl"
339 { p--; {p++; cs = 27;
goto _out;} }
412 _test_eof2: cs = 2;
goto _test_eof;
413 _test_eof3: cs = 3;
goto _test_eof;
414 _test_eof4: cs = 4;
goto _test_eof;
415 _test_eof5: cs = 5;
goto _test_eof;
416 _test_eof6: cs = 6;
goto _test_eof;
417 _test_eof7: cs = 7;
goto _test_eof;
418 _test_eof8: cs = 8;
goto _test_eof;
419 _test_eof9: cs = 9;
goto _test_eof;
420 _test_eof10: cs = 10;
goto _test_eof;
421 _test_eof11: cs = 11;
goto _test_eof;
422 _test_eof12: cs = 12;
goto _test_eof;
423 _test_eof13: cs = 13;
goto _test_eof;
424 _test_eof14: cs = 14;
goto _test_eof;
425 _test_eof15: cs = 15;
goto _test_eof;
426 _test_eof16: cs = 16;
goto _test_eof;
427 _test_eof17: cs = 17;
goto _test_eof;
428 _test_eof18: cs = 18;
goto _test_eof;
429 _test_eof27: cs = 27;
goto _test_eof;
430 _test_eof19: cs = 19;
goto _test_eof;
431 _test_eof20: cs = 20;
goto _test_eof;
432 _test_eof21: cs = 21;
goto _test_eof;
433 _test_eof22: cs = 22;
goto _test_eof;
434 _test_eof23: cs = 23;
goto _test_eof;
435 _test_eof24: cs = 24;
goto _test_eof;
436 _test_eof25: cs = 25;
goto _test_eof;
437 _test_eof26: cs = 26;
goto _test_eof;
443 #line 166 "parser.rl"
453 if (!
NIL_P(klassname)) {
476 #line 265 "parser.rl"
489 #line 272 "parser.rl"
509 if ( 48 <= (*p) && (*p) <= 57 )
516 #line 213 "parser.rl"
519 if (np ==
NULL) { p--; {p++; cs = 21;
goto _out;} }
else {p = (( np))-1;}
523 #line 218 "parser.rl"
530 p--; {p++; cs = 21;
goto _out;}
536 if (np !=
NULL) {p = (( np))-1;}
538 if (np !=
NULL) {p = (( np))-1;}
539 p--; {p++; cs = 21;
goto _out;}
543 #line 236 "parser.rl"
549 if (np ==
NULL) { p--; {p++; cs = 21;
goto _out;} }
else {p = (( np))-1;}
553 #line 244 "parser.rl"
559 if (np ==
NULL) { p--; {p++; cs = 21;
goto _out;} }
else {p = (( np))-1;}
563 #line 206 "parser.rl"
573 #line 199 "parser.rl"
583 #line 193 "parser.rl"
589 #line 190 "parser.rl"
595 #line 196 "parser.rl"
604 #line 252 "parser.rl"
605 { p--; {p++; cs = 21;
goto _out;} }
742 _test_eof21: cs = 21;
goto _test_eof;
743 _test_eof2: cs = 2;
goto _test_eof;
744 _test_eof3: cs = 3;
goto _test_eof;
745 _test_eof4: cs = 4;
goto _test_eof;
746 _test_eof5: cs = 5;
goto _test_eof;
747 _test_eof6: cs = 6;
goto _test_eof;
748 _test_eof7: cs = 7;
goto _test_eof;
749 _test_eof8: cs = 8;
goto _test_eof;
750 _test_eof9: cs = 9;
goto _test_eof;
751 _test_eof10: cs = 10;
goto _test_eof;
752 _test_eof11: cs = 11;
goto _test_eof;
753 _test_eof12: cs = 12;
goto _test_eof;
754 _test_eof13: cs = 13;
goto _test_eof;
755 _test_eof14: cs = 14;
goto _test_eof;
756 _test_eof15: cs = 15;
goto _test_eof;
757 _test_eof16: cs = 16;
goto _test_eof;
758 _test_eof17: cs = 17;
goto _test_eof;
759 _test_eof18: cs = 18;
goto _test_eof;
760 _test_eof19: cs = 19;
goto _test_eof;
761 _test_eof20: cs = 20;
goto _test_eof;
767 #line 273 "parser.rl"
785 #line 289 "parser.rl"
798 #line 296 "parser.rl"
812 if ( 49 <= (*p) && (*p) <= 57 )
824 if ( 49 <= (*p) && (*p) <= 57 )
831 if ( 48 <= (*p) && (*p) <= 57 )
835 #line 286 "parser.rl"
836 { p--; {p++; cs = 4;
goto _out;} }
848 if ( 48 <= (*p) && (*p) <= 57 )
852 _test_eof2: cs = 2;
goto _test_eof;
853 _test_eof3: cs = 3;
goto _test_eof;
854 _test_eof4: cs = 4;
goto _test_eof;
855 _test_eof5: cs = 5;
goto _test_eof;
861 #line 298 "parser.rl"
881 #line 320 "parser.rl"
894 #line 327 "parser.rl"
908 if ( 49 <= (*p) && (*p) <= 57 )
920 if ( 49 <= (*p) && (*p) <= 57 )
937 if ( 48 <= (*p) && (*p) <= 57 )
949 if ( 48 <= (*p) && (*p) <= 57 )
951 }
else if ( (*p) >= 45 )
955 #line 314 "parser.rl"
956 { p--; {p++; cs = 9;
goto _out;} }
972 if ( 48 <= (*p) && (*p) <= 57 )
979 if ( 48 <= (*p) && (*p) <= 57 )
991 if ( 48 <= (*p) && (*p) <= 57 )
993 }
else if ( (*p) >= 45 )
1005 if ( 48 <= (*p) && (*p) <= 57 )
1009 _test_eof2: cs = 2;
goto _test_eof;
1010 _test_eof3: cs = 3;
goto _test_eof;
1011 _test_eof4: cs = 4;
goto _test_eof;
1012 _test_eof8: cs = 8;
goto _test_eof;
1013 _test_eof9: cs = 9;
goto _test_eof;
1014 _test_eof5: cs = 5;
goto _test_eof;
1015 _test_eof6: cs = 6;
goto _test_eof;
1016 _test_eof10: cs = 10;
goto _test_eof;
1017 _test_eof7: cs = 7;
goto _test_eof;
1023 #line 329 "parser.rl"
1036 #line 1032 "parser.c"
1044 #line 369 "parser.rl"
1058 #line 1054 "parser.c"
1063 #line 382 "parser.rl"
1065 #line 1061 "parser.c"
1098 if ( 48 <= (*p) && (*p) <= 57 )
1100 }
else if ( (*p) >= 9 )
1104 #line 346 "parser.rl"
1109 p--; {p++; cs = 3;
goto _out;}
1124 #line 1120 "parser.c"
1132 if ( 9 <= (*p) && (*p) <= 10 )
1154 if ( 48 <= (*p) && (*p) <= 57 )
1156 }
else if ( (*p) >= 9 )
1224 #line 361 "parser.rl"
1225 { p--; {p++; cs = 17;
goto _out;} }
1231 #line 1227 "parser.c"
1266 _test_eof2: cs = 2;
goto _test_eof;
1267 _test_eof3: cs = 3;
goto _test_eof;
1268 _test_eof4: cs = 4;
goto _test_eof;
1269 _test_eof5: cs = 5;
goto _test_eof;
1270 _test_eof6: cs = 6;
goto _test_eof;
1271 _test_eof7: cs = 7;
goto _test_eof;
1272 _test_eof8: cs = 8;
goto _test_eof;
1273 _test_eof9: cs = 9;
goto _test_eof;
1274 _test_eof10: cs = 10;
goto _test_eof;
1275 _test_eof11: cs = 11;
goto _test_eof;
1276 _test_eof12: cs = 12;
goto _test_eof;
1277 _test_eof17: cs = 17;
goto _test_eof;
1278 _test_eof13: cs = 13;
goto _test_eof;
1279 _test_eof14: cs = 14;
goto _test_eof;
1280 _test_eof15: cs = 15;
goto _test_eof;
1281 _test_eof16: cs = 16;
goto _test_eof;
1287 #line 383 "parser.rl"
1299 char *
p = string, *pe = string, *unescape;
1303 while (pe < stringEnd) {
1305 unescape = (
char *)
"?";
1310 unescape = (
char *)
"\n";
1313 unescape = (
char *)
"\r";
1316 unescape = (
char *)
"\t";
1319 unescape = (
char *)
"\"";
1322 unescape = (
char *)
"\\";
1325 unescape = (
char *)
"\b";
1328 unescape = (
char *)
"\f";
1331 if (pe > stringEnd - 4) {
1338 if (pe > stringEnd - 6)
return Qnil;
1339 if (pe[0] ==
'\\' && pe[1] ==
'u') {
1341 ch = (((ch & 0x3F) << 10) | ((((ch >> 6) & 0xF) + 1) << 16)
1345 unescape = (
char *)
"?";
1368 #line 1364 "parser.c"
1376 #line 482 "parser.rl"
1398 #line 1394 "parser.c"
1403 #line 503 "parser.rl"
1406 #line 1402 "parser.c"
1427 if ( 0 <= (*p) && (*p) <= 31 )
1431 #line 468 "parser.rl"
1434 if (
NIL_P(*result)) {
1436 {p++; cs = 8;
goto _out;}
1442 #line 479 "parser.rl"
1443 { p--; {p++; cs = 8;
goto _out;} }
1449 #line 1445 "parser.c"
1457 if ( 0 <= (*p) && (*p) <= 31 )
1465 if ( 48 <= (*p) && (*p) <= 57 )
1467 }
else if ( (*p) > 70 ) {
1468 if ( 97 <= (*p) && (*p) <= 102 )
1478 if ( 48 <= (*p) && (*p) <= 57 )
1480 }
else if ( (*p) > 70 ) {
1481 if ( 97 <= (*p) && (*p) <= 102 )
1491 if ( 48 <= (*p) && (*p) <= 57 )
1493 }
else if ( (*p) > 70 ) {
1494 if ( 97 <= (*p) && (*p) <= 102 )
1504 if ( 48 <= (*p) && (*p) <= 57 )
1506 }
else if ( (*p) > 70 ) {
1507 if ( 97 <= (*p) && (*p) <= 102 )
1513 _test_eof2: cs = 2;
goto _test_eof;
1514 _test_eof8: cs = 8;
goto _test_eof;
1515 _test_eof3: cs = 3;
goto _test_eof;
1516 _test_eof4: cs = 4;
goto _test_eof;
1517 _test_eof5: cs = 5;
goto _test_eof;
1518 _test_eof6: cs = 6;
goto _test_eof;
1519 _test_eof7: cs = 7;
goto _test_eof;
1525 #line 505 "parser.rl"
1567 #ifdef HAVE_RUBY_ENCODING_H
1570 if (encoding == CEncoding_ASCII_8BIT) {
1571 if (len >= 4 && ptr[0] == 0 && ptr[1] == 0 && ptr[2] == 0) {
1572 source =
rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_32BE);
1573 }
else if (len >= 4 && ptr[0] == 0 && ptr[2] == 0) {
1574 source =
rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_16BE);
1575 }
else if (len >= 4 && ptr[1] == 0 && ptr[2] == 0 && ptr[3] == 0) {
1576 source =
rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_32LE);
1577 }
else if (len >= 4 && ptr[1] == 0 && ptr[3] == 0) {
1578 source =
rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_16LE);
1584 source =
rb_funcall(source, i_encode, 1, CEncoding_UTF_8);
1588 if (len >= 4 && ptr[0] == 0 && ptr[1] == 0 && ptr[2] == 0) {
1590 }
else if (len >= 4 && ptr[0] == 0 && ptr[2] == 0) {
1592 }
else if (len >= 4 && ptr[1] == 0 && ptr[2] == 0 && ptr[3] == 0) {
1594 }
else if (len >= 4 && ptr[1] == 0 && ptr[3] == 0) {
1635 if (json->Vsource) {
1647 if (
RTEST(max_nesting)) {
1649 json->max_nesting =
FIX2INT(max_nesting);
1651 json->max_nesting = 0;
1654 json->max_nesting = 19;
1660 json->allow_nan = 0;
1666 json->symbolize_names = 0;
1671 json->quirks_mode =
RTEST(quirks_mode) ? 1 : 0;
1673 json->quirks_mode = 0;
1679 json->create_additions = 0;
1691 json->object_class =
Qnil;
1697 json->array_class =
Qnil;
1702 json->match_string =
RTEST(match_string) ? match_string :
Qnil;
1704 json->match_string =
Qnil;
1708 json->max_nesting = 19;
1709 json->allow_nan = 0;
1710 json->create_additions = 1;
1712 json->object_class =
Qnil;
1713 json->array_class =
Qnil;
1715 if (!json->quirks_mode) {
1718 json->current_nesting = 0;
1721 json->Vsource = source;
1726 #line 1722 "parser.c"
1734 #line 729 "parser.rl"
1745 #line 1741 "parser.c"
1750 #line 739 "parser.rl"
1754 #line 1750 "parser.c"
1771 if ( 9 <= (*p) && (*p) <= 10 )
1810 #line 718 "parser.rl"
1813 json->current_nesting = 1;
1815 if (np ==
NULL) { p--; {p++; cs = 10;
goto _out;} }
else {p = (( np))-1;}
1819 #line 711 "parser.rl"
1822 json->current_nesting = 1;
1824 if (np ==
NULL) { p--; {p++; cs = 10;
goto _out;} }
else {p = (( np))-1;}
1831 #line 1827 "parser.c"
1837 if ( 9 <= (*p) && (*p) <= 10 )
1873 _test_eof1: cs = 1;
goto _test_eof;
1874 _test_eof2: cs = 2;
goto _test_eof;
1875 _test_eof3: cs = 3;
goto _test_eof;
1876 _test_eof4: cs = 4;
goto _test_eof;
1877 _test_eof5: cs = 5;
goto _test_eof;
1878 _test_eof10: cs = 10;
goto _test_eof;
1879 _test_eof6: cs = 6;
goto _test_eof;
1880 _test_eof7: cs = 7;
goto _test_eof;
1881 _test_eof8: cs = 8;
goto _test_eof;
1882 _test_eof9: cs = 9;
goto _test_eof;
1888 #line 742 "parser.rl"
1900 #line 1896 "parser.c"
1908 #line 767 "parser.rl"
1919 #line 1915 "parser.c"
1924 #line 777 "parser.rl"
1928 #line 1924 "parser.c"
1953 if ( 48 <= (*p) && (*p) <= 57 )
1955 }
else if ( (*p) >= 9 )
1962 #line 759 "parser.rl"
1965 if (np ==
NULL) { p--; {p++; cs = 10;
goto _out;} }
else {p = (( np))-1;}
1972 #line 1968 "parser.c"
1978 if ( 9 <= (*p) && (*p) <= 10 )
2046 _test_eof1: cs = 1;
goto _test_eof;
2047 _test_eof10: cs = 10;
goto _test_eof;
2048 _test_eof2: cs = 2;
goto _test_eof;
2049 _test_eof3: cs = 3;
goto _test_eof;
2050 _test_eof4: cs = 4;
goto _test_eof;
2051 _test_eof5: cs = 5;
goto _test_eof;
2052 _test_eof6: cs = 6;
goto _test_eof;
2053 _test_eof7: cs = 7;
goto _test_eof;
2054 _test_eof8: cs = 8;
goto _test_eof;
2055 _test_eof9: cs = 9;
goto _test_eof;
2061 #line 780 "parser.rl"
2081 if (json->quirks_mode) {
2176 #ifdef HAVE_RUBY_ENCODING_H
#define RSTRING_LEN(string)
static const int JSON_string_error
static JSON_Parser * JSON_allocate()
VALUE rb_ary_entry(VALUE ary, long offset)
static const int JSON_value_error
static const int JSON_float_first_final
static VALUE cParser_source(VALUE self)
rb_hash_aset(CALLBACK_TABLE, id_num, cmd)
#define option_given_p(opts, key)
static VALUE convert_encoding(VALUE source)
VALUE rb_ary_push(VALUE ary, VALUE item)
static VALUE eParserError
static VALUE match_string(VALUE match)
#define RSTRING_PTR(string)
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
void rb_raise(VALUE exc, const char *fmt,...)
static const int JSON_object_start
VALUE rb_convert_type(VALUE, int, const char *, const char *)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
static VALUE cJSON_parser_s_allocate(VALUE klass)
static VALUE cParser_parse(VALUE self)
static VALUE CMinusInfinity
static const int JSON_string_first_final
static int convert_UTF32_to_UTF8(char *buf, UTF32 ch)
VALUE rb_path2class(const char *)
static const int JSON_float_en_main
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
VALUE rb_str_buf_cat(VALUE, const char *, long)
static const int JSON_array_first_final
static char * JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result)
static const int JSON_array_error
static char * JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result)
#define MEMZERO(p, type, n)
VALUE rb_require(const char *)
static void JSON_mark(JSON_Parser *json)
return Data_Wrap_Struct(CLASS_OF(interp), 0, ip_free, slave)
VALUE rb_class_new_instance(int, VALUE *, VALUE)
static ID i_deep_const_get
static VALUE eNestingError
static const int JSON_value_start
RUBY_EXTERN VALUE rb_cObject
static char * JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
static const int JSON_en_main
static const int JSON_integer_start
static const int JSON_integer_error
static const int JSON_quirks_mode_error
unsigned char buf[MIME_BUF_SIZE]
static VALUE cParser_parse_strict(VALUE self)
static const int JSON_string_en_main
VALUE rb_const_get(VALUE, ID)
static const int JSON_float_error
static VALUE cParser_parse_quirks_mode(VALUE self)
static const int JSON_error
static void JSON_free(JSON_Parser *json)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
static const int JSON_float_start
static VALUE cParser_quirks_mode_p(VALUE self)
static char * JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
rb_hash_foreach(tbl, each_attr_def, self)
register unsigned int len
#define UNI_SUR_HIGH_START
static const int JSON_object_first_final
VALUE rb_define_module_under(VALUE outer, const char *name)
static const int JSON_quirks_mode_first_final
static const int JSON_integer_en_main
static const int JSON_start
static const int JSON_array_start
static const int JSON_integer_first_final
static const int JSON_object_en_main
static const int JSON_quirks_mode_en_main
static const int JSON_first_final
static char * JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
static UTF32 unescape_unicode(const unsigned char *p)
VALUE rb_hash_aref(VALUE hash, VALUE key)
static const int JSON_array_en_main
static const char digit_values[256]
static const int JSON_string_start
static const int JSON_value_first_final
#define UNI_REPLACEMENT_CHAR
VALUE rb_ary_new2(long capa)
static ID i_symbolize_names
void rb_gc_mark_maybe(VALUE obj)
static const int JSON_quirks_mode_start
static const int JSON_value_en_main
return rb_funcall(q->proc, ID_call, 0)
static const int JSON_object_error
static ID i_json_creatable_p
static ID i_create_additions
static char * JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
VALUE rb_str_intern(VALUE)
static int match_i(VALUE regexp, VALUE klass, VALUE memo)
static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
VALUE rb_define_module(const char *name)
VALUE rb_str_buf_new(long)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE rb_str_new2(const char *)
VALUE rb_str_new(const char *, long)