summaryrefslogtreecommitdiff
path: root/ext/json/parser
diff options
context:
space:
mode:
-rw-r--r--ext/json/parser/parser.c25
-rw-r--r--ext/json/parser/parser.rl9
2 files changed, 20 insertions, 14 deletions
@@ -1798,9 +1798,12 @@ static VALUE convert_encoding(VALUE source)
if (encindex == binary_encindex) {
// For historical reason, we silently reinterpret binary strings as UTF-8 if it would work.
- // TODO: Deprecate in 2.8.0
- // TODO: Remove in 3.0.0
- return rb_enc_associate_index(rb_str_dup(source), utf8_encindex);
}
return rb_str_conv_enc(source, rb_enc_from_index(encindex), rb_utf8_encoding());
@@ -1955,7 +1958,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
}
-#line 1959 "parser.c"
enum {JSON_start = 1};
enum {JSON_first_final = 10};
enum {JSON_error = 0};
@@ -1963,7 +1966,7 @@ enum {JSON_error = 0};
enum {JSON_en_main = 1};
-#line 867 "parser.rl"
/*
@@ -1981,16 +1984,16 @@ static VALUE cParser_parse(VALUE self)
GET_PARSER;
-#line 1985 "parser.c"
{
cs = JSON_start;
}
-#line 884 "parser.rl"
p = json->source;
pe = p + json->len;
-#line 1994 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -2024,7 +2027,7 @@ st0:
cs = 0;
goto _out;
tr2:
-#line 859 "parser.rl"
{
char *np = JSON_parse_value(json, p, pe, &result, 0);
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -2034,7 +2037,7 @@ st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
-#line 2038 "parser.c"
switch( (*p) ) {
case 13: goto st10;
case 32: goto st10;
@@ -2123,7 +2126,7 @@ case 9:
_out: {}
}
-#line 887 "parser.rl"
if (cs >= JSON_first_final && p == pe) {
return result;
@@ -693,9 +693,12 @@ static VALUE convert_encoding(VALUE source)
if (encindex == binary_encindex) {
// For historical reason, we silently reinterpret binary strings as UTF-8 if it would work.
- // TODO: Deprecate in 2.8.0
- // TODO: Remove in 3.0.0
- return rb_enc_associate_index(rb_str_dup(source), utf8_encindex);
}
return rb_str_conv_enc(source, rb_enc_from_index(encindex), rb_utf8_encoding());