json 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGES.md +33 -0
- data/README.md +16 -0
- data/Rakefile +8 -87
- data/VERSION +1 -1
- data/ext/json/ext/generator/generator.c +71 -1
- data/ext/json/ext/parser/parser.c +71 -70
- data/ext/json/ext/parser/parser.rl +1 -0
- data/json-java.gemspec +3 -3
- data/json.gemspec +0 -0
- data/json_pure.gemspec +8 -13
- data/lib/json.rb +378 -29
- data/lib/json/common.rb +324 -89
- data/lib/json/pure/generator.rb +1 -1
- data/lib/json/pure/parser.rb +2 -2
- data/lib/json/version.rb +1 -1
- data/tests/json_fixtures_test.rb +6 -1
- metadata +23 -13
- data/LICENSE +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80444509bc162d6df8e9cc3e7af2fc28507c06aef49cbfc1dd9e5990af42b14f
|
4
|
+
data.tar.gz: 8541be9708b44604eeeecac22f89c47933d32c90606f23c1d37e70c8b2d3e9db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1df7b5ee2bf58103f0b5776c4a581aa3b013ad4b3a85a442d37bb72dc62aaf04dc42ed1080fb307fec1d1e9128c9f21e43827c7f15494cb0f9f310f7189bdc5e
|
7
|
+
data.tar.gz: 15ba56ce5d0e04c5326feb9e9faf2627628a715fa4bbeaec5c4aadeab5f27a65135f4f24f142b361f62ca37bbf36380f671d7ae35d46991737e4fc62423a6f9b
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,5 +1,38 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## 2020-06-30 (2.3.1)
|
4
|
+
|
5
|
+
* Spelling and grammar fixes for comments. Pull request #191 by Josh
|
6
|
+
Kline.
|
7
|
+
* Enhance generic JSON and #generate docs. Pull request #347 by Victor
|
8
|
+
Shepelev.
|
9
|
+
* Add :nodoc: for GeneratorMethods. Pull request #349 by Victor Shepelev.
|
10
|
+
* Baseline changes to help (JRuby) development. Pull request #371 by Karol
|
11
|
+
Bucek.
|
12
|
+
* Add metadata for rubygems.org. Pull request #379 by Alexandre ZANNI.
|
13
|
+
* Remove invalid JSON.generate description from JSON module rdoc. Pull
|
14
|
+
request #384 by Jeremy Evans.
|
15
|
+
* Test with TruffleRuby in CI. Pull request #402 by Benoit Daloze.
|
16
|
+
* Rdoc enhancements. Pull request #413 by Burdette Lamar.
|
17
|
+
* Fixtures/ are not being tested... Pull request #416 by Marc-André
|
18
|
+
Lafortune.
|
19
|
+
* Use frozen string for hash key. Pull request #420 by Marc-André
|
20
|
+
Lafortune.
|
21
|
+
* Added :call-seq: to RDoc for some methods. Pull request #422 by Burdette
|
22
|
+
Lamar.
|
23
|
+
* Small typo fix. Pull request #423 by Marc-André Lafortune.
|
24
|
+
|
25
|
+
## 2019-12-11 (2.3.0)
|
26
|
+
* Fix default of `create_additions` to always be `false` for `JSON(user_input)`
|
27
|
+
and `JSON.parse(user_input, nil)`.
|
28
|
+
Note that `JSON.load` remains with default `true` and is meant for internal
|
29
|
+
serialization of trusted data. [CVE-2020-10663]
|
30
|
+
* Fix passing args all #to_json in json/add/*.
|
31
|
+
* Fix encoding issues
|
32
|
+
* Fix issues of keyword vs positional parameter
|
33
|
+
* Fix JSON::Parser against bigdecimal updates
|
34
|
+
* Bug fixes to JRuby port
|
35
|
+
|
3
36
|
## 2019-02-21 (2.2.0)
|
4
37
|
* Adds support for 2.6 BigDecimal and ruby standard library Set datetype.
|
5
38
|
|
data/README.md
CHANGED
@@ -390,6 +390,22 @@ Here are the median comparisons for completeness' sake:
|
|
390
390
|
secs/call
|
391
391
|
```
|
392
392
|
|
393
|
+
## Development
|
394
|
+
|
395
|
+
### Release
|
396
|
+
|
397
|
+
Update the json.gemspec and json-java.gemspec.
|
398
|
+
|
399
|
+
```
|
400
|
+
rbenv shell 2.6.5
|
401
|
+
rake build
|
402
|
+
gem push pkg/json-2.3.0.gem
|
403
|
+
|
404
|
+
rbenv shell jruby-9.2.9.0
|
405
|
+
rake build
|
406
|
+
gem push pkg/json-2.3.0-java.gem
|
407
|
+
```
|
408
|
+
|
393
409
|
## Author
|
394
410
|
|
395
411
|
Florian Frank <mailto:flori@ping.de>
|
data/Rakefile
CHANGED
@@ -78,86 +78,6 @@ task :install_ext => [ :compile, :install_pure, :install_ext_really ]
|
|
78
78
|
desc "Installing library (extension)"
|
79
79
|
task :install => :install_ext
|
80
80
|
|
81
|
-
if defined?(Gem) and defined?(Gem::PackageTask)
|
82
|
-
spec_pure = Gem::Specification.new do |s|
|
83
|
-
s.name = 'json_pure'
|
84
|
-
s.version = PKG_VERSION
|
85
|
-
s.summary = PKG_TITLE
|
86
|
-
s.description = "This is a JSON implementation in pure Ruby."
|
87
|
-
|
88
|
-
s.files = PKG_FILES
|
89
|
-
|
90
|
-
s.require_path = 'lib'
|
91
|
-
s.add_development_dependency 'rake'
|
92
|
-
s.add_development_dependency 'test-unit', '~> 2.0'
|
93
|
-
|
94
|
-
s.extra_rdoc_files << 'README.md'
|
95
|
-
s.rdoc_options <<
|
96
|
-
'--title' << 'JSON implemention for ruby' << '--main' << 'README.md'
|
97
|
-
s.test_files.concat Dir['./tests/test_*.rb']
|
98
|
-
|
99
|
-
s.author = "Florian Frank"
|
100
|
-
s.email = "flori@ping.de"
|
101
|
-
s.homepage = "http://flori.github.com/#{PKG_NAME}"
|
102
|
-
s.license = 'Ruby'
|
103
|
-
s.required_ruby_version = '>= 1.9'
|
104
|
-
end
|
105
|
-
|
106
|
-
desc 'Creates a json_pure.gemspec file'
|
107
|
-
task :gemspec_pure => :version do
|
108
|
-
File.open('json_pure.gemspec', 'w') do |gemspec|
|
109
|
-
gemspec.write spec_pure.to_ruby
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
Gem::PackageTask.new(spec_pure) do |pkg|
|
114
|
-
pkg.need_tar = true
|
115
|
-
pkg.package_files = PKG_FILES
|
116
|
-
end
|
117
|
-
|
118
|
-
spec_ext = Gem::Specification.new do |s|
|
119
|
-
s.name = 'json'
|
120
|
-
s.version = PKG_VERSION
|
121
|
-
s.summary = PKG_TITLE
|
122
|
-
s.description = "This is a JSON implementation as a Ruby extension in C."
|
123
|
-
|
124
|
-
s.files = PKG_FILES
|
125
|
-
|
126
|
-
s.extensions = FileList['ext/**/extconf.rb']
|
127
|
-
|
128
|
-
s.require_path = 'lib'
|
129
|
-
s.add_development_dependency 'rake'
|
130
|
-
s.add_development_dependency 'test-unit', '~> 2.0'
|
131
|
-
|
132
|
-
s.extra_rdoc_files << 'README.md'
|
133
|
-
s.rdoc_options <<
|
134
|
-
'--title' << 'JSON implemention for Ruby' << '--main' << 'README.md'
|
135
|
-
s.test_files.concat Dir['./tests/test_*.rb']
|
136
|
-
|
137
|
-
s.author = "Florian Frank"
|
138
|
-
s.email = "flori@ping.de"
|
139
|
-
s.homepage = "http://flori.github.com/#{PKG_NAME}"
|
140
|
-
s.license = 'Ruby'
|
141
|
-
s.required_ruby_version = '>= 1.9'
|
142
|
-
end
|
143
|
-
|
144
|
-
desc 'Creates a json.gemspec file'
|
145
|
-
task :gemspec_ext => :version do
|
146
|
-
File.open('json.gemspec', 'w') do |gemspec|
|
147
|
-
gemspec.write spec_ext.to_ruby
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
Gem::PackageTask.new(spec_ext) do |pkg|
|
152
|
-
pkg.need_tar = true
|
153
|
-
pkg.package_files = PKG_FILES
|
154
|
-
end
|
155
|
-
|
156
|
-
|
157
|
-
desc 'Create all gemspec files'
|
158
|
-
task :gemspec => [ :gemspec_pure, :gemspec_ext ]
|
159
|
-
end
|
160
|
-
|
161
81
|
desc m = "Writing version information for #{PKG_VERSION}"
|
162
82
|
task :version do
|
163
83
|
puts m
|
@@ -181,7 +101,8 @@ task :check_env do
|
|
181
101
|
end
|
182
102
|
|
183
103
|
desc "Testing library (pure ruby)"
|
184
|
-
task :test_pure => [ :
|
104
|
+
task :test_pure => [ :set_env_pure, :check_env, :do_test_pure ]
|
105
|
+
task(:set_env_pure) { ENV['JSON'] = 'pure' }
|
185
106
|
|
186
107
|
UndocumentedTestTask.new do |t|
|
187
108
|
t.name = 'do_test_pure'
|
@@ -192,10 +113,7 @@ UndocumentedTestTask.new do |t|
|
|
192
113
|
end
|
193
114
|
|
194
115
|
desc "Testing library (pure ruby and extension)"
|
195
|
-
task :test
|
196
|
-
sh "env JSON=pure #{BUNDLE} exec rake test_pure" or exit 1
|
197
|
-
sh "env JSON=ext #{BUNDLE} exec rake test_ext" or exit 1
|
198
|
-
end
|
116
|
+
task :test => [ :test_pure, :test_ext ]
|
199
117
|
|
200
118
|
namespace :gems do
|
201
119
|
desc 'Install all development gems'
|
@@ -262,7 +180,8 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
|
|
262
180
|
end
|
263
181
|
|
264
182
|
desc "Testing library (jruby)"
|
265
|
-
task :test_ext => [ :
|
183
|
+
task :test_ext => [ :set_env_ext, :create_jar, :check_env, :do_test_ext ]
|
184
|
+
task(:set_env_ext) { ENV['JSON'] = 'ext' }
|
266
185
|
|
267
186
|
UndocumentedTestTask.new do |t|
|
268
187
|
t.name = 'do_test_ext'
|
@@ -368,6 +287,8 @@ else
|
|
368
287
|
end
|
369
288
|
src = File.read("parser.c").gsub(/[ \t]+$/, '')
|
370
289
|
src.gsub!(/^static const int (JSON_.*=.*);$/, 'enum {\1};')
|
290
|
+
src.gsub!(/0 <= \(\*p\) && \(\*p\) <= 31/, "0 <= (signed char)(*p) && (*p) <= 31")
|
291
|
+
src[0, 0] = "/* This file is automatically generated from parser.rl by using ragel */"
|
371
292
|
File.open("parser.c", "w") {|f| f.print src}
|
372
293
|
end
|
373
294
|
end
|
@@ -410,4 +331,4 @@ else
|
|
410
331
|
end
|
411
332
|
|
412
333
|
desc "Compile in the the source directory"
|
413
|
-
task :default => [ :clean, :
|
334
|
+
task :default => [ :clean, :test ]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.1
|
@@ -328,6 +328,76 @@ static char *fstrndup(const char *ptr, unsigned long len) {
|
|
328
328
|
*
|
329
329
|
*/
|
330
330
|
|
331
|
+
/* Explanation of the following: that's the only way to not pollute
|
332
|
+
* standard library's docs with GeneratorMethods::<ClassName> which
|
333
|
+
* are uninformative and take a large place in a list of classes
|
334
|
+
*/
|
335
|
+
|
336
|
+
/*
|
337
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods
|
338
|
+
* :nodoc:
|
339
|
+
*/
|
340
|
+
|
341
|
+
/*
|
342
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::Array
|
343
|
+
* :nodoc:
|
344
|
+
*/
|
345
|
+
|
346
|
+
/*
|
347
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::Bignum
|
348
|
+
* :nodoc:
|
349
|
+
*/
|
350
|
+
|
351
|
+
/*
|
352
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::FalseClass
|
353
|
+
* :nodoc:
|
354
|
+
*/
|
355
|
+
|
356
|
+
/*
|
357
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::Fixnum
|
358
|
+
* :nodoc:
|
359
|
+
*/
|
360
|
+
|
361
|
+
/*
|
362
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::Float
|
363
|
+
* :nodoc:
|
364
|
+
*/
|
365
|
+
|
366
|
+
/*
|
367
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::Hash
|
368
|
+
* :nodoc:
|
369
|
+
*/
|
370
|
+
|
371
|
+
/*
|
372
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::Integer
|
373
|
+
* :nodoc:
|
374
|
+
*/
|
375
|
+
|
376
|
+
/*
|
377
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::NilClass
|
378
|
+
* :nodoc:
|
379
|
+
*/
|
380
|
+
|
381
|
+
/*
|
382
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::Object
|
383
|
+
* :nodoc:
|
384
|
+
*/
|
385
|
+
|
386
|
+
/*
|
387
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::String
|
388
|
+
* :nodoc:
|
389
|
+
*/
|
390
|
+
|
391
|
+
/*
|
392
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::String::Extend
|
393
|
+
* :nodoc:
|
394
|
+
*/
|
395
|
+
|
396
|
+
/*
|
397
|
+
* Document-module: JSON::Ext::Generator::GeneratorMethods::TrueClass
|
398
|
+
* :nodoc:
|
399
|
+
*/
|
400
|
+
|
331
401
|
/*
|
332
402
|
* call-seq: to_json(state = nil)
|
333
403
|
*
|
@@ -1026,7 +1096,7 @@ static VALUE cState_generate(VALUE self, VALUE obj)
|
|
1026
1096
|
* generated, otherwise an exception is thrown, if these values are
|
1027
1097
|
* encountered. This options defaults to false.
|
1028
1098
|
* * *ascii_only*: true if only ASCII characters should be generated. This
|
1029
|
-
*
|
1099
|
+
* option defaults to false.
|
1030
1100
|
* * *buffer_initial_length*: sets the initial length of the generator's
|
1031
1101
|
* internal buffer.
|
1032
1102
|
*/
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
/* This file is automatically generated from parser.rl by using ragel */
|
2
2
|
#line 1 "parser.rl"
|
3
3
|
#include "../fbuffer/fbuffer.h"
|
4
4
|
#include "parser.h"
|
@@ -112,7 +112,7 @@ enum {JSON_object_error = 0};
|
|
112
112
|
enum {JSON_object_en_main = 1};
|
113
113
|
|
114
114
|
|
115
|
-
#line
|
115
|
+
#line 168 "parser.rl"
|
116
116
|
|
117
117
|
|
118
118
|
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
|
@@ -133,7 +133,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|
133
133
|
cs = JSON_object_start;
|
134
134
|
}
|
135
135
|
|
136
|
-
#line
|
136
|
+
#line 183 "parser.rl"
|
137
137
|
|
138
138
|
#line 139 "parser.c"
|
139
139
|
{
|
@@ -163,7 +163,7 @@ case 2:
|
|
163
163
|
goto st2;
|
164
164
|
goto st0;
|
165
165
|
tr2:
|
166
|
-
#line
|
166
|
+
#line 150 "parser.rl"
|
167
167
|
{
|
168
168
|
char *np;
|
169
169
|
json->parsing_name = 1;
|
@@ -251,6 +251,7 @@ tr11:
|
|
251
251
|
p--; {p++; cs = 9; goto _out;}
|
252
252
|
} else {
|
253
253
|
if (NIL_P(json->object_class)) {
|
254
|
+
OBJ_FREEZE(last_name);
|
254
255
|
rb_hash_aset(*result, last_name, v);
|
255
256
|
} else {
|
256
257
|
rb_funcall(*result, i_aset, 2, last_name, v);
|
@@ -263,7 +264,7 @@ st9:
|
|
263
264
|
if ( ++p == pe )
|
264
265
|
goto _test_eof9;
|
265
266
|
case 9:
|
266
|
-
#line
|
267
|
+
#line 268 "parser.c"
|
267
268
|
switch( (*p) ) {
|
268
269
|
case 13: goto st9;
|
269
270
|
case 32: goto st9;
|
@@ -352,14 +353,14 @@ case 18:
|
|
352
353
|
goto st9;
|
353
354
|
goto st18;
|
354
355
|
tr4:
|
355
|
-
#line
|
356
|
+
#line 158 "parser.rl"
|
356
357
|
{ p--; {p++; cs = 27; goto _out;} }
|
357
358
|
goto st27;
|
358
359
|
st27:
|
359
360
|
if ( ++p == pe )
|
360
361
|
goto _test_eof27;
|
361
362
|
case 27:
|
362
|
-
#line
|
363
|
+
#line 364 "parser.c"
|
363
364
|
goto st0;
|
364
365
|
st19:
|
365
366
|
if ( ++p == pe )
|
@@ -457,7 +458,7 @@ case 26:
|
|
457
458
|
_out: {}
|
458
459
|
}
|
459
460
|
|
460
|
-
#line
|
461
|
+
#line 184 "parser.rl"
|
461
462
|
|
462
463
|
if (cs >= JSON_object_first_final) {
|
463
464
|
if (json->create_additions) {
|
@@ -482,7 +483,7 @@ case 26:
|
|
482
483
|
|
483
484
|
|
484
485
|
|
485
|
-
#line
|
486
|
+
#line 487 "parser.c"
|
486
487
|
enum {JSON_value_start = 1};
|
487
488
|
enum {JSON_value_first_final = 29};
|
488
489
|
enum {JSON_value_error = 0};
|
@@ -490,7 +491,7 @@ enum {JSON_value_error = 0};
|
|
490
491
|
enum {JSON_value_en_main = 1};
|
491
492
|
|
492
493
|
|
493
|
-
#line
|
494
|
+
#line 284 "parser.rl"
|
494
495
|
|
495
496
|
|
496
497
|
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
|
@@ -498,14 +499,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
498
499
|
int cs = EVIL;
|
499
500
|
|
500
501
|
|
501
|
-
#line
|
502
|
+
#line 503 "parser.c"
|
502
503
|
{
|
503
504
|
cs = JSON_value_start;
|
504
505
|
}
|
505
506
|
|
506
|
-
#line
|
507
|
+
#line 291 "parser.rl"
|
507
508
|
|
508
|
-
#line
|
509
|
+
#line 510 "parser.c"
|
509
510
|
{
|
510
511
|
if ( p == pe )
|
511
512
|
goto _test_eof;
|
@@ -539,14 +540,14 @@ st0:
|
|
539
540
|
cs = 0;
|
540
541
|
goto _out;
|
541
542
|
tr2:
|
542
|
-
#line
|
543
|
+
#line 236 "parser.rl"
|
543
544
|
{
|
544
545
|
char *np = JSON_parse_string(json, p, pe, result);
|
545
546
|
if (np == NULL) { p--; {p++; cs = 29; goto _out;} } else {p = (( np))-1;}
|
546
547
|
}
|
547
548
|
goto st29;
|
548
549
|
tr3:
|
549
|
-
#line
|
550
|
+
#line 241 "parser.rl"
|
550
551
|
{
|
551
552
|
char *np;
|
552
553
|
if(pe > p + 8 && !strncmp(MinusInfinity, p, 9)) {
|
@@ -566,7 +567,7 @@ tr3:
|
|
566
567
|
}
|
567
568
|
goto st29;
|
568
569
|
tr7:
|
569
|
-
#line
|
570
|
+
#line 259 "parser.rl"
|
570
571
|
{
|
571
572
|
char *np;
|
572
573
|
np = JSON_parse_array(json, p, pe, result, current_nesting + 1);
|
@@ -574,7 +575,7 @@ tr7:
|
|
574
575
|
}
|
575
576
|
goto st29;
|
576
577
|
tr11:
|
577
|
-
#line
|
578
|
+
#line 265 "parser.rl"
|
578
579
|
{
|
579
580
|
char *np;
|
580
581
|
np = JSON_parse_object(json, p, pe, result, current_nesting + 1);
|
@@ -582,7 +583,7 @@ tr11:
|
|
582
583
|
}
|
583
584
|
goto st29;
|
584
585
|
tr25:
|
585
|
-
#line
|
586
|
+
#line 229 "parser.rl"
|
586
587
|
{
|
587
588
|
if (json->allow_nan) {
|
588
589
|
*result = CInfinity;
|
@@ -592,7 +593,7 @@ tr25:
|
|
592
593
|
}
|
593
594
|
goto st29;
|
594
595
|
tr27:
|
595
|
-
#line
|
596
|
+
#line 222 "parser.rl"
|
596
597
|
{
|
597
598
|
if (json->allow_nan) {
|
598
599
|
*result = CNaN;
|
@@ -602,19 +603,19 @@ tr27:
|
|
602
603
|
}
|
603
604
|
goto st29;
|
604
605
|
tr31:
|
605
|
-
#line
|
606
|
+
#line 216 "parser.rl"
|
606
607
|
{
|
607
608
|
*result = Qfalse;
|
608
609
|
}
|
609
610
|
goto st29;
|
610
611
|
tr34:
|
611
|
-
#line
|
612
|
+
#line 213 "parser.rl"
|
612
613
|
{
|
613
614
|
*result = Qnil;
|
614
615
|
}
|
615
616
|
goto st29;
|
616
617
|
tr37:
|
617
|
-
#line
|
618
|
+
#line 219 "parser.rl"
|
618
619
|
{
|
619
620
|
*result = Qtrue;
|
620
621
|
}
|
@@ -623,9 +624,9 @@ st29:
|
|
623
624
|
if ( ++p == pe )
|
624
625
|
goto _test_eof29;
|
625
626
|
case 29:
|
626
|
-
#line
|
627
|
+
#line 271 "parser.rl"
|
627
628
|
{ p--; {p++; cs = 29; goto _out;} }
|
628
|
-
#line
|
629
|
+
#line 630 "parser.c"
|
629
630
|
switch( (*p) ) {
|
630
631
|
case 13: goto st29;
|
631
632
|
case 32: goto st29;
|
@@ -866,7 +867,7 @@ case 28:
|
|
866
867
|
_out: {}
|
867
868
|
}
|
868
869
|
|
869
|
-
#line
|
870
|
+
#line 292 "parser.rl"
|
870
871
|
|
871
872
|
if (cs >= JSON_value_first_final) {
|
872
873
|
return p;
|
@@ -876,7 +877,7 @@ case 28:
|
|
876
877
|
}
|
877
878
|
|
878
879
|
|
879
|
-
#line
|
880
|
+
#line 881 "parser.c"
|
880
881
|
enum {JSON_integer_start = 1};
|
881
882
|
enum {JSON_integer_first_final = 3};
|
882
883
|
enum {JSON_integer_error = 0};
|
@@ -884,7 +885,7 @@ enum {JSON_integer_error = 0};
|
|
884
885
|
enum {JSON_integer_en_main = 1};
|
885
886
|
|
886
887
|
|
887
|
-
#line
|
888
|
+
#line 308 "parser.rl"
|
888
889
|
|
889
890
|
|
890
891
|
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -892,15 +893,15 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res
|
|
892
893
|
int cs = EVIL;
|
893
894
|
|
894
895
|
|
895
|
-
#line
|
896
|
+
#line 897 "parser.c"
|
896
897
|
{
|
897
898
|
cs = JSON_integer_start;
|
898
899
|
}
|
899
900
|
|
900
|
-
#line
|
901
|
+
#line 315 "parser.rl"
|
901
902
|
json->memo = p;
|
902
903
|
|
903
|
-
#line
|
904
|
+
#line 905 "parser.c"
|
904
905
|
{
|
905
906
|
if ( p == pe )
|
906
907
|
goto _test_eof;
|
@@ -934,14 +935,14 @@ case 3:
|
|
934
935
|
goto st0;
|
935
936
|
goto tr4;
|
936
937
|
tr4:
|
937
|
-
#line
|
938
|
+
#line 305 "parser.rl"
|
938
939
|
{ p--; {p++; cs = 4; goto _out;} }
|
939
940
|
goto st4;
|
940
941
|
st4:
|
941
942
|
if ( ++p == pe )
|
942
943
|
goto _test_eof4;
|
943
944
|
case 4:
|
944
|
-
#line
|
945
|
+
#line 946 "parser.c"
|
945
946
|
goto st0;
|
946
947
|
st5:
|
947
948
|
if ( ++p == pe )
|
@@ -960,7 +961,7 @@ case 5:
|
|
960
961
|
_out: {}
|
961
962
|
}
|
962
963
|
|
963
|
-
#line
|
964
|
+
#line 317 "parser.rl"
|
964
965
|
|
965
966
|
if (cs >= JSON_integer_first_final) {
|
966
967
|
long len = p - json->memo;
|
@@ -975,7 +976,7 @@ case 5:
|
|
975
976
|
}
|
976
977
|
|
977
978
|
|
978
|
-
#line
|
979
|
+
#line 980 "parser.c"
|
979
980
|
enum {JSON_float_start = 1};
|
980
981
|
enum {JSON_float_first_final = 8};
|
981
982
|
enum {JSON_float_error = 0};
|
@@ -983,7 +984,7 @@ enum {JSON_float_error = 0};
|
|
983
984
|
enum {JSON_float_en_main = 1};
|
984
985
|
|
985
986
|
|
986
|
-
#line
|
987
|
+
#line 342 "parser.rl"
|
987
988
|
|
988
989
|
|
989
990
|
static int is_bigdecimal_class(VALUE obj)
|
@@ -1004,15 +1005,15 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
1004
1005
|
int cs = EVIL;
|
1005
1006
|
|
1006
1007
|
|
1007
|
-
#line
|
1008
|
+
#line 1009 "parser.c"
|
1008
1009
|
{
|
1009
1010
|
cs = JSON_float_start;
|
1010
1011
|
}
|
1011
1012
|
|
1012
|
-
#line
|
1013
|
+
#line 362 "parser.rl"
|
1013
1014
|
json->memo = p;
|
1014
1015
|
|
1015
|
-
#line
|
1016
|
+
#line 1017 "parser.c"
|
1016
1017
|
{
|
1017
1018
|
if ( p == pe )
|
1018
1019
|
goto _test_eof;
|
@@ -1070,14 +1071,14 @@ case 8:
|
|
1070
1071
|
goto st0;
|
1071
1072
|
goto tr9;
|
1072
1073
|
tr9:
|
1073
|
-
#line
|
1074
|
+
#line 336 "parser.rl"
|
1074
1075
|
{ p--; {p++; cs = 9; goto _out;} }
|
1075
1076
|
goto st9;
|
1076
1077
|
st9:
|
1077
1078
|
if ( ++p == pe )
|
1078
1079
|
goto _test_eof9;
|
1079
1080
|
case 9:
|
1080
|
-
#line
|
1081
|
+
#line 1082 "parser.c"
|
1081
1082
|
goto st0;
|
1082
1083
|
st5:
|
1083
1084
|
if ( ++p == pe )
|
@@ -1138,7 +1139,7 @@ case 7:
|
|
1138
1139
|
_out: {}
|
1139
1140
|
}
|
1140
1141
|
|
1141
|
-
#line
|
1142
|
+
#line 364 "parser.rl"
|
1142
1143
|
|
1143
1144
|
if (cs >= JSON_float_first_final) {
|
1144
1145
|
long len = p - json->memo;
|
@@ -1164,7 +1165,7 @@ case 7:
|
|
1164
1165
|
|
1165
1166
|
|
1166
1167
|
|
1167
|
-
#line
|
1168
|
+
#line 1169 "parser.c"
|
1168
1169
|
enum {JSON_array_start = 1};
|
1169
1170
|
enum {JSON_array_first_final = 17};
|
1170
1171
|
enum {JSON_array_error = 0};
|
@@ -1172,7 +1173,7 @@ enum {JSON_array_error = 0};
|
|
1172
1173
|
enum {JSON_array_en_main = 1};
|
1173
1174
|
|
1174
1175
|
|
1175
|
-
#line
|
1176
|
+
#line 417 "parser.rl"
|
1176
1177
|
|
1177
1178
|
|
1178
1179
|
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
|
@@ -1186,14 +1187,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
1186
1187
|
*result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class);
|
1187
1188
|
|
1188
1189
|
|
1189
|
-
#line
|
1190
|
+
#line 1191 "parser.c"
|
1190
1191
|
{
|
1191
1192
|
cs = JSON_array_start;
|
1192
1193
|
}
|
1193
1194
|
|
1194
|
-
#line
|
1195
|
+
#line 430 "parser.rl"
|
1195
1196
|
|
1196
|
-
#line
|
1197
|
+
#line 1198 "parser.c"
|
1197
1198
|
{
|
1198
1199
|
if ( p == pe )
|
1199
1200
|
goto _test_eof;
|
@@ -1232,7 +1233,7 @@ case 2:
|
|
1232
1233
|
goto st2;
|
1233
1234
|
goto st0;
|
1234
1235
|
tr2:
|
1235
|
-
#line
|
1236
|
+
#line 394 "parser.rl"
|
1236
1237
|
{
|
1237
1238
|
VALUE v = Qnil;
|
1238
1239
|
char *np = JSON_parse_value(json, p, pe, &v, current_nesting);
|
@@ -1252,7 +1253,7 @@ st3:
|
|
1252
1253
|
if ( ++p == pe )
|
1253
1254
|
goto _test_eof3;
|
1254
1255
|
case 3:
|
1255
|
-
#line
|
1256
|
+
#line 1257 "parser.c"
|
1256
1257
|
switch( (*p) ) {
|
1257
1258
|
case 13: goto st3;
|
1258
1259
|
case 32: goto st3;
|
@@ -1352,14 +1353,14 @@ case 12:
|
|
1352
1353
|
goto st3;
|
1353
1354
|
goto st12;
|
1354
1355
|
tr4:
|
1355
|
-
#line
|
1356
|
+
#line 409 "parser.rl"
|
1356
1357
|
{ p--; {p++; cs = 17; goto _out;} }
|
1357
1358
|
goto st17;
|
1358
1359
|
st17:
|
1359
1360
|
if ( ++p == pe )
|
1360
1361
|
goto _test_eof17;
|
1361
1362
|
case 17:
|
1362
|
-
#line
|
1363
|
+
#line 1364 "parser.c"
|
1363
1364
|
goto st0;
|
1364
1365
|
st13:
|
1365
1366
|
if ( ++p == pe )
|
@@ -1415,7 +1416,7 @@ case 16:
|
|
1415
1416
|
_out: {}
|
1416
1417
|
}
|
1417
1418
|
|
1418
|
-
#line
|
1419
|
+
#line 431 "parser.rl"
|
1419
1420
|
|
1420
1421
|
if(cs >= JSON_array_first_final) {
|
1421
1422
|
return p + 1;
|
@@ -1504,7 +1505,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
|
|
1504
1505
|
}
|
1505
1506
|
|
1506
1507
|
|
1507
|
-
#line
|
1508
|
+
#line 1509 "parser.c"
|
1508
1509
|
enum {JSON_string_start = 1};
|
1509
1510
|
enum {JSON_string_first_final = 8};
|
1510
1511
|
enum {JSON_string_error = 0};
|
@@ -1512,7 +1513,7 @@ enum {JSON_string_error = 0};
|
|
1512
1513
|
enum {JSON_string_en_main = 1};
|
1513
1514
|
|
1514
1515
|
|
1515
|
-
#line
|
1516
|
+
#line 538 "parser.rl"
|
1516
1517
|
|
1517
1518
|
|
1518
1519
|
static int
|
@@ -1534,15 +1535,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|
1534
1535
|
|
1535
1536
|
*result = rb_str_buf_new(0);
|
1536
1537
|
|
1537
|
-
#line
|
1538
|
+
#line 1539 "parser.c"
|
1538
1539
|
{
|
1539
1540
|
cs = JSON_string_start;
|
1540
1541
|
}
|
1541
1542
|
|
1542
|
-
#line
|
1543
|
+
#line 559 "parser.rl"
|
1543
1544
|
json->memo = p;
|
1544
1545
|
|
1545
|
-
#line
|
1546
|
+
#line 1547 "parser.c"
|
1546
1547
|
{
|
1547
1548
|
if ( p == pe )
|
1548
1549
|
goto _test_eof;
|
@@ -1563,11 +1564,11 @@ case 2:
|
|
1563
1564
|
case 34: goto tr2;
|
1564
1565
|
case 92: goto st3;
|
1565
1566
|
}
|
1566
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
1567
|
+
if ( 0 <= (signed char)(*p) && (*p) <= 31 )
|
1567
1568
|
goto st0;
|
1568
1569
|
goto st2;
|
1569
1570
|
tr2:
|
1570
|
-
#line
|
1571
|
+
#line 524 "parser.rl"
|
1571
1572
|
{
|
1572
1573
|
*result = json_string_unescape(*result, json->memo + 1, p);
|
1573
1574
|
if (NIL_P(*result)) {
|
@@ -1578,14 +1579,14 @@ tr2:
|
|
1578
1579
|
{p = (( p + 1))-1;}
|
1579
1580
|
}
|
1580
1581
|
}
|
1581
|
-
#line
|
1582
|
+
#line 535 "parser.rl"
|
1582
1583
|
{ p--; {p++; cs = 8; goto _out;} }
|
1583
1584
|
goto st8;
|
1584
1585
|
st8:
|
1585
1586
|
if ( ++p == pe )
|
1586
1587
|
goto _test_eof8;
|
1587
1588
|
case 8:
|
1588
|
-
#line
|
1589
|
+
#line 1590 "parser.c"
|
1589
1590
|
goto st0;
|
1590
1591
|
st3:
|
1591
1592
|
if ( ++p == pe )
|
@@ -1593,7 +1594,7 @@ st3:
|
|
1593
1594
|
case 3:
|
1594
1595
|
if ( (*p) == 117 )
|
1595
1596
|
goto st4;
|
1596
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
1597
|
+
if ( 0 <= (signed char)(*p) && (*p) <= 31 )
|
1597
1598
|
goto st0;
|
1598
1599
|
goto st2;
|
1599
1600
|
st4:
|
@@ -1661,7 +1662,7 @@ case 7:
|
|
1661
1662
|
_out: {}
|
1662
1663
|
}
|
1663
1664
|
|
1664
|
-
#line
|
1665
|
+
#line 561 "parser.rl"
|
1665
1666
|
|
1666
1667
|
if (json->create_additions && RTEST(match_string = json->match_string)) {
|
1667
1668
|
VALUE klass;
|
@@ -1848,7 +1849,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|
1848
1849
|
}
|
1849
1850
|
|
1850
1851
|
|
1851
|
-
#line
|
1852
|
+
#line 1853 "parser.c"
|
1852
1853
|
enum {JSON_start = 1};
|
1853
1854
|
enum {JSON_first_final = 10};
|
1854
1855
|
enum {JSON_error = 0};
|
@@ -1856,7 +1857,7 @@ enum {JSON_error = 0};
|
|
1856
1857
|
enum {JSON_en_main = 1};
|
1857
1858
|
|
1858
1859
|
|
1859
|
-
#line
|
1860
|
+
#line 761 "parser.rl"
|
1860
1861
|
|
1861
1862
|
|
1862
1863
|
/*
|
@@ -1873,16 +1874,16 @@ static VALUE cParser_parse(VALUE self)
|
|
1873
1874
|
GET_PARSER;
|
1874
1875
|
|
1875
1876
|
|
1876
|
-
#line
|
1877
|
+
#line 1878 "parser.c"
|
1877
1878
|
{
|
1878
1879
|
cs = JSON_start;
|
1879
1880
|
}
|
1880
1881
|
|
1881
|
-
#line
|
1882
|
+
#line 777 "parser.rl"
|
1882
1883
|
p = json->source;
|
1883
1884
|
pe = p + json->len;
|
1884
1885
|
|
1885
|
-
#line
|
1886
|
+
#line 1887 "parser.c"
|
1886
1887
|
{
|
1887
1888
|
if ( p == pe )
|
1888
1889
|
goto _test_eof;
|
@@ -1916,7 +1917,7 @@ st0:
|
|
1916
1917
|
cs = 0;
|
1917
1918
|
goto _out;
|
1918
1919
|
tr2:
|
1919
|
-
#line
|
1920
|
+
#line 753 "parser.rl"
|
1920
1921
|
{
|
1921
1922
|
char *np = JSON_parse_value(json, p, pe, &result, 0);
|
1922
1923
|
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
@@ -1926,7 +1927,7 @@ st10:
|
|
1926
1927
|
if ( ++p == pe )
|
1927
1928
|
goto _test_eof10;
|
1928
1929
|
case 10:
|
1929
|
-
#line
|
1930
|
+
#line 1931 "parser.c"
|
1930
1931
|
switch( (*p) ) {
|
1931
1932
|
case 13: goto st10;
|
1932
1933
|
case 32: goto st10;
|
@@ -2015,7 +2016,7 @@ case 9:
|
|
2015
2016
|
_out: {}
|
2016
2017
|
}
|
2017
2018
|
|
2018
|
-
#line
|
2019
|
+
#line 780 "parser.rl"
|
2019
2020
|
|
2020
2021
|
if (cs >= JSON_first_final && p == pe) {
|
2021
2022
|
return result;
|