json 2.0.3 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES.md +66 -0
- data/Gemfile +1 -3
- data/LICENSE +56 -0
- data/README.md +54 -21
- data/VERSION +1 -1
- data/ext/json/ext/fbuffer/fbuffer.h +0 -3
- data/ext/json/ext/generator/generator.c +229 -54
- data/ext/json/ext/generator/generator.h +5 -3
- data/ext/json/ext/parser/extconf.rb +25 -0
- data/ext/json/ext/parser/parser.c +180 -85
- data/ext/json/ext/parser/parser.h +2 -0
- data/ext/json/ext/parser/parser.rl +104 -9
- data/ext/json/extconf.rb +1 -0
- data/json.gemspec +0 -0
- data/lib/json/add/bigdecimal.rb +2 -2
- data/lib/json/add/complex.rb +2 -3
- data/lib/json/add/ostruct.rb +1 -1
- data/lib/json/add/rational.rb +2 -3
- data/lib/json/add/regexp.rb +2 -2
- data/lib/json/add/set.rb +29 -0
- data/lib/json/common.rb +372 -125
- data/lib/json/pure/generator.rb +31 -10
- data/lib/json/pure/parser.rb +35 -5
- data/lib/json/version.rb +1 -1
- data/lib/json.rb +549 -29
- data/tests/fixtures/fail29.json +1 -0
- data/tests/fixtures/fail30.json +1 -0
- data/tests/fixtures/fail31.json +1 -0
- data/tests/fixtures/fail32.json +1 -0
- data/tests/json_addition_test.rb +6 -0
- data/tests/json_common_interface_test.rb +47 -4
- data/tests/json_encoding_test.rb +2 -0
- data/tests/json_fixtures_test.rb +9 -1
- data/tests/json_generator_test.rb +30 -8
- data/tests/json_parser_test.rb +43 -12
- data/tests/lib/core_assertions.rb +763 -0
- data/tests/lib/envutil.rb +365 -0
- data/tests/lib/find_executable.rb +22 -0
- data/tests/lib/helper.rb +4 -0
- data/tests/ractor_test.rb +30 -0
- data/tests/test_helper.rb +3 -7
- metadata +31 -44
- data/.gitignore +0 -17
- data/.travis.yml +0 -19
- data/README-json-jruby.md +0 -33
- data/Rakefile +0 -408
- data/data/example.json +0 -1
- data/data/index.html +0 -38
- data/data/prototype.js +0 -4184
- data/diagrams/.keep +0 -0
- data/install.rb +0 -23
- data/java/src/json/ext/ByteListTranscoder.java +0 -166
- data/java/src/json/ext/Generator.java +0 -443
- data/java/src/json/ext/GeneratorMethods.java +0 -231
- data/java/src/json/ext/GeneratorService.java +0 -42
- data/java/src/json/ext/GeneratorState.java +0 -490
- data/java/src/json/ext/OptionsReader.java +0 -113
- data/java/src/json/ext/Parser.java +0 -2347
- data/java/src/json/ext/Parser.rl +0 -878
- data/java/src/json/ext/ParserService.java +0 -34
- data/java/src/json/ext/RuntimeInfo.java +0 -116
- data/java/src/json/ext/StringDecoder.java +0 -166
- data/java/src/json/ext/StringEncoder.java +0 -111
- data/java/src/json/ext/Utils.java +0 -88
- data/json-java.gemspec +0 -38
- data/json_pure.gemspec +0 -38
- data/references/rfc7159.txt +0 -899
- data/tools/diff.sh +0 -18
- data/tools/fuzz.rb +0 -131
- data/tools/server.rb +0 -62
data/Rakefile
DELETED
@@ -1,408 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'rubygems/package_task'
|
3
|
-
rescue LoadError
|
4
|
-
end
|
5
|
-
|
6
|
-
require 'rbconfig'
|
7
|
-
include\
|
8
|
-
begin
|
9
|
-
RbConfig
|
10
|
-
rescue NameError
|
11
|
-
Config
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'rake/clean'
|
15
|
-
CLOBBER.include 'doc', 'Gemfile.lock'
|
16
|
-
CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp',
|
17
|
-
FileList["ext/**/{Makefile,mkmf.log}"], 'build', 'dist', FileList['**/*.rbc'],
|
18
|
-
FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def,jar,class,dSYM}"],
|
19
|
-
FileList['java/src/**/*.class']
|
20
|
-
|
21
|
-
require 'rake/testtask'
|
22
|
-
class UndocumentedTestTask < Rake::TestTask
|
23
|
-
def desc(*) end
|
24
|
-
end
|
25
|
-
|
26
|
-
MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
|
27
|
-
BUNDLE = ENV['BUNDLE'] || %w[bundle].find { |c| system(c, '-v') }
|
28
|
-
PKG_NAME = 'json'
|
29
|
-
PKG_TITLE = 'JSON Implementation for Ruby'
|
30
|
-
PKG_VERSION = File.read('VERSION').chomp
|
31
|
-
PKG_FILES = FileList[`git ls-files`.split(/\n/)]
|
32
|
-
|
33
|
-
EXT_ROOT_DIR = 'ext/json/ext'
|
34
|
-
EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
|
35
|
-
EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
|
36
|
-
RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
|
37
|
-
EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
|
38
|
-
EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
|
39
|
-
EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
|
40
|
-
EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
|
41
|
-
|
42
|
-
JAVA_DIR = "java/src/json/ext"
|
43
|
-
JAVA_RAGEL_PATH = "#{JAVA_DIR}/Parser.rl"
|
44
|
-
JAVA_PARSER_SRC = "#{JAVA_DIR}/Parser.java"
|
45
|
-
JAVA_SOURCES = FileList["#{JAVA_DIR}/*.java"]
|
46
|
-
JAVA_CLASSES = []
|
47
|
-
JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar")
|
48
|
-
JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar")
|
49
|
-
|
50
|
-
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
|
51
|
-
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
|
52
|
-
|
53
|
-
desc "Installing library (pure)"
|
54
|
-
task :install_pure => :version do
|
55
|
-
ruby 'install.rb'
|
56
|
-
end
|
57
|
-
|
58
|
-
task :install_ext_really do
|
59
|
-
sitearchdir = CONFIG["sitearchdir"]
|
60
|
-
cd 'ext' do
|
61
|
-
for file in Dir["json/ext/*.#{CONFIG['DLEXT']}"]
|
62
|
-
d = File.join(sitearchdir, file)
|
63
|
-
mkdir_p File.dirname(d)
|
64
|
-
install(file, d)
|
65
|
-
end
|
66
|
-
warn " *** Installed EXT ruby library."
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
desc "Installing library (extension)"
|
71
|
-
task :install_ext => [ :compile, :install_pure, :install_ext_really ]
|
72
|
-
|
73
|
-
desc "Installing library (extension)"
|
74
|
-
task :install => :install_ext
|
75
|
-
|
76
|
-
if defined?(Gem) and defined?(Gem::PackageTask)
|
77
|
-
spec_pure = Gem::Specification.new do |s|
|
78
|
-
s.name = 'json_pure'
|
79
|
-
s.version = PKG_VERSION
|
80
|
-
s.summary = PKG_TITLE
|
81
|
-
s.description = "This is a JSON implementation in pure Ruby."
|
82
|
-
|
83
|
-
s.files = PKG_FILES
|
84
|
-
|
85
|
-
s.require_path = 'lib'
|
86
|
-
s.add_development_dependency 'rake'
|
87
|
-
s.add_development_dependency 'test-unit', '~> 2.0'
|
88
|
-
|
89
|
-
s.extra_rdoc_files << 'README.md'
|
90
|
-
s.rdoc_options <<
|
91
|
-
'--title' << 'JSON implemention for ruby' << '--main' << 'README.md'
|
92
|
-
s.test_files.concat Dir['./tests/test_*.rb']
|
93
|
-
|
94
|
-
s.author = "Florian Frank"
|
95
|
-
s.email = "flori@ping.de"
|
96
|
-
s.homepage = "http://flori.github.com/#{PKG_NAME}"
|
97
|
-
s.license = 'Ruby'
|
98
|
-
s.required_ruby_version = '>= 1.9'
|
99
|
-
end
|
100
|
-
|
101
|
-
desc 'Creates a json_pure.gemspec file'
|
102
|
-
task :gemspec_pure => :version do
|
103
|
-
File.open('json_pure.gemspec', 'w') do |gemspec|
|
104
|
-
gemspec.write spec_pure.to_ruby
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
Gem::PackageTask.new(spec_pure) do |pkg|
|
109
|
-
pkg.need_tar = true
|
110
|
-
pkg.package_files = PKG_FILES
|
111
|
-
end
|
112
|
-
|
113
|
-
spec_ext = Gem::Specification.new do |s|
|
114
|
-
s.name = 'json'
|
115
|
-
s.version = PKG_VERSION
|
116
|
-
s.summary = PKG_TITLE
|
117
|
-
s.description = "This is a JSON implementation as a Ruby extension in C."
|
118
|
-
|
119
|
-
s.files = PKG_FILES
|
120
|
-
|
121
|
-
s.extensions = FileList['ext/**/extconf.rb']
|
122
|
-
|
123
|
-
s.require_path = 'lib'
|
124
|
-
s.add_development_dependency 'rake'
|
125
|
-
s.add_development_dependency 'test-unit', '~> 2.0'
|
126
|
-
|
127
|
-
s.extra_rdoc_files << 'README.md'
|
128
|
-
s.rdoc_options <<
|
129
|
-
'--title' << 'JSON implemention for Ruby' << '--main' << 'README.md'
|
130
|
-
s.test_files.concat Dir['./tests/test_*.rb']
|
131
|
-
|
132
|
-
s.author = "Florian Frank"
|
133
|
-
s.email = "flori@ping.de"
|
134
|
-
s.homepage = "http://flori.github.com/#{PKG_NAME}"
|
135
|
-
s.license = 'Ruby'
|
136
|
-
s.required_ruby_version = '>= 1.9'
|
137
|
-
end
|
138
|
-
|
139
|
-
desc 'Creates a json.gemspec file'
|
140
|
-
task :gemspec_ext => :version do
|
141
|
-
File.open('json.gemspec', 'w') do |gemspec|
|
142
|
-
gemspec.write spec_ext.to_ruby
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
Gem::PackageTask.new(spec_ext) do |pkg|
|
147
|
-
pkg.need_tar = true
|
148
|
-
pkg.package_files = PKG_FILES
|
149
|
-
end
|
150
|
-
|
151
|
-
|
152
|
-
desc 'Create all gemspec files'
|
153
|
-
task :gemspec => [ :gemspec_pure, :gemspec_ext ]
|
154
|
-
end
|
155
|
-
|
156
|
-
desc m = "Writing version information for #{PKG_VERSION}"
|
157
|
-
task :version do
|
158
|
-
puts m
|
159
|
-
File.open(File.join('lib', 'json', 'version.rb'), 'w') do |v|
|
160
|
-
v.puts <<EOT
|
161
|
-
# frozen_string_literal: false
|
162
|
-
module JSON
|
163
|
-
# JSON version
|
164
|
-
VERSION = '#{PKG_VERSION}'
|
165
|
-
VERSION_ARRAY = VERSION.split(/\\./).map { |x| x.to_i } # :nodoc:
|
166
|
-
VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
|
167
|
-
VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
|
168
|
-
VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
|
169
|
-
end
|
170
|
-
EOT
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
task :check_env do
|
175
|
-
ENV.key?('JSON') or fail "JSON env var is required"
|
176
|
-
end
|
177
|
-
|
178
|
-
desc "Testing library (pure ruby)"
|
179
|
-
task :test_pure => [ :clean, :check_env, :do_test_pure ]
|
180
|
-
|
181
|
-
UndocumentedTestTask.new do |t|
|
182
|
-
t.name = 'do_test_pure'
|
183
|
-
t.libs << 'lib' << 'tests'
|
184
|
-
t.test_files = FileList['tests/*_test.rb']
|
185
|
-
t.verbose = true
|
186
|
-
t.options = '-v'
|
187
|
-
end
|
188
|
-
|
189
|
-
desc "Testing library (pure ruby and extension)"
|
190
|
-
task :test do
|
191
|
-
sh "env JSON=pure #{BUNDLE} exec rake test_pure" or exit 1
|
192
|
-
sh "env JSON=ext #{BUNDLE} exec rake test_ext" or exit 1
|
193
|
-
end
|
194
|
-
|
195
|
-
namespace :gems do
|
196
|
-
desc 'Install all development gems'
|
197
|
-
task :install do
|
198
|
-
sh "#{BUNDLE}"
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
|
203
|
-
ENV['JAVA_HOME'] ||= [
|
204
|
-
'/usr/local/java/jdk',
|
205
|
-
'/usr/lib/jvm/java-6-openjdk',
|
206
|
-
'/Library/Java/Home',
|
207
|
-
].find { |c| File.directory?(c) }
|
208
|
-
if ENV['JAVA_HOME']
|
209
|
-
warn " *** JAVA_HOME is set to #{ENV['JAVA_HOME'].inspect}"
|
210
|
-
ENV['PATH'] = ENV['PATH'].split(/:/).unshift(java_path = "#{ENV['JAVA_HOME']}/bin") * ':'
|
211
|
-
warn " *** java binaries are assumed to be in #{java_path.inspect}"
|
212
|
-
else
|
213
|
-
warn " *** JAVA_HOME was not set or could not be guessed!"
|
214
|
-
exit 1
|
215
|
-
end
|
216
|
-
|
217
|
-
file JAVA_PARSER_SRC => JAVA_RAGEL_PATH do
|
218
|
-
cd JAVA_DIR do
|
219
|
-
if RAGEL_CODEGEN == 'ragel'
|
220
|
-
sh "ragel Parser.rl -J -o Parser.java"
|
221
|
-
else
|
222
|
-
sh "ragel -x Parser.rl | #{RAGEL_CODEGEN} -J"
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
desc "Generate parser for java with ragel"
|
228
|
-
task :ragel => JAVA_PARSER_SRC
|
229
|
-
|
230
|
-
desc "Delete the ragel generated Java source"
|
231
|
-
task :ragel_clean do
|
232
|
-
rm_rf JAVA_PARSER_SRC
|
233
|
-
end
|
234
|
-
|
235
|
-
JRUBY_JAR = File.join(CONFIG["libdir"], "jruby.jar")
|
236
|
-
if File.exist?(JRUBY_JAR)
|
237
|
-
JAVA_SOURCES.each do |src|
|
238
|
-
classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * ':'
|
239
|
-
obj = src.sub(/\.java\Z/, '.class')
|
240
|
-
file obj => src do
|
241
|
-
sh 'javac', '-classpath', classpath, '-source', '1.5', '-target', '1.5', src
|
242
|
-
end
|
243
|
-
JAVA_CLASSES << obj
|
244
|
-
end
|
245
|
-
else
|
246
|
-
warn "WARNING: Cannot find jruby in path => Cannot build jruby extension!"
|
247
|
-
end
|
248
|
-
|
249
|
-
desc "Compiling jruby extension"
|
250
|
-
task :compile => JAVA_CLASSES
|
251
|
-
|
252
|
-
desc "Package the jruby gem"
|
253
|
-
task :jruby_gem => :create_jar do
|
254
|
-
sh 'gem build json-java.gemspec'
|
255
|
-
mkdir_p 'pkg'
|
256
|
-
mv "json-#{PKG_VERSION}-java.gem", 'pkg'
|
257
|
-
end
|
258
|
-
|
259
|
-
desc "Testing library (jruby)"
|
260
|
-
task :test_ext => [ :create_jar, :check_env, :do_test_ext ]
|
261
|
-
|
262
|
-
UndocumentedTestTask.new do |t|
|
263
|
-
t.name = 'do_test_ext'
|
264
|
-
t.libs << 'lib' << 'tests'
|
265
|
-
t.test_files = FileList['tests/*_test.rb']
|
266
|
-
t.verbose = true
|
267
|
-
t.options = '-v'
|
268
|
-
end
|
269
|
-
|
270
|
-
file JRUBY_PARSER_JAR => :compile do
|
271
|
-
cd 'java/src' do
|
272
|
-
parser_classes = FileList[
|
273
|
-
"json/ext/ByteListTranscoder*.class",
|
274
|
-
"json/ext/OptionsReader*.class",
|
275
|
-
"json/ext/Parser*.class",
|
276
|
-
"json/ext/RuntimeInfo*.class",
|
277
|
-
"json/ext/StringDecoder*.class",
|
278
|
-
"json/ext/Utils*.class"
|
279
|
-
]
|
280
|
-
sh 'jar', 'cf', File.basename(JRUBY_PARSER_JAR), *parser_classes
|
281
|
-
mv File.basename(JRUBY_PARSER_JAR), File.dirname(JRUBY_PARSER_JAR)
|
282
|
-
end
|
283
|
-
end
|
284
|
-
|
285
|
-
desc "Create parser jar"
|
286
|
-
task :create_parser_jar => JRUBY_PARSER_JAR
|
287
|
-
|
288
|
-
file JRUBY_GENERATOR_JAR => :compile do
|
289
|
-
cd 'java/src' do
|
290
|
-
generator_classes = FileList[
|
291
|
-
"json/ext/ByteListTranscoder*.class",
|
292
|
-
"json/ext/OptionsReader*.class",
|
293
|
-
"json/ext/Generator*.class",
|
294
|
-
"json/ext/RuntimeInfo*.class",
|
295
|
-
"json/ext/StringEncoder*.class",
|
296
|
-
"json/ext/Utils*.class"
|
297
|
-
]
|
298
|
-
sh 'jar', 'cf', File.basename(JRUBY_GENERATOR_JAR), *generator_classes
|
299
|
-
mv File.basename(JRUBY_GENERATOR_JAR), File.dirname(JRUBY_GENERATOR_JAR)
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
desc "Create generator jar"
|
304
|
-
task :create_generator_jar => JRUBY_GENERATOR_JAR
|
305
|
-
|
306
|
-
desc "Create parser and generator jars"
|
307
|
-
task :create_jar => [ :create_parser_jar, :create_generator_jar ]
|
308
|
-
|
309
|
-
desc "Build all gems and archives for a new release of the jruby extension."
|
310
|
-
task :build => [ :clean, :version, :jruby_gem ]
|
311
|
-
|
312
|
-
task :release => :build
|
313
|
-
else
|
314
|
-
desc "Compiling extension"
|
315
|
-
task :compile => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
|
316
|
-
|
317
|
-
file EXT_PARSER_DL => EXT_PARSER_SRC do
|
318
|
-
cd EXT_PARSER_DIR do
|
319
|
-
ruby 'extconf.rb'
|
320
|
-
sh MAKE
|
321
|
-
end
|
322
|
-
cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
323
|
-
end
|
324
|
-
|
325
|
-
file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
|
326
|
-
cd EXT_GENERATOR_DIR do
|
327
|
-
ruby 'extconf.rb'
|
328
|
-
sh MAKE
|
329
|
-
end
|
330
|
-
cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
331
|
-
end
|
332
|
-
|
333
|
-
desc "Testing library (extension)"
|
334
|
-
task :test_ext => [ :compile, :check_env, :do_test_ext ]
|
335
|
-
|
336
|
-
UndocumentedTestTask.new do |t|
|
337
|
-
t.name = 'do_test_ext'
|
338
|
-
t.libs << 'ext' << 'lib' << 'tests'
|
339
|
-
t.test_files = FileList['tests/*_test.rb']
|
340
|
-
t.verbose = true
|
341
|
-
t.options = '-v'
|
342
|
-
end
|
343
|
-
|
344
|
-
desc "Generate parser with ragel"
|
345
|
-
task :ragel => EXT_PARSER_SRC
|
346
|
-
|
347
|
-
desc "Delete the ragel generated C source"
|
348
|
-
task :ragel_clean do
|
349
|
-
rm_rf EXT_PARSER_SRC
|
350
|
-
end
|
351
|
-
|
352
|
-
desc "Update the tags file"
|
353
|
-
task :tags do
|
354
|
-
system 'ctags', *Dir['**/*.{rb,c,h,java}']
|
355
|
-
end
|
356
|
-
|
357
|
-
file EXT_PARSER_SRC => RAGEL_PATH do
|
358
|
-
cd EXT_PARSER_DIR do
|
359
|
-
if RAGEL_CODEGEN == 'ragel'
|
360
|
-
sh "ragel parser.rl -G2 -o parser.c"
|
361
|
-
else
|
362
|
-
sh "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2"
|
363
|
-
end
|
364
|
-
src = File.read("parser.c").gsub(/[ \t]+$/, '')
|
365
|
-
src.gsub!(/^static const int (JSON_.*=.*);$/, 'enum {\1};')
|
366
|
-
File.open("parser.c", "w") {|f| f.print src}
|
367
|
-
end
|
368
|
-
end
|
369
|
-
|
370
|
-
desc "Generate diagrams of ragel parser (ps)"
|
371
|
-
task :ragel_dot_ps do
|
372
|
-
root = 'diagrams'
|
373
|
-
specs = []
|
374
|
-
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
375
|
-
for s in specs
|
376
|
-
if RAGEL_DOTGEN == 'ragel'
|
377
|
-
sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tps -o#{root}/#{s}.ps"
|
378
|
-
else
|
379
|
-
sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
|
380
|
-
end
|
381
|
-
end
|
382
|
-
end
|
383
|
-
|
384
|
-
desc "Generate diagrams of ragel parser (png)"
|
385
|
-
task :ragel_dot_png do
|
386
|
-
root = 'diagrams'
|
387
|
-
specs = []
|
388
|
-
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
389
|
-
for s in specs
|
390
|
-
if RAGEL_DOTGEN == 'ragel'
|
391
|
-
sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tpng -o#{root}/#{s}.png"
|
392
|
-
else
|
393
|
-
sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
|
394
|
-
end
|
395
|
-
end
|
396
|
-
end
|
397
|
-
|
398
|
-
desc "Generate diagrams of ragel parser"
|
399
|
-
task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
|
400
|
-
|
401
|
-
desc "Build all gems and archives for a new release of json and json_pure."
|
402
|
-
task :build => [ :clean, :gemspec, :package ]
|
403
|
-
|
404
|
-
task :release => :build
|
405
|
-
end
|
406
|
-
|
407
|
-
desc "Compile in the the source directory"
|
408
|
-
task :default => [ :clean, :gemspec, :test ]
|
data/data/example.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"a":2,"b":3.141,"TIME":"2007-03-14T11:52:40","c":"c","d":[1,"b",3.14],"COUNT":666,"e":{"foo":"bar"},"foo":"B\u00e4r","g":"\u677e\u672c\u884c\u5f18","h":1000.0,"bar":"\u00a9 \u2260 \u20ac!","i":0.001,"j":"\ud840\udc01"}
|
data/data/index.html
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
4
|
-
<head>
|
5
|
-
<title>Javascript Example</title>
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
7
|
-
<script src="prototype.js" type="text/javascript"></script>
|
8
|
-
</head>
|
9
|
-
|
10
|
-
<body>
|
11
|
-
<h1>Fetching object from server</h1>
|
12
|
-
<div id="list">
|
13
|
-
Wait...<br/>
|
14
|
-
<noscript><p>Switch on Javascript!</p></noscript>
|
15
|
-
</div>
|
16
|
-
<script type="text/javascript">
|
17
|
-
<!--
|
18
|
-
function pollJSON() {
|
19
|
-
new Ajax.Request('/json',
|
20
|
-
{
|
21
|
-
method: 'get',
|
22
|
-
onSuccess: function(transport) {
|
23
|
-
var response = transport.responseText || "no response text";
|
24
|
-
response = eval("(" + response + ")");
|
25
|
-
var text = "";
|
26
|
-
for (var k in response) {
|
27
|
-
text = text + "<b>" + k + "</b>: " + response[k] + "<br/>"
|
28
|
-
}
|
29
|
-
$("list").update(text);
|
30
|
-
},
|
31
|
-
onFailure: function() { alert('Something went wrong...') }
|
32
|
-
});
|
33
|
-
}
|
34
|
-
new PeriodicalExecuter(pollJSON, 1);
|
35
|
-
-->
|
36
|
-
</script>
|
37
|
-
</body>
|
38
|
-
</html>
|