json_pure 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +10 -0
- data/Rakefile +5 -7
- data/VERSION +1 -1
- data/benchmarks/benchmark_generator.rb +0 -0
- data/benchmarks/benchmark_parser.rb +0 -0
- data/benchmarks/benchmark_rails.rb +0 -0
- data/bin/edit_json.rb +0 -1
- data/bin/prettify_json.rb +1 -0
- data/data/index.html +5 -4
- data/ext/json/ext/generator/extconf.rb +1 -1
- data/ext/json/ext/generator/generator.c +3 -4
- data/ext/json/ext/generator/unicode.c +0 -2
- data/ext/json/ext/parser/extconf.rb +1 -1
- data/ext/json/ext/parser/parser.c +315 -309
- data/ext/json/ext/parser/parser.rl +27 -28
- data/ext/json/ext/parser/unicode.c +0 -2
- data/install.rb +0 -0
- data/lib/json/add/core.rb +20 -5
- data/lib/json/common.rb +5 -5
- data/lib/json/editor.rb +0 -1
- data/lib/json/pure/generator.rb +1 -1
- data/lib/json/pure/parser.rb +1 -1
- data/lib/json/version.rb +1 -1
- data/tests/runner.rb +0 -1
- data/tests/test_json.rb +0 -1
- data/tests/test_json_addition.rb +24 -7
- data/tests/test_json_fixtures.rb +0 -0
- data/tests/test_json_generate.rb +0 -0
- data/tests/test_json_rails.rb +6 -2
- data/tests/test_json_unicode.rb +0 -0
- data/tools/fuzz.rb +10 -2
- data/tools/server.rb +0 -0
- metadata +41 -34
data/CHANGES
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
2008-07-10 (1.1.3)
|
2
|
+
* Wesley Beary <monki@geemus.com> reported a bug in json/add/core's DateTime
|
3
|
+
handling: If the nominator and denominator of the offset were divisible by
|
4
|
+
each other Ruby's Rational#to_s returns them as an integer not a fraction
|
5
|
+
with '/'. This caused a ZeroDivisionError during parsing.
|
6
|
+
* Use Date#start and DateTime#start instead of sg method, while
|
7
|
+
remaining backwards compatible.
|
8
|
+
* Supports ragel >= 6.0 now.
|
9
|
+
* Corrected some tests.
|
10
|
+
* Some minor changes.
|
1
11
|
2007-11-27 (1.1.2)
|
2
12
|
* Remember default dir (last used directory) in editor.
|
3
13
|
* JSON::Editor.edit method added, the editor can now receive json texts from
|
data/Rakefile
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# vim: set et sw=2 ts=2:
|
2
|
-
|
3
1
|
begin
|
4
2
|
require 'rake/gempackagetask'
|
5
3
|
rescue LoadError
|
@@ -88,7 +86,7 @@ end
|
|
88
86
|
|
89
87
|
file EXT_PARSER_SRC => RAGEL_PATH do
|
90
88
|
cd EXT_PARSER_DIR do
|
91
|
-
sh "ragel parser.rl | #{RAGEL_CODEGEN} -G2"
|
89
|
+
sh "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2"
|
92
90
|
end
|
93
91
|
end
|
94
92
|
|
@@ -98,7 +96,7 @@ task :ragel_dot_ps do
|
|
98
96
|
specs = []
|
99
97
|
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
100
98
|
for s in specs
|
101
|
-
sh "ragel #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
|
99
|
+
sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
|
102
100
|
end
|
103
101
|
end
|
104
102
|
|
@@ -108,7 +106,7 @@ task :ragel_dot_png do
|
|
108
106
|
specs = []
|
109
107
|
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
110
108
|
for s in specs
|
111
|
-
sh "ragel #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
|
109
|
+
sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
|
112
110
|
end
|
113
111
|
end
|
114
112
|
|
@@ -117,12 +115,12 @@ task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
|
|
117
115
|
|
118
116
|
desc "Testing library (pure ruby)"
|
119
117
|
task :test_pure => :clean do
|
120
|
-
ruby '-I lib tests/runner.rb'
|
118
|
+
ruby '-v -I lib tests/runner.rb'
|
121
119
|
end
|
122
120
|
|
123
121
|
desc "Testing library (extension)"
|
124
122
|
task :test_ext => :compile do
|
125
|
-
ruby '-I ext:lib tests/runner.rb'
|
123
|
+
ruby '-v -I ext:lib tests/runner.rb'
|
126
124
|
end
|
127
125
|
|
128
126
|
desc "Benchmarking parser (pure)"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.3
|
File without changes
|
File without changes
|
File without changes
|
data/bin/edit_json.rb
CHANGED
data/bin/prettify_json.rb
CHANGED
data/data/index.html
CHANGED
@@ -10,15 +10,16 @@
|
|
10
10
|
<body>
|
11
11
|
<h1>Fetching object from server</h1>
|
12
12
|
<div id="list">
|
13
|
-
|
13
|
+
Wait...<br/>
|
14
|
+
<noscript><p>Switch on Javascript!</p></noscript>
|
14
15
|
</div>
|
15
16
|
<script type="text/javascript">
|
16
17
|
<!--
|
17
18
|
function pollJSON() {
|
18
19
|
new Ajax.Request('/json',
|
19
20
|
{
|
20
|
-
method:'get',
|
21
|
-
onSuccess: function(transport){
|
21
|
+
method: 'get',
|
22
|
+
onSuccess: function(transport) {
|
22
23
|
var response = transport.responseText || "no response text";
|
23
24
|
response = eval("(" + response + ")");
|
24
25
|
var text = "";
|
@@ -27,7 +28,7 @@
|
|
27
28
|
}
|
28
29
|
$("list").update(text);
|
29
30
|
},
|
30
|
-
onFailure: function(){ alert('Something went wrong...') }
|
31
|
+
onFailure: function() { alert('Something went wrong...') }
|
31
32
|
});
|
32
33
|
}
|
33
34
|
new PeriodicalExecuter(pollJSON, 1);
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* vim: set cin et sw=4 ts=4: */
|
2
|
-
|
3
1
|
#include <string.h>
|
4
2
|
#include "ruby.h"
|
5
3
|
#include "st.h"
|
@@ -293,14 +291,14 @@ static VALUE mFloat_to_json(int argc, VALUE *argv, VALUE self)
|
|
293
291
|
return rb_funcall(self, i_to_s, 0);
|
294
292
|
} else {
|
295
293
|
tmp = rb_funcall(self, i_to_s, 0);
|
296
|
-
rb_raise(eGeneratorError, "%s not allowed in JSON", StringValueCStr(tmp));
|
294
|
+
rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
|
297
295
|
}
|
298
296
|
} else if (isnan(value)) {
|
299
297
|
if (!state || state->allow_nan) {
|
300
298
|
return rb_funcall(self, i_to_s, 0);
|
301
299
|
} else {
|
302
300
|
tmp = rb_funcall(self, i_to_s, 0);
|
303
|
-
rb_raise(eGeneratorError, "%s not allowed in JSON", StringValueCStr(tmp));
|
301
|
+
rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
|
304
302
|
}
|
305
303
|
} else {
|
306
304
|
return rb_funcall(self, i_to_s, 0);
|
@@ -802,6 +800,7 @@ static VALUE cState_forget(VALUE self, VALUE object)
|
|
802
800
|
*/
|
803
801
|
void Init_generator()
|
804
802
|
{
|
803
|
+
rb_require("json/common");
|
805
804
|
mJSON = rb_define_module("JSON");
|
806
805
|
mExt = rb_define_module_under(mJSON, "Ext");
|
807
806
|
mGenerator = rb_define_module_under(mExt, "Generator");
|