json_pure 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.2
1
+ 1.1.3
File without changes
File without changes
File without changes
data/bin/edit_json.rb CHANGED
@@ -8,4 +8,3 @@ JSON::Editor.start(encoding) do |window|
8
8
  window.file_open(filename)
9
9
  end
10
10
  end
11
- # vim: set et sw=2 ts=2:
data/bin/prettify_json.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  $KCODE = 'U'
3
4
  require 'json'
4
5
  require 'fileutils'
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
- Switch on Javascript!
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);
@@ -2,8 +2,8 @@ require 'mkmf'
2
2
  require 'rbconfig'
3
3
 
4
4
  if CONFIG['CC'] =~ /gcc/
5
- #$CFLAGS += ' -Wall -ggdb'
6
5
  $CFLAGS += ' -Wall'
6
+ #$CFLAGS += ' -O0 -ggdb'
7
7
  end
8
8
 
9
9
  create_makefile 'generator'
@@ -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");
@@ -1,5 +1,3 @@
1
- /* vim: set cin et sw=4 ts=4: */
2
-
3
1
  #include "unicode.h"
4
2
 
5
3
  #define unicode_escape(buffer, character) \
@@ -2,8 +2,8 @@ require 'mkmf'
2
2
  require 'rbconfig'
3
3
 
4
4
  if CONFIG['CC'] =~ /gcc/
5
- #$CFLAGS += ' -Wall -ggdb'
6
5
  $CFLAGS += ' -Wall'
6
+ #$CFLAGS += ' -O0 -ggdb'
7
7
  end
8
8
 
9
9
  create_makefile 'parser'