[ruby/json] Stop using rb_gc_mark_locations
It's using `rb_gc_mark_maybe` under the hood, which isn't what we need. https://github.com/ruby/json/commit/e10d0bffcd
This commit is contained in:
parent
ee0de3fd4e
commit
6805e88935
@ -3,7 +3,6 @@ require 'mkmf'
|
|||||||
|
|
||||||
have_func("rb_enc_interned_str", "ruby.h") # RUBY_VERSION >= 3.0
|
have_func("rb_enc_interned_str", "ruby.h") # RUBY_VERSION >= 3.0
|
||||||
have_func("rb_hash_new_capa", "ruby.h") # RUBY_VERSION >= 3.2
|
have_func("rb_hash_new_capa", "ruby.h") # RUBY_VERSION >= 3.2
|
||||||
have_func("rb_gc_mark_locations", "ruby.h") # Missing on TruffleRuby
|
|
||||||
have_func("rb_hash_bulk_insert", "ruby.h") # Missing on TruffleRuby
|
have_func("rb_hash_bulk_insert", "ruby.h") # Missing on TruffleRuby
|
||||||
have_func("rb_category_warn", "ruby.h") # Missing on TruffleRuby
|
have_func("rb_category_warn", "ruby.h") # Missing on TruffleRuby
|
||||||
|
|
||||||
|
@ -28,19 +28,6 @@ static const char deprecated_create_additions_warning[] =
|
|||||||
"and will be removed in 3.0, use JSON.unsafe_load or explicitly "
|
"and will be removed in 3.0, use JSON.unsafe_load or explicitly "
|
||||||
"pass `create_additions: true`";
|
"pass `create_additions: true`";
|
||||||
|
|
||||||
#ifndef HAVE_RB_GC_MARK_LOCATIONS
|
|
||||||
// For TruffleRuby
|
|
||||||
void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
|
|
||||||
{
|
|
||||||
VALUE *value = start;
|
|
||||||
|
|
||||||
while (value < end) {
|
|
||||||
rb_gc_mark(*value);
|
|
||||||
value++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_RB_HASH_BULK_INSERT
|
#ifndef HAVE_RB_HASH_BULK_INSERT
|
||||||
// For TruffleRuby
|
// For TruffleRuby
|
||||||
void rb_hash_bulk_insert(long count, const VALUE *pairs, VALUE hash)
|
void rb_hash_bulk_insert(long count, const VALUE *pairs, VALUE hash)
|
||||||
@ -266,7 +253,10 @@ static inline void rvalue_stack_pop(rvalue_stack *stack, long count)
|
|||||||
static void rvalue_stack_mark(void *ptr)
|
static void rvalue_stack_mark(void *ptr)
|
||||||
{
|
{
|
||||||
rvalue_stack *stack = (rvalue_stack *)ptr;
|
rvalue_stack *stack = (rvalue_stack *)ptr;
|
||||||
rb_gc_mark_locations(stack->ptr, stack->ptr + stack->head);
|
long index;
|
||||||
|
for (index = 0; index < stack->head; index++) {
|
||||||
|
rb_gc_mark(stack->ptr[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rvalue_stack_free(void *ptr)
|
static void rvalue_stack_free(void *ptr)
|
||||||
@ -449,11 +439,11 @@ static void raise_parse_error(const char *format, const char *start)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#line 475 "parser.rl"
|
#line 465 "parser.rl"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#line 457 "parser.c"
|
#line 447 "parser.c"
|
||||||
enum {JSON_object_start = 1};
|
enum {JSON_object_start = 1};
|
||||||
enum {JSON_object_first_final = 32};
|
enum {JSON_object_first_final = 32};
|
||||||
enum {JSON_object_error = 0};
|
enum {JSON_object_error = 0};
|
||||||
@ -461,7 +451,7 @@ enum {JSON_object_error = 0};
|
|||||||
enum {JSON_object_en_main = 1};
|
enum {JSON_object_en_main = 1};
|
||||||
|
|
||||||
|
|
||||||
#line 515 "parser.rl"
|
#line 505 "parser.rl"
|
||||||
|
|
||||||
|
|
||||||
#define PUSH(result) rvalue_stack_push(json->stack, result, &json->stack_handle, &json->stack)
|
#define PUSH(result) rvalue_stack_push(json->stack, result, &json->stack_handle, &json->stack)
|
||||||
@ -477,14 +467,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|||||||
long stack_head = json->stack->head;
|
long stack_head = json->stack->head;
|
||||||
|
|
||||||
|
|
||||||
#line 481 "parser.c"
|
#line 471 "parser.c"
|
||||||
{
|
{
|
||||||
cs = JSON_object_start;
|
cs = JSON_object_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 530 "parser.rl"
|
#line 520 "parser.rl"
|
||||||
|
|
||||||
#line 488 "parser.c"
|
#line 478 "parser.c"
|
||||||
{
|
{
|
||||||
short _widec;
|
short _widec;
|
||||||
if ( p == pe )
|
if ( p == pe )
|
||||||
@ -513,7 +503,7 @@ case 2:
|
|||||||
goto st2;
|
goto st2;
|
||||||
goto st0;
|
goto st0;
|
||||||
tr2:
|
tr2:
|
||||||
#line 494 "parser.rl"
|
#line 484 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np;
|
char *np;
|
||||||
json->parsing_name = true;
|
json->parsing_name = true;
|
||||||
@ -529,7 +519,7 @@ st3:
|
|||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof3;
|
goto _test_eof3;
|
||||||
case 3:
|
case 3:
|
||||||
#line 533 "parser.c"
|
#line 523 "parser.c"
|
||||||
switch( (*p) ) {
|
switch( (*p) ) {
|
||||||
case 13: goto st3;
|
case 13: goto st3;
|
||||||
case 32: goto st3;
|
case 32: goto st3;
|
||||||
@ -596,7 +586,7 @@ case 8:
|
|||||||
goto st8;
|
goto st8;
|
||||||
goto st0;
|
goto st0;
|
||||||
tr11:
|
tr11:
|
||||||
#line 483 "parser.rl"
|
#line 473 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np = JSON_parse_value(json, p, pe, result, current_nesting);
|
char *np = JSON_parse_value(json, p, pe, result, current_nesting);
|
||||||
if (np == NULL) {
|
if (np == NULL) {
|
||||||
@ -610,20 +600,20 @@ st9:
|
|||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof9;
|
goto _test_eof9;
|
||||||
case 9:
|
case 9:
|
||||||
#line 614 "parser.c"
|
#line 604 "parser.c"
|
||||||
_widec = (*p);
|
_widec = (*p);
|
||||||
if ( (*p) < 13 ) {
|
if ( (*p) < 13 ) {
|
||||||
if ( (*p) > 9 ) {
|
if ( (*p) > 9 ) {
|
||||||
if ( 10 <= (*p) && (*p) <= 10 ) {
|
if ( 10 <= (*p) && (*p) <= 10 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) >= 9 ) {
|
} else if ( (*p) >= 9 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) > 13 ) {
|
} else if ( (*p) > 13 ) {
|
||||||
@ -631,26 +621,26 @@ case 9:
|
|||||||
if ( 32 <= (*p) && (*p) <= 32 ) {
|
if ( 32 <= (*p) && (*p) <= 32 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) > 44 ) {
|
} else if ( (*p) > 44 ) {
|
||||||
if ( 47 <= (*p) && (*p) <= 47 ) {
|
if ( 47 <= (*p) && (*p) <= 47 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -671,14 +661,14 @@ case 9:
|
|||||||
goto st10;
|
goto st10;
|
||||||
goto st0;
|
goto st0;
|
||||||
tr4:
|
tr4:
|
||||||
#line 505 "parser.rl"
|
#line 495 "parser.rl"
|
||||||
{ p--; {p++; cs = 32; goto _out;} }
|
{ p--; {p++; cs = 32; goto _out;} }
|
||||||
goto st32;
|
goto st32;
|
||||||
st32:
|
st32:
|
||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof32;
|
goto _test_eof32;
|
||||||
case 32:
|
case 32:
|
||||||
#line 682 "parser.c"
|
#line 672 "parser.c"
|
||||||
goto st0;
|
goto st0;
|
||||||
st10:
|
st10:
|
||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
@ -780,13 +770,13 @@ case 20:
|
|||||||
if ( 47 <= (*p) && (*p) <= 47 ) {
|
if ( 47 <= (*p) && (*p) <= 47 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) >= 42 ) {
|
} else if ( (*p) >= 42 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -805,20 +795,20 @@ case 21:
|
|||||||
if ( (*p) <= 41 ) {
|
if ( (*p) <= 41 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) > 42 ) {
|
} else if ( (*p) > 42 ) {
|
||||||
if ( 43 <= (*p) )
|
if ( 43 <= (*p) )
|
||||||
{ _widec = (short)(128 + ((*p) - -128));
|
{ _widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -841,13 +831,13 @@ case 22:
|
|||||||
if ( 42 <= (*p) && (*p) <= 42 ) {
|
if ( 42 <= (*p) && (*p) <= 42 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) > 46 ) {
|
} else if ( (*p) > 46 ) {
|
||||||
@ -855,19 +845,19 @@ case 22:
|
|||||||
if ( 48 <= (*p) )
|
if ( 48 <= (*p) )
|
||||||
{ _widec = (short)(128 + ((*p) - -128));
|
{ _widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) >= 47 ) {
|
} else if ( (*p) >= 47 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -891,20 +881,20 @@ case 23:
|
|||||||
if ( (*p) <= 9 ) {
|
if ( (*p) <= 9 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) > 10 ) {
|
} else if ( (*p) > 10 ) {
|
||||||
if ( 11 <= (*p) )
|
if ( 11 <= (*p) )
|
||||||
{ _widec = (short)(128 + ((*p) - -128));
|
{ _widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 492 "parser.rl"
|
#line 482 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -1018,7 +1008,7 @@ case 31:
|
|||||||
_out: {}
|
_out: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 531 "parser.rl"
|
#line 521 "parser.rl"
|
||||||
|
|
||||||
if (cs >= JSON_object_first_final) {
|
if (cs >= JSON_object_first_final) {
|
||||||
long count = json->stack->head - stack_head;
|
long count = json->stack->head - stack_head;
|
||||||
@ -1069,7 +1059,7 @@ case 31:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line 1073 "parser.c"
|
#line 1063 "parser.c"
|
||||||
enum {JSON_value_start = 1};
|
enum {JSON_value_start = 1};
|
||||||
enum {JSON_value_first_final = 29};
|
enum {JSON_value_first_final = 29};
|
||||||
enum {JSON_value_error = 0};
|
enum {JSON_value_error = 0};
|
||||||
@ -1077,7 +1067,7 @@ enum {JSON_value_error = 0};
|
|||||||
enum {JSON_value_en_main = 1};
|
enum {JSON_value_en_main = 1};
|
||||||
|
|
||||||
|
|
||||||
#line 664 "parser.rl"
|
#line 654 "parser.rl"
|
||||||
|
|
||||||
|
|
||||||
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
|
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
|
||||||
@ -1085,14 +1075,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|||||||
int cs = EVIL;
|
int cs = EVIL;
|
||||||
|
|
||||||
|
|
||||||
#line 1089 "parser.c"
|
#line 1079 "parser.c"
|
||||||
{
|
{
|
||||||
cs = JSON_value_start;
|
cs = JSON_value_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 671 "parser.rl"
|
#line 661 "parser.rl"
|
||||||
|
|
||||||
#line 1096 "parser.c"
|
#line 1086 "parser.c"
|
||||||
{
|
{
|
||||||
if ( p == pe )
|
if ( p == pe )
|
||||||
goto _test_eof;
|
goto _test_eof;
|
||||||
@ -1126,7 +1116,7 @@ st0:
|
|||||||
cs = 0;
|
cs = 0;
|
||||||
goto _out;
|
goto _out;
|
||||||
tr2:
|
tr2:
|
||||||
#line 609 "parser.rl"
|
#line 599 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np = JSON_parse_string(json, p, pe, result);
|
char *np = JSON_parse_string(json, p, pe, result);
|
||||||
if (np == NULL) {
|
if (np == NULL) {
|
||||||
@ -1138,7 +1128,7 @@ tr2:
|
|||||||
}
|
}
|
||||||
goto st29;
|
goto st29;
|
||||||
tr3:
|
tr3:
|
||||||
#line 619 "parser.rl"
|
#line 609 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np;
|
char *np;
|
||||||
if(pe > p + 8 && !strncmp(MinusInfinity, p, 9)) {
|
if(pe > p + 8 && !strncmp(MinusInfinity, p, 9)) {
|
||||||
@ -1158,7 +1148,7 @@ tr3:
|
|||||||
}
|
}
|
||||||
goto st29;
|
goto st29;
|
||||||
tr7:
|
tr7:
|
||||||
#line 637 "parser.rl"
|
#line 627 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np;
|
char *np;
|
||||||
json->in_array++;
|
json->in_array++;
|
||||||
@ -1168,7 +1158,7 @@ tr7:
|
|||||||
}
|
}
|
||||||
goto st29;
|
goto st29;
|
||||||
tr11:
|
tr11:
|
||||||
#line 645 "parser.rl"
|
#line 635 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np;
|
char *np;
|
||||||
np = JSON_parse_object(json, p, pe, result, current_nesting + 1);
|
np = JSON_parse_object(json, p, pe, result, current_nesting + 1);
|
||||||
@ -1176,7 +1166,7 @@ tr11:
|
|||||||
}
|
}
|
||||||
goto st29;
|
goto st29;
|
||||||
tr25:
|
tr25:
|
||||||
#line 602 "parser.rl"
|
#line 592 "parser.rl"
|
||||||
{
|
{
|
||||||
if (json->allow_nan) {
|
if (json->allow_nan) {
|
||||||
*result = CInfinity;
|
*result = CInfinity;
|
||||||
@ -1186,7 +1176,7 @@ tr25:
|
|||||||
}
|
}
|
||||||
goto st29;
|
goto st29;
|
||||||
tr27:
|
tr27:
|
||||||
#line 595 "parser.rl"
|
#line 585 "parser.rl"
|
||||||
{
|
{
|
||||||
if (json->allow_nan) {
|
if (json->allow_nan) {
|
||||||
*result = CNaN;
|
*result = CNaN;
|
||||||
@ -1196,19 +1186,19 @@ tr27:
|
|||||||
}
|
}
|
||||||
goto st29;
|
goto st29;
|
||||||
tr31:
|
tr31:
|
||||||
#line 589 "parser.rl"
|
#line 579 "parser.rl"
|
||||||
{
|
{
|
||||||
*result = Qfalse;
|
*result = Qfalse;
|
||||||
}
|
}
|
||||||
goto st29;
|
goto st29;
|
||||||
tr34:
|
tr34:
|
||||||
#line 586 "parser.rl"
|
#line 576 "parser.rl"
|
||||||
{
|
{
|
||||||
*result = Qnil;
|
*result = Qnil;
|
||||||
}
|
}
|
||||||
goto st29;
|
goto st29;
|
||||||
tr37:
|
tr37:
|
||||||
#line 592 "parser.rl"
|
#line 582 "parser.rl"
|
||||||
{
|
{
|
||||||
*result = Qtrue;
|
*result = Qtrue;
|
||||||
}
|
}
|
||||||
@ -1217,9 +1207,9 @@ st29:
|
|||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof29;
|
goto _test_eof29;
|
||||||
case 29:
|
case 29:
|
||||||
#line 651 "parser.rl"
|
#line 641 "parser.rl"
|
||||||
{ p--; {p++; cs = 29; goto _out;} }
|
{ p--; {p++; cs = 29; goto _out;} }
|
||||||
#line 1223 "parser.c"
|
#line 1213 "parser.c"
|
||||||
switch( (*p) ) {
|
switch( (*p) ) {
|
||||||
case 13: goto st29;
|
case 13: goto st29;
|
||||||
case 32: goto st29;
|
case 32: goto st29;
|
||||||
@ -1460,7 +1450,7 @@ case 28:
|
|||||||
_out: {}
|
_out: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 672 "parser.rl"
|
#line 662 "parser.rl"
|
||||||
|
|
||||||
if (json->freeze) {
|
if (json->freeze) {
|
||||||
OBJ_FREEZE(*result);
|
OBJ_FREEZE(*result);
|
||||||
@ -1475,7 +1465,7 @@ case 28:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line 1479 "parser.c"
|
#line 1469 "parser.c"
|
||||||
enum {JSON_integer_start = 1};
|
enum {JSON_integer_start = 1};
|
||||||
enum {JSON_integer_first_final = 3};
|
enum {JSON_integer_first_final = 3};
|
||||||
enum {JSON_integer_error = 0};
|
enum {JSON_integer_error = 0};
|
||||||
@ -1483,7 +1473,7 @@ enum {JSON_integer_error = 0};
|
|||||||
enum {JSON_integer_en_main = 1};
|
enum {JSON_integer_en_main = 1};
|
||||||
|
|
||||||
|
|
||||||
#line 693 "parser.rl"
|
#line 683 "parser.rl"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_FAST_INTEGER_SIZE 18
|
#define MAX_FAST_INTEGER_SIZE 18
|
||||||
@ -1523,7 +1513,7 @@ static char *JSON_decode_integer(JSON_Parser *json, char *p, VALUE *result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line 1527 "parser.c"
|
#line 1517 "parser.c"
|
||||||
enum {JSON_float_start = 1};
|
enum {JSON_float_start = 1};
|
||||||
enum {JSON_float_first_final = 6};
|
enum {JSON_float_first_final = 6};
|
||||||
enum {JSON_float_error = 0};
|
enum {JSON_float_error = 0};
|
||||||
@ -1531,7 +1521,7 @@ enum {JSON_float_error = 0};
|
|||||||
enum {JSON_float_en_main = 1};
|
enum {JSON_float_en_main = 1};
|
||||||
|
|
||||||
|
|
||||||
#line 745 "parser.rl"
|
#line 735 "parser.rl"
|
||||||
|
|
||||||
|
|
||||||
static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
||||||
@ -1540,15 +1530,15 @@ static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|||||||
bool is_float = false;
|
bool is_float = false;
|
||||||
|
|
||||||
|
|
||||||
#line 1544 "parser.c"
|
#line 1534 "parser.c"
|
||||||
{
|
{
|
||||||
cs = JSON_float_start;
|
cs = JSON_float_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 753 "parser.rl"
|
#line 743 "parser.rl"
|
||||||
json->memo = p;
|
json->memo = p;
|
||||||
|
|
||||||
#line 1552 "parser.c"
|
#line 1542 "parser.c"
|
||||||
{
|
{
|
||||||
if ( p == pe )
|
if ( p == pe )
|
||||||
goto _test_eof;
|
goto _test_eof;
|
||||||
@ -1588,24 +1578,24 @@ case 6:
|
|||||||
goto st0;
|
goto st0;
|
||||||
goto tr7;
|
goto tr7;
|
||||||
tr7:
|
tr7:
|
||||||
#line 737 "parser.rl"
|
#line 727 "parser.rl"
|
||||||
{ p--; {p++; cs = 7; goto _out;} }
|
{ p--; {p++; cs = 7; goto _out;} }
|
||||||
goto st7;
|
goto st7;
|
||||||
st7:
|
st7:
|
||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof7;
|
goto _test_eof7;
|
||||||
case 7:
|
case 7:
|
||||||
#line 1599 "parser.c"
|
#line 1589 "parser.c"
|
||||||
goto st0;
|
goto st0;
|
||||||
tr8:
|
tr8:
|
||||||
#line 738 "parser.rl"
|
#line 728 "parser.rl"
|
||||||
{ is_float = true; }
|
{ is_float = true; }
|
||||||
goto st3;
|
goto st3;
|
||||||
st3:
|
st3:
|
||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof3;
|
goto _test_eof3;
|
||||||
case 3:
|
case 3:
|
||||||
#line 1609 "parser.c"
|
#line 1599 "parser.c"
|
||||||
if ( 48 <= (*p) && (*p) <= 57 )
|
if ( 48 <= (*p) && (*p) <= 57 )
|
||||||
goto st8;
|
goto st8;
|
||||||
goto st0;
|
goto st0;
|
||||||
@ -1624,14 +1614,14 @@ case 8:
|
|||||||
goto st0;
|
goto st0;
|
||||||
goto tr7;
|
goto tr7;
|
||||||
tr9:
|
tr9:
|
||||||
#line 738 "parser.rl"
|
#line 728 "parser.rl"
|
||||||
{ is_float = true; }
|
{ is_float = true; }
|
||||||
goto st4;
|
goto st4;
|
||||||
st4:
|
st4:
|
||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof4;
|
goto _test_eof4;
|
||||||
case 4:
|
case 4:
|
||||||
#line 1635 "parser.c"
|
#line 1625 "parser.c"
|
||||||
switch( (*p) ) {
|
switch( (*p) ) {
|
||||||
case 43: goto st5;
|
case 43: goto st5;
|
||||||
case 45: goto st5;
|
case 45: goto st5;
|
||||||
@ -1688,7 +1678,7 @@ case 10:
|
|||||||
_out: {}
|
_out: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 755 "parser.rl"
|
#line 745 "parser.rl"
|
||||||
|
|
||||||
if (cs >= JSON_float_first_final) {
|
if (cs >= JSON_float_first_final) {
|
||||||
if (!is_float) {
|
if (!is_float) {
|
||||||
@ -1744,7 +1734,7 @@ case 10:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#line 1748 "parser.c"
|
#line 1738 "parser.c"
|
||||||
enum {JSON_array_start = 1};
|
enum {JSON_array_start = 1};
|
||||||
enum {JSON_array_first_final = 22};
|
enum {JSON_array_first_final = 22};
|
||||||
enum {JSON_array_error = 0};
|
enum {JSON_array_error = 0};
|
||||||
@ -1752,7 +1742,7 @@ enum {JSON_array_error = 0};
|
|||||||
enum {JSON_array_en_main = 1};
|
enum {JSON_array_en_main = 1};
|
||||||
|
|
||||||
|
|
||||||
#line 835 "parser.rl"
|
#line 825 "parser.rl"
|
||||||
|
|
||||||
|
|
||||||
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
|
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
|
||||||
@ -1765,14 +1755,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|||||||
long stack_head = json->stack->head;
|
long stack_head = json->stack->head;
|
||||||
|
|
||||||
|
|
||||||
#line 1769 "parser.c"
|
#line 1759 "parser.c"
|
||||||
{
|
{
|
||||||
cs = JSON_array_start;
|
cs = JSON_array_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 847 "parser.rl"
|
#line 837 "parser.rl"
|
||||||
|
|
||||||
#line 1776 "parser.c"
|
#line 1766 "parser.c"
|
||||||
{
|
{
|
||||||
short _widec;
|
short _widec;
|
||||||
if ( p == pe )
|
if ( p == pe )
|
||||||
@ -1812,7 +1802,7 @@ case 2:
|
|||||||
goto st2;
|
goto st2;
|
||||||
goto st0;
|
goto st0;
|
||||||
tr2:
|
tr2:
|
||||||
#line 815 "parser.rl"
|
#line 805 "parser.rl"
|
||||||
{
|
{
|
||||||
VALUE v = Qnil;
|
VALUE v = Qnil;
|
||||||
char *np = JSON_parse_value(json, p, pe, &v, current_nesting);
|
char *np = JSON_parse_value(json, p, pe, &v, current_nesting);
|
||||||
@ -1827,12 +1817,12 @@ st3:
|
|||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof3;
|
goto _test_eof3;
|
||||||
case 3:
|
case 3:
|
||||||
#line 1831 "parser.c"
|
#line 1821 "parser.c"
|
||||||
_widec = (*p);
|
_widec = (*p);
|
||||||
if ( 44 <= (*p) && (*p) <= 44 ) {
|
if ( 44 <= (*p) && (*p) <= 44 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -1879,14 +1869,14 @@ case 7:
|
|||||||
goto st3;
|
goto st3;
|
||||||
goto st7;
|
goto st7;
|
||||||
tr4:
|
tr4:
|
||||||
#line 827 "parser.rl"
|
#line 817 "parser.rl"
|
||||||
{ p--; {p++; cs = 22; goto _out;} }
|
{ p--; {p++; cs = 22; goto _out;} }
|
||||||
goto st22;
|
goto st22;
|
||||||
st22:
|
st22:
|
||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof22;
|
goto _test_eof22;
|
||||||
case 22:
|
case 22:
|
||||||
#line 1890 "parser.c"
|
#line 1880 "parser.c"
|
||||||
goto st0;
|
goto st0;
|
||||||
st8:
|
st8:
|
||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
@ -1954,13 +1944,13 @@ case 13:
|
|||||||
if ( 10 <= (*p) && (*p) <= 10 ) {
|
if ( 10 <= (*p) && (*p) <= 10 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) >= 9 ) {
|
} else if ( (*p) >= 9 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) > 13 ) {
|
} else if ( (*p) > 13 ) {
|
||||||
@ -1968,19 +1958,19 @@ case 13:
|
|||||||
if ( 47 <= (*p) && (*p) <= 47 ) {
|
if ( 47 <= (*p) && (*p) <= 47 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) >= 32 ) {
|
} else if ( (*p) >= 32 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -2019,13 +2009,13 @@ case 14:
|
|||||||
if ( 47 <= (*p) && (*p) <= 47 ) {
|
if ( 47 <= (*p) && (*p) <= 47 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) >= 42 ) {
|
} else if ( (*p) >= 42 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -2044,20 +2034,20 @@ case 15:
|
|||||||
if ( (*p) <= 41 ) {
|
if ( (*p) <= 41 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) > 42 ) {
|
} else if ( (*p) > 42 ) {
|
||||||
if ( 43 <= (*p) )
|
if ( 43 <= (*p) )
|
||||||
{ _widec = (short)(128 + ((*p) - -128));
|
{ _widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -2080,13 +2070,13 @@ case 16:
|
|||||||
if ( 42 <= (*p) && (*p) <= 42 ) {
|
if ( 42 <= (*p) && (*p) <= 42 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) > 46 ) {
|
} else if ( (*p) > 46 ) {
|
||||||
@ -2094,19 +2084,19 @@ case 16:
|
|||||||
if ( 48 <= (*p) )
|
if ( 48 <= (*p) )
|
||||||
{ _widec = (short)(128 + ((*p) - -128));
|
{ _widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) >= 47 ) {
|
} else if ( (*p) >= 47 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -2130,20 +2120,20 @@ case 17:
|
|||||||
if ( (*p) <= 9 ) {
|
if ( (*p) <= 9 ) {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else if ( (*p) > 10 ) {
|
} else if ( (*p) > 10 ) {
|
||||||
if ( 11 <= (*p) )
|
if ( 11 <= (*p) )
|
||||||
{ _widec = (short)(128 + ((*p) - -128));
|
{ _widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_widec = (short)(128 + ((*p) - -128));
|
_widec = (short)(128 + ((*p) - -128));
|
||||||
if (
|
if (
|
||||||
#line 825 "parser.rl"
|
#line 815 "parser.rl"
|
||||||
json->allow_trailing_comma ) _widec += 256;
|
json->allow_trailing_comma ) _widec += 256;
|
||||||
}
|
}
|
||||||
switch( _widec ) {
|
switch( _widec ) {
|
||||||
@ -2215,7 +2205,7 @@ case 21:
|
|||||||
_out: {}
|
_out: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 848 "parser.rl"
|
#line 838 "parser.rl"
|
||||||
|
|
||||||
if(cs >= JSON_array_first_final) {
|
if(cs >= JSON_array_first_final) {
|
||||||
long count = json->stack->head - stack_head;
|
long count = json->stack->head - stack_head;
|
||||||
@ -2409,7 +2399,7 @@ static VALUE json_string_unescape(JSON_Parser *json, char *string, char *stringE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line 2413 "parser.c"
|
#line 2403 "parser.c"
|
||||||
enum {JSON_string_start = 1};
|
enum {JSON_string_start = 1};
|
||||||
enum {JSON_string_first_final = 9};
|
enum {JSON_string_first_final = 9};
|
||||||
enum {JSON_string_error = 0};
|
enum {JSON_string_error = 0};
|
||||||
@ -2417,7 +2407,7 @@ enum {JSON_string_error = 0};
|
|||||||
enum {JSON_string_en_main = 1};
|
enum {JSON_string_en_main = 1};
|
||||||
|
|
||||||
|
|
||||||
#line 1071 "parser.rl"
|
#line 1061 "parser.rl"
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2438,15 +2428,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|||||||
VALUE match_string;
|
VALUE match_string;
|
||||||
|
|
||||||
|
|
||||||
#line 2442 "parser.c"
|
#line 2432 "parser.c"
|
||||||
{
|
{
|
||||||
cs = JSON_string_start;
|
cs = JSON_string_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 1091 "parser.rl"
|
#line 1081 "parser.rl"
|
||||||
json->memo = p;
|
json->memo = p;
|
||||||
|
|
||||||
#line 2450 "parser.c"
|
#line 2440 "parser.c"
|
||||||
{
|
{
|
||||||
if ( p == pe )
|
if ( p == pe )
|
||||||
goto _test_eof;
|
goto _test_eof;
|
||||||
@ -2471,14 +2461,14 @@ case 2:
|
|||||||
goto st0;
|
goto st0;
|
||||||
goto st2;
|
goto st2;
|
||||||
tr2:
|
tr2:
|
||||||
#line 1053 "parser.rl"
|
#line 1043 "parser.rl"
|
||||||
{
|
{
|
||||||
*result = json_string_fastpath(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
|
*result = json_string_fastpath(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
|
||||||
{p = (( p + 1))-1;}
|
{p = (( p + 1))-1;}
|
||||||
p--;
|
p--;
|
||||||
{p++; cs = 9; goto _out;}
|
{p++; cs = 9; goto _out;}
|
||||||
}
|
}
|
||||||
#line 1046 "parser.rl"
|
#line 1036 "parser.rl"
|
||||||
{
|
{
|
||||||
*result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
|
*result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
|
||||||
{p = (( p + 1))-1;}
|
{p = (( p + 1))-1;}
|
||||||
@ -2487,7 +2477,7 @@ tr2:
|
|||||||
}
|
}
|
||||||
goto st9;
|
goto st9;
|
||||||
tr6:
|
tr6:
|
||||||
#line 1046 "parser.rl"
|
#line 1036 "parser.rl"
|
||||||
{
|
{
|
||||||
*result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
|
*result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
|
||||||
{p = (( p + 1))-1;}
|
{p = (( p + 1))-1;}
|
||||||
@ -2499,7 +2489,7 @@ st9:
|
|||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof9;
|
goto _test_eof9;
|
||||||
case 9:
|
case 9:
|
||||||
#line 2503 "parser.c"
|
#line 2493 "parser.c"
|
||||||
goto st0;
|
goto st0;
|
||||||
st3:
|
st3:
|
||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
@ -2587,7 +2577,7 @@ case 8:
|
|||||||
_out: {}
|
_out: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 1093 "parser.rl"
|
#line 1083 "parser.rl"
|
||||||
|
|
||||||
if (json->create_additions && RTEST(match_string = json->match_string)) {
|
if (json->create_additions && RTEST(match_string = json->match_string)) {
|
||||||
VALUE klass;
|
VALUE klass;
|
||||||
@ -2740,7 +2730,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line 2744 "parser.c"
|
#line 2734 "parser.c"
|
||||||
enum {JSON_start = 1};
|
enum {JSON_start = 1};
|
||||||
enum {JSON_first_final = 10};
|
enum {JSON_first_final = 10};
|
||||||
enum {JSON_error = 0};
|
enum {JSON_error = 0};
|
||||||
@ -2748,7 +2738,7 @@ enum {JSON_error = 0};
|
|||||||
enum {JSON_en_main = 1};
|
enum {JSON_en_main = 1};
|
||||||
|
|
||||||
|
|
||||||
#line 1259 "parser.rl"
|
#line 1249 "parser.rl"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2777,16 +2767,16 @@ static VALUE cParser_parse(VALUE self)
|
|||||||
json->stack = &stack;
|
json->stack = &stack;
|
||||||
|
|
||||||
|
|
||||||
#line 2781 "parser.c"
|
#line 2771 "parser.c"
|
||||||
{
|
{
|
||||||
cs = JSON_start;
|
cs = JSON_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 1287 "parser.rl"
|
#line 1277 "parser.rl"
|
||||||
p = json->source;
|
p = json->source;
|
||||||
pe = p + json->len;
|
pe = p + json->len;
|
||||||
|
|
||||||
#line 2790 "parser.c"
|
#line 2780 "parser.c"
|
||||||
{
|
{
|
||||||
if ( p == pe )
|
if ( p == pe )
|
||||||
goto _test_eof;
|
goto _test_eof;
|
||||||
@ -2820,7 +2810,7 @@ st0:
|
|||||||
cs = 0;
|
cs = 0;
|
||||||
goto _out;
|
goto _out;
|
||||||
tr2:
|
tr2:
|
||||||
#line 1251 "parser.rl"
|
#line 1241 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np = JSON_parse_value(json, p, pe, &result, 0);
|
char *np = JSON_parse_value(json, p, pe, &result, 0);
|
||||||
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
||||||
@ -2830,7 +2820,7 @@ st10:
|
|||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof10;
|
goto _test_eof10;
|
||||||
case 10:
|
case 10:
|
||||||
#line 2834 "parser.c"
|
#line 2824 "parser.c"
|
||||||
switch( (*p) ) {
|
switch( (*p) ) {
|
||||||
case 13: goto st10;
|
case 13: goto st10;
|
||||||
case 32: goto st10;
|
case 32: goto st10;
|
||||||
@ -2919,7 +2909,7 @@ case 9:
|
|||||||
_out: {}
|
_out: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 1290 "parser.rl"
|
#line 1280 "parser.rl"
|
||||||
|
|
||||||
if (json->stack_handle) {
|
if (json->stack_handle) {
|
||||||
rvalue_stack_eagerly_release(json->stack_handle);
|
rvalue_stack_eagerly_release(json->stack_handle);
|
||||||
@ -2955,16 +2945,16 @@ static VALUE cParser_m_parse(VALUE klass, VALUE source, VALUE opts)
|
|||||||
json->stack = &stack;
|
json->stack = &stack;
|
||||||
|
|
||||||
|
|
||||||
#line 2959 "parser.c"
|
#line 2949 "parser.c"
|
||||||
{
|
{
|
||||||
cs = JSON_start;
|
cs = JSON_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 1325 "parser.rl"
|
#line 1315 "parser.rl"
|
||||||
p = json->source;
|
p = json->source;
|
||||||
pe = p + json->len;
|
pe = p + json->len;
|
||||||
|
|
||||||
#line 2968 "parser.c"
|
#line 2958 "parser.c"
|
||||||
{
|
{
|
||||||
if ( p == pe )
|
if ( p == pe )
|
||||||
goto _test_eof;
|
goto _test_eof;
|
||||||
@ -2998,7 +2988,7 @@ st0:
|
|||||||
cs = 0;
|
cs = 0;
|
||||||
goto _out;
|
goto _out;
|
||||||
tr2:
|
tr2:
|
||||||
#line 1251 "parser.rl"
|
#line 1241 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np = JSON_parse_value(json, p, pe, &result, 0);
|
char *np = JSON_parse_value(json, p, pe, &result, 0);
|
||||||
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
||||||
@ -3008,7 +2998,7 @@ st10:
|
|||||||
if ( ++p == pe )
|
if ( ++p == pe )
|
||||||
goto _test_eof10;
|
goto _test_eof10;
|
||||||
case 10:
|
case 10:
|
||||||
#line 3012 "parser.c"
|
#line 3002 "parser.c"
|
||||||
switch( (*p) ) {
|
switch( (*p) ) {
|
||||||
case 13: goto st10;
|
case 13: goto st10;
|
||||||
case 32: goto st10;
|
case 32: goto st10;
|
||||||
@ -3097,7 +3087,7 @@ case 9:
|
|||||||
_out: {}
|
_out: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 1328 "parser.rl"
|
#line 1318 "parser.rl"
|
||||||
|
|
||||||
if (json->stack_handle) {
|
if (json->stack_handle) {
|
||||||
rvalue_stack_eagerly_release(json->stack_handle);
|
rvalue_stack_eagerly_release(json->stack_handle);
|
||||||
@ -3122,8 +3112,10 @@ static void JSON_mark(void *ptr)
|
|||||||
rb_gc_mark(json->match_string);
|
rb_gc_mark(json->match_string);
|
||||||
rb_gc_mark(json->stack_handle);
|
rb_gc_mark(json->stack_handle);
|
||||||
|
|
||||||
const VALUE *name_cache_entries = &json->name_cache.entries[0];
|
long index;
|
||||||
rb_gc_mark_locations(name_cache_entries, name_cache_entries + json->name_cache.length);
|
for (index = 0; index < json->name_cache.length; index++) {
|
||||||
|
rb_gc_mark(json->name_cache.entries[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void JSON_free(void *ptr)
|
static void JSON_free(void *ptr)
|
||||||
|
@ -26,19 +26,6 @@ static const char deprecated_create_additions_warning[] =
|
|||||||
"and will be removed in 3.0, use JSON.unsafe_load or explicitly "
|
"and will be removed in 3.0, use JSON.unsafe_load or explicitly "
|
||||||
"pass `create_additions: true`";
|
"pass `create_additions: true`";
|
||||||
|
|
||||||
#ifndef HAVE_RB_GC_MARK_LOCATIONS
|
|
||||||
// For TruffleRuby
|
|
||||||
void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
|
|
||||||
{
|
|
||||||
VALUE *value = start;
|
|
||||||
|
|
||||||
while (value < end) {
|
|
||||||
rb_gc_mark(*value);
|
|
||||||
value++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_RB_HASH_BULK_INSERT
|
#ifndef HAVE_RB_HASH_BULK_INSERT
|
||||||
// For TruffleRuby
|
// For TruffleRuby
|
||||||
void rb_hash_bulk_insert(long count, const VALUE *pairs, VALUE hash)
|
void rb_hash_bulk_insert(long count, const VALUE *pairs, VALUE hash)
|
||||||
@ -264,7 +251,10 @@ static inline void rvalue_stack_pop(rvalue_stack *stack, long count)
|
|||||||
static void rvalue_stack_mark(void *ptr)
|
static void rvalue_stack_mark(void *ptr)
|
||||||
{
|
{
|
||||||
rvalue_stack *stack = (rvalue_stack *)ptr;
|
rvalue_stack *stack = (rvalue_stack *)ptr;
|
||||||
rb_gc_mark_locations(stack->ptr, stack->ptr + stack->head);
|
long index;
|
||||||
|
for (index = 0; index < stack->head; index++) {
|
||||||
|
rb_gc_mark(stack->ptr[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rvalue_stack_free(void *ptr)
|
static void rvalue_stack_free(void *ptr)
|
||||||
@ -1349,8 +1339,10 @@ static void JSON_mark(void *ptr)
|
|||||||
rb_gc_mark(json->match_string);
|
rb_gc_mark(json->match_string);
|
||||||
rb_gc_mark(json->stack_handle);
|
rb_gc_mark(json->stack_handle);
|
||||||
|
|
||||||
const VALUE *name_cache_entries = &json->name_cache.entries[0];
|
long index;
|
||||||
rb_gc_mark_locations(name_cache_entries, name_cache_entries + json->name_cache.length);
|
for (index = 0; index < json->name_cache.length; index++) {
|
||||||
|
rb_gc_mark(json->name_cache.entries[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void JSON_free(void *ptr)
|
static void JSON_free(void *ptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user