diff options
author | Florian Frank <flori@ping.de> | 2011-01-05 00:12:51 +0100 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2011-01-05 00:12:51 +0100 |
commit | 0b15820e245f4048d1bcd29cd60693e4e211ab43 (patch) | |
tree | abffda1af3d23b47739d88fd089609cffa378ed7 /ext | |
parent | c87f6f3022f9b7c1b1317e958976e2ed6d4f4ae4 (diff) | |
download | json-0b15820e245f4048d1bcd29cd60693e4e211ab43.tar.gz |
renamed :match argument to :match_stringv1.5.0
Diffstat (limited to 'ext')
-rw-r--r-- | ext/json/ext/parser/parser.c | 19 | ||||
-rw-r--r-- | ext/json/ext/parser/parser.h | 2 | ||||
-rw-r--r-- | ext/json/ext/parser/parser.rl | 19 |
3 files changed, 21 insertions, 19 deletions
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index a16d068..c125f82 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -79,7 +79,7 @@ static VALUE CNaN, CInfinity, CMinusInfinity; static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions, i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, i_object_class, - i_array_class, i_key_p, i_deep_const_get, i_match; + i_array_class, i_key_p, i_deep_const_get, i_match, i_match_string; #line 108 "parser.rl" @@ -1376,7 +1376,7 @@ match_i(VALUE regexp, VALUE klass, VALUE memo) static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result) { int cs = EVIL; - VALUE match; + VALUE match_string; *result = rb_str_buf_new(0); @@ -1509,11 +1509,11 @@ case 7: #line 494 "parser.rl" - if (json->create_additions && RTEST(match = json->match)) { + if (json->create_additions && RTEST(match_string = json->match_string)) { VALUE klass; VALUE memo = rb_ary_new2(2); rb_ary_push(memo, *result); - rb_hash_foreach(match, match_i, memo); + rb_hash_foreach(match_string, match_i, memo); klass = rb_ary_entry(memo, 1); if (RTEST(klass)) { *result = rb_funcall(klass, i_json_create, 1, *result); @@ -1692,12 +1692,12 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) } else { json->array_class = Qnil; } - tmp = ID2SYM(i_match); + tmp = ID2SYM(i_match_string); if (option_given_p(opts, tmp)) { - VALUE match = rb_hash_aref(opts, tmp); - json->match = RTEST(match) ? match : Qnil; + VALUE match_string = rb_hash_aref(opts, tmp); + json->match_string = RTEST(match_string) ? match_string : Qnil; } else { - json->match = Qnil; + json->match_string = Qnil; } } } else { @@ -1895,7 +1895,7 @@ static void JSON_mark(JSON_Parser *json) rb_gc_mark_maybe(json->create_id); rb_gc_mark_maybe(json->object_class); rb_gc_mark_maybe(json->array_class); - rb_gc_mark_maybe(json->match); + rb_gc_mark_maybe(json->match_string); } static void JSON_free(JSON_Parser *json) @@ -1949,6 +1949,7 @@ void Init_parser() i_object_class = rb_intern("object_class"); i_array_class = rb_intern("array_class"); i_match = rb_intern("match"); + i_match_string = rb_intern("match_string"); i_key_p = rb_intern("key?"); i_deep_const_get = rb_intern("deep_const_get"); #ifdef HAVE_RUBY_ENCODING_H diff --git a/ext/json/ext/parser/parser.h b/ext/json/ext/parser/parser.h index 877ef67..ed48035 100644 --- a/ext/json/ext/parser/parser.h +++ b/ext/json/ext/parser/parser.h @@ -47,7 +47,7 @@ typedef struct JSON_ParserStruct { VALUE object_class; VALUE array_class; int create_additions; - VALUE match; + VALUE match_string; } JSON_Parser; #define GET_PARSER \ diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 53f1dbe..5862698 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -77,7 +77,7 @@ static VALUE CNaN, CInfinity, CMinusInfinity; static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions, i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, i_object_class, - i_array_class, i_key_p, i_deep_const_get, i_match; + i_array_class, i_key_p, i_deep_const_get, i_match, i_match_string; %%{ machine JSON_common; @@ -485,18 +485,18 @@ match_i(VALUE regexp, VALUE klass, VALUE memo) static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result) { int cs = EVIL; - VALUE match; + VALUE match_string; *result = rb_str_buf_new(0); %% write init; json->memo = p; %% write exec; - if (json->create_additions && RTEST(match = json->match)) { + if (json->create_additions && RTEST(match_string = json->match_string)) { VALUE klass; VALUE memo = rb_ary_new2(2); rb_ary_push(memo, *result); - rb_hash_foreach(match, match_i, memo); + rb_hash_foreach(match_string, match_i, memo); klass = rb_ary_entry(memo, 1); if (RTEST(klass)) { *result = rb_funcall(klass, i_json_create, 1, *result); @@ -690,12 +690,12 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) } else { json->array_class = Qnil; } - tmp = ID2SYM(i_match); + tmp = ID2SYM(i_match_string); if (option_given_p(opts, tmp)) { - VALUE match = rb_hash_aref(opts, tmp); - json->match = RTEST(match) ? match : Qnil; + VALUE match_string = rb_hash_aref(opts, tmp); + json->match_string = RTEST(match_string) ? match_string : Qnil; } else { - json->match = Qnil; + json->match_string = Qnil; } } } else { @@ -752,7 +752,7 @@ static void JSON_mark(JSON_Parser *json) rb_gc_mark_maybe(json->create_id); rb_gc_mark_maybe(json->object_class); rb_gc_mark_maybe(json->array_class); - rb_gc_mark_maybe(json->match); + rb_gc_mark_maybe(json->match_string); } static void JSON_free(JSON_Parser *json) @@ -806,6 +806,7 @@ void Init_parser() i_object_class = rb_intern("object_class"); i_array_class = rb_intern("array_class"); i_match = rb_intern("match"); + i_match_string = rb_intern("match_string"); i_key_p = rb_intern("key?"); i_deep_const_get = rb_intern("deep_const_get"); #ifdef HAVE_RUBY_ENCODING_H |