summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2016-04-24 02:08:30 +0900
committerFlorian Frank <flori@ping.de>2016-06-21 10:56:58 +0200
commit236d43ed1aaa2eeae346d2f6b2304c32b62b8823 (patch)
treed3af0425c7540d99edf1834cfa7771aca79b0e01
parent2d475160b490389060d66980465bb7220b2363e7 (diff)
downloadjson-236d43ed1aaa2eeae346d2f6b2304c32b62b8823.tar.gz
Optional hash in rb_scan_args
Use ':' in rb_scan_args to get optional hash, which available since ruby 2.1.
-rw-r--r--ext/json/ext/parser/parser.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c
index a99b73b..f3e2502 100644
--- a/ext/json/ext/parser/parser.c
+++ b/ext/json/ext/parser/parser.c
@@ -1810,11 +1810,15 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
}
+<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c
<<<<<<< 2e06c964fceb550203659db23971459bc9d35054
#line 1814 "parser.c"
=======
#line 1801 "parser.c"
>>>>>>> Exception encoding
+=======
+#line 1809 "parser.c"
+>>>>>>> Optional hash in rb_scan_args
enum {JSON_start = 1};
enum {JSON_first_final = 10};
enum {JSON_error = 0};
@@ -1822,11 +1826,15 @@ enum {JSON_error = 0};
enum {JSON_en_main = 1};
+<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c
<<<<<<< 2e06c964fceb550203659db23971459bc9d35054
#line 722 "parser.rl"
=======
#line 709 "parser.rl"
>>>>>>> Exception encoding
+=======
+#line 717 "parser.rl"
+>>>>>>> Optional hash in rb_scan_args
/*
@@ -1843,15 +1851,20 @@ static VALUE cParser_parse(VALUE self)
GET_PARSER;
+<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c
<<<<<<< 2e06c964fceb550203659db23971459bc9d35054
#line 1839 "parser.c"
=======
#line 1826 "parser.c"
>>>>>>> Exception encoding
+=======
+#line 1834 "parser.c"
+>>>>>>> Optional hash in rb_scan_args
{
cs = JSON_start;
}
+<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c
<<<<<<< 2e06c964fceb550203659db23971459bc9d35054
#line 738 "parser.rl"
p = json->source;
@@ -1865,6 +1878,13 @@ static VALUE cParser_parse(VALUE self)
#line 1835 "parser.c"
>>>>>>> Exception encoding
+=======
+#line 733 "parser.rl"
+ p = json->source;
+ pe = p + json->len;
+
+#line 1843 "parser.c"
+>>>>>>> Optional hash in rb_scan_args
{
if ( p == pe )
goto _test_eof;
@@ -1898,11 +1918,15 @@ st0:
cs = 0;
goto _out;
tr2:
+<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c
<<<<<<< 2e06c964fceb550203659db23971459bc9d35054
#line 714 "parser.rl"
=======
#line 701 "parser.rl"
>>>>>>> Exception encoding
+=======
+#line 709 "parser.rl"
+>>>>>>> Optional hash in rb_scan_args
{
char *np = JSON_parse_value(json, p, pe, &result);
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -1912,11 +1936,15 @@ st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
+<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c
<<<<<<< 2e06c964fceb550203659db23971459bc9d35054
#line 1892 "parser.c"
=======
#line 1879 "parser.c"
>>>>>>> Exception encoding
+=======
+#line 1887 "parser.c"
+>>>>>>> Optional hash in rb_scan_args
switch( (*p) ) {
case 13: goto st10;
case 32: goto st10;
@@ -2005,11 +2033,15 @@ case 9:
_out: {}
}
+<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c
<<<<<<< 2e06c964fceb550203659db23971459bc9d35054
#line 741 "parser.rl"
=======
#line 728 "parser.rl"
>>>>>>> Exception encoding
+=======
+#line 736 "parser.rl"
+>>>>>>> Optional hash in rb_scan_args
if (cs >= JSON_first_final && p == pe) {
return result;