summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2010-09-22 22:21:02 +0200
committerFlorian Frank <flori@ping.de>2010-09-27 23:37:40 +0200
commit1db86436e8d8e52bfda539318610f92d095f799d (patch)
treef24b6cc4ec53563395f25a385d91897f445a814e
parent2c0f8d2c9b15a33b8d10ffcb1959aef54d320b57 (diff)
downloadjson-1db86436e8d8e52bfda539318610f92d095f799d.tar.gz
started to build jruby extension with Rakefile
-rw-r--r--Rakefile166
-rwxr-xr-xbenchmarks/generator2_benchmark.rb2
-rwxr-xr-xbenchmarks/generator_benchmark.rb2
-rw-r--r--build.xml80
-rw-r--r--ext/json/ext/parser/parser.c136
-rw-r--r--java/lib/bytelist-1.0.6.jarbin0 -> 10493 bytes
-rw-r--r--java/lib/jcodings.jarbin0 -> 242327 bytes
-rw-r--r--java/src/json/ext/ByteListTranscoder.java (renamed from src/json/ext/ByteListTranscoder.java)0
-rw-r--r--java/src/json/ext/Generator.java (renamed from src/json/ext/Generator.java)0
-rw-r--r--java/src/json/ext/GeneratorMethods.java (renamed from src/json/ext/GeneratorMethods.java)0
-rw-r--r--java/src/json/ext/GeneratorService.java (renamed from src/json/ext/GeneratorService.java)0
-rw-r--r--java/src/json/ext/GeneratorState.java (renamed from src/json/ext/GeneratorState.java)0
-rw-r--r--java/src/json/ext/OptionsReader.java (renamed from src/json/ext/OptionsReader.java)0
-rw-r--r--java/src/json/ext/Parser.java (renamed from src/json/ext/Parser.java)146
-rw-r--r--java/src/json/ext/Parser.rl (renamed from src/json/ext/Parser.rl)0
-rw-r--r--java/src/json/ext/ParserService.java (renamed from src/json/ext/ParserService.java)0
-rw-r--r--java/src/json/ext/RuntimeInfo.java (renamed from src/json/ext/RuntimeInfo.java)0
-rw-r--r--java/src/json/ext/StringDecoder.java (renamed from src/json/ext/StringDecoder.java)0
-rw-r--r--java/src/json/ext/StringEncoder.java (renamed from src/json/ext/StringEncoder.java)0
-rw-r--r--java/src/json/ext/Utils.java (renamed from src/json/ext/Utils.java)0
-rw-r--r--json-java.gemspec2
-rw-r--r--lib/json/pure/generator.rb10
-rw-r--r--nbproject/build-impl.xml805
-rw-r--r--nbproject/genfiles.properties8
-rw-r--r--nbproject/project.properties70
-rw-r--r--nbproject/project.xml16
-rwxr-xr-xtests/test_json_addition.rb2
-rwxr-xr-xtests/test_json_generate.rb2
-rwxr-xr-xtests/test_json_rails.rb2
29 files changed, 272 insertions, 1177 deletions
diff --git a/Rakefile b/Rakefile
index a4e6eef..7ce6b69 100644
--- a/Rakefile
+++ b/Rakefile
@@ -6,7 +6,7 @@ end
begin
require 'rake/extensiontask'
rescue LoadError
- puts "WARNING: rake-compiler is not installed. You will not be able to build the json gem until you install it."
+ warn "WARNING: rake-compiler is not installed. You will not be able to build the json gem until you install it."
end
require 'rbconfig'
@@ -16,13 +16,15 @@ require 'rake/clean'
CLOBBER.include Dir['benchmarks/data/*.{dat,log}']
CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp',
FileList["ext/**/{Makefile,mkmf.log}"], 'build', 'dist', FileList['**/*.rbc'],
- FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def,jar}"]
+ FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def,jar,class}"],
+ FileList['java/src/**/*.class']
MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
PKG_NAME = 'json'
PKG_TITLE = 'JSON Implementation for Ruby'
PKG_VERSION = File.read('VERSION').chomp
PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\./).exclude(/\.(so|bundle|o|class|#{CONFIG['DLEXT']})$/)
+
EXT_ROOT_DIR = 'ext/json/ext'
EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
@@ -31,6 +33,14 @@ PKG_FILES << EXT_PARSER_SRC
EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
+
+JAVA_DIR = "java/src/json/ext"
+JAVA_PARSER_SRC = "#{JAVA_DIR}/Parser.java"
+JAVA_SOURCES = FileList["#{JAVA_DIR}/*.java"]
+JAVA_CLASSES = []
+JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar")
+JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar")
+
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
@@ -45,16 +55,6 @@ def myruby(*args, &block)
end
end
-def jruby(*args, &block)
- @jruby ||= `which jruby`.chomp
- options = (Hash === args.last) ? args.pop : {}
- if args.length > 1 then
- sh(*([@jruby] + args + [options]), &block)
- else
- sh("#{@jruby} #{args.first}", options, &block)
- end
-end
-
desc "Installing library (pure)"
task :install_pure => :version do
myruby 'install.rb'
@@ -84,19 +84,6 @@ end
desc "Compiling extension"
task :compile_ext => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
-desc "Compiling jruby extension"
-task :compile_jruby do
- sh 'ant -buildfile build.xml jar'
-end
-
-desc "Package the jruby gem"
-task :jruby_gem do
- sh 'ant -buildfile build.xml clean gem'
- sh 'gem build json-java.gemspec'
- mkdir_p 'pkg'
- mv "json-#{PKG_VERSION}-java.gem", 'pkg'
-end
-
file EXT_PARSER_DL => EXT_PARSER_SRC do
cd EXT_PARSER_DIR do
myruby 'extconf.rb'
@@ -116,6 +103,7 @@ end
desc "Generate parser with ragel"
task :ragel => EXT_PARSER_SRC
+desc "Delete the ragel generated C source"
task :ragel_clean do
rm_rf EXT_PARSER_SRC
end
@@ -164,27 +152,17 @@ task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
desc "Testing library (pure ruby)"
task :test_pure => :clean do
ENV['JSON'] = 'pure'
- ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
- myruby "-S testrb #{Dir['./tests/*.rb'] * ' '}"
+ ENV['RUBYOPT'] = "-Ilib #{ENV['RUBYOPT']}"
+ myruby '-S', 'testrb', *Dir['tests/*.rb']
end
desc "Testing library (extension)"
task :test_ext => :compile_ext do
ENV['JSON'] = 'ext'
ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
- myruby "-S testrb #{Dir['./tests/*.rb'] * ' '}"
-end
-
-desc "Testing library (jruby)"
-task :test_jruby => :compile_jruby do
- ENV['JSON'] = 'ext'
- ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
- jruby "-S testrb #{Dir['./tests/*.rb'] * ' '}"
+ myruby '-S', 'testrb', *Dir['./tests/*.rb']
end
-desc "Testing library (pure ruby and extension)"
-task :test => [ :test_pure, :test_jruby, :test_ext ]
-
desc "Benchmarking parser"
task :benchmark_parser do
ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
@@ -312,17 +290,109 @@ EOT
end
end
-desc "Build all gems and archives for a new release of the jruby extension."
-task :release_jruby => [ :clean, :version, :jruby_gem ]
+if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
+ file JAVA_PARSER_SRC => RAGEL_PATH do
+ cd JAVA_DIR do
+ if RAGEL_CODEGEN == 'ragel'
+ sh "ragel Parser.rl -J -o Parser.java"
+ else
+ sh "ragel -x Parser.rl | #{RAGEL_CODEGEN} -J"
+ end
+ end
+ end
-desc "Build all gems and archives for a new release of json and json_pure."
-task :release_ruby => [ :clean, :version, :cross, :native, :gem, ] do
- sh "#$0 clean native gem"
- sh "#$0 clean package"
-end
+ JRUBY_JAR = File.join(Config::CONFIG["libdir"], "jruby.jar")
+ if File.exist?(JRUBY_JAR)
+ JAVA_SOURCES.each do |src|
+ classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * ':'
+ obj = src.sub(/\.java\Z/, '.class')
+ file obj => src do
+ sh 'javac', '-classpath', classpath, '-source', '1.5', src
+ end
+ JAVA_CLASSES << obj
+ end
+ else
+ warn "WARNING: Cannot find jruby in path => Cannot build jruby extension!"
+ end
+
+ desc "Generate parser for java with ragel"
+ task :ragel_java => JAVA_PARSER_SRC
+
+ desc "Delete the ragel generated Java source"
+ task :ragel_clean_java do
+ rm_rf JAVA_PARSER_SRC
+ end
+
+ desc "Compiling jruby extension"
+ task :compile_jruby => JAVA_CLASSES
-desc "Build all gems and archives for a new release."
-task :release => [ :release_ruby, :release_jruby ]
+ desc "Package the jruby gem"
+ task :jruby_gem => :create_jar do
+ sh 'gem build json-java.gemspec'
+ mkdir_p 'pkg'
+ mv "json-#{PKG_VERSION}-java.gem", 'pkg'
+ end
+
+ desc "Testing library (jruby)"
+ task :test_jruby => :create_jar do
+ ENV['JSON'] = 'ext'
+ myruby '-S', 'testrb', '-Ilib', *Dir['tests/*.rb']
+ end
+
+ file JRUBY_PARSER_JAR => :compile_jruby do
+ cd 'java/src' do
+ parser_classes = FileList[
+ "json/ext/ByteListTranscoder*.class",
+ "json/ext/OptionsReader*.class",
+ "json/ext/Parser*.class",
+ "json/ext/RuntimeInfo*.class",
+ "json/ext/StringDecoder*.class",
+ "json/ext/Utils*.class"
+ ]
+ sh 'jar', 'cf', File.basename(JRUBY_PARSER_JAR), *parser_classes
+ mv File.basename(JRUBY_PARSER_JAR), File.dirname(JRUBY_PARSER_JAR)
+ end
+ end
+
+ desc "Create parser jar"
+ task :create_parser_jar => JRUBY_PARSER_JAR
+
+ file JRUBY_GENERATOR_JAR => :compile_jruby do
+ cd 'java/src' do
+ generator_classes = FileList[
+ "json/ext/ByteListTranscoder*.class",
+ "json/ext/OptionsReader*.class",
+ "json/ext/Generator*.class",
+ "json/ext/RuntimeInfo*.class",
+ "json/ext/StringEncoder*.class",
+ "json/ext/Utils*.class"
+ ]
+ sh 'jar', 'cf', File.basename(JRUBY_GENERATOR_JAR), *generator_classes
+ mv File.basename(JRUBY_GENERATOR_JAR), File.dirname(JRUBY_GENERATOR_JAR)
+ end
+ end
+
+ desc "Create generator jar"
+ task :create_generator_jar => JRUBY_GENERATOR_JAR
+
+ desc "Create parser and generator jars"
+ task :create_jar => [ :create_parser_jar, :create_generator_jar ]
+
+ desc "Build all gems and archives for a new release of the jruby extension."
+ task :release => [ :clean, :version, :jruby_gem ]
+
+ desc "Testing library (jruby extension)"
+ task :test => :test_jruby
+else
+ desc "Testing library (pure ruby and extension)"
+ task :test => [ :test_pure, :test_ext ]
+
+ desc "Build all gems and archives for a new release of json and json_pure."
+ task :release => [ :clean, :version, :cross, :native, :gem, ] do
+ sh "#$0 clean native gem"
+ sh "#$0 clean package"
+ end
+end
desc "Compile in the the source directory"
-task :default => [ :version, :compile_ext ]
+task :default => [ :version ]
diff --git a/benchmarks/generator2_benchmark.rb b/benchmarks/generator2_benchmark.rb
index 3a32d05..9885143 100755
--- a/benchmarks/generator2_benchmark.rb
+++ b/benchmarks/generator2_benchmark.rb
@@ -138,7 +138,7 @@ class Generator2BenchmarkRails < Bullshit::RepeatCase
histogram yes
def benchmark_generator
- @result = @big.to_json
+ @result = ActiveSupport::JSON.encode @big
end
alias reset_benchmark_generator generic_reset_method
diff --git a/benchmarks/generator_benchmark.rb b/benchmarks/generator_benchmark.rb
index 3f9b225..83fa577 100755
--- a/benchmarks/generator_benchmark.rb
+++ b/benchmarks/generator_benchmark.rb
@@ -140,7 +140,7 @@ class GeneratorBenchmarkRails < Bullshit::RepeatCase
histogram yes
def benchmark_generator
- @result = @big.to_json
+ @result = ActiveSupport::JSON.encode @big
end
alias reset_benchmark_generator generic_reset_method
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 7c8820e..0000000
--- a/build.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="JSON-JRuby" default="gem" basedir=".">
- <description>Builds, tests, and runs the project JSON-JRuby.</description>
- <import file="nbproject/build-impl.xml"/>
-
- <target name="ragel" description="Generate parser with Ragel.">
- <exec executable="ragel" failonerror="true">
- <arg value="-J"/>
- <arg value="${src.dir}/json/ext/Parser.rl"/>
- </exec>
- </target>
-
- <target name="-pre-compile" depends="ragel"/>
-
- <target name="clean-dist">
- <delete>
- <file file="${generator.jar}"/>
- <file file="${parser.jar}"/>
- <fileset dir="." includes="*.gem"/>
- </delete>
- </target>
-
- <target name="-post-clean" depends="clean-dist,ragel"/>
-
- <target name="-do-jar-without-manifest">
- <mkdir dir="${lib.dir}/json/ext"/>
- <delete>
- <file file="${generator.jar}"/>
- <file file="${parser.jar}"/>
- </delete>
- <jar destfile="${generator.jar}">
- <fileset dir="${build.classes.dir}">
- <include name="json/ext/ByteListTranscoder*.class"/>
- <include name="json/ext/Generator*.class"/>
- <include name="json/ext/OptionsReader*.class"/>
- <include name="json/ext/RuntimeInfo*.class"/>
- <include name="json/ext/StringEncoder*.class"/>
- <include name="json/ext/Utils*.class"/>
- </fileset>
- </jar>
- <jar destfile="${parser.jar}">
- <fileset dir="${build.classes.dir}">
- <include name="json/ext/ByteListTranscoder*.class"/>
- <include name="json/ext/OptionsReader*.class"/>
- <include name="json/ext/Parser*.class"/>
- <include name="json/ext/RuntimeInfo*.class"/>
- <include name="json/ext/StringDecoder*.class"/>
- <include name="json/ext/Utils*.class"/>
- </fileset>
- </jar>
- </target>
-
- <target name="gem" depends="jar" description="Build a RubyGem.">
- <exec executable="${jruby.dir}/bin/jruby">
- <arg value="json-java.gemspec"/>
- </exec>
- </target>
-
- <target name="release" depends="gem" description="Release the current version of the RubyGem.">
- <mkdir dir="pkg"/>
- <move todir="pkg">
- <fileset dir=".">
- <include name="*.gem"/>
- </fileset>
- </move>
- </target>
-
-
- <target name="-post-test" depends="ruby-tests" />
-
- <target name="ruby-tests" depends="jar"
- description="Perform the json ruby library tests.">
- <exec executable="${jruby.dir}/bin/jruby" failonerror="true">
- <arg value="-v"/>
- <arg value="-I"/>
- <arg value="${lib.dir}"/>
- <arg value="tests/runner.rb"/>
- </exec>
- </target>
-</project>
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c
index 1d639d2..a2f4601 100644
--- a/ext/json/ext/parser/parser.c
+++ b/ext/json/ext/parser/parser.c
@@ -94,7 +94,7 @@ static const int JSON_object_error = 0;
static const int JSON_object_en_main = 1;
-#line 143 "parser.rl"
+#line 144 "parser.rl"
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -115,7 +115,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
cs = JSON_object_start;
}
-#line 158 "parser.rl"
+#line 159 "parser.rl"
#line 121 "parser.c"
{
@@ -158,7 +158,7 @@ st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
-#line 161 "parser.c"
+#line 162 "parser.c"
switch( (*p) ) {
case 13: goto st3;
case 32: goto st3;
@@ -241,7 +241,7 @@ st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
-#line 244 "parser.c"
+#line 245 "parser.c"
switch( (*p) ) {
case 13: goto st9;
case 32: goto st9;
@@ -330,14 +330,14 @@ case 18:
goto st9;
goto st18;
tr4:
-#line 134 "parser.rl"
+#line 135 "parser.rl"
{ p--; {p++; cs = 27; goto _out;} }
goto st27;
st27:
if ( ++p == pe )
goto _test_eof27;
case 27:
-#line 340 "parser.c"
+#line 341 "parser.c"
goto st0;
st19:
if ( ++p == pe )
@@ -435,7 +435,7 @@ case 26:
_out: {}
}
-#line 159 "parser.rl"
+#line 160 "parser.rl"
if (cs >= JSON_object_first_final) {
if (RTEST(json->create_id)) {
@@ -454,7 +454,7 @@ case 26:
}
-#line 457 "parser.c"
+#line 458 "parser.c"
static const int JSON_value_start = 1;
static const int JSON_value_first_final = 21;
static const int JSON_value_error = 0;
@@ -462,7 +462,7 @@ static const int JSON_value_error = 0;
static const int JSON_value_en_main = 1;
-#line 257 "parser.rl"
+#line 258 "parser.rl"
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -470,14 +470,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
int cs = EVIL;
-#line 473 "parser.c"
+#line 474 "parser.c"
{
cs = JSON_value_start;
}
-#line 264 "parser.rl"
+#line 265 "parser.rl"
-#line 480 "parser.c"
+#line 481 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -502,14 +502,14 @@ st0:
cs = 0;
goto _out;
tr0:
-#line 205 "parser.rl"
+#line 206 "parser.rl"
{
char *np = JSON_parse_string(json, p, pe, result);
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
}
goto st21;
tr2:
-#line 210 "parser.rl"
+#line 211 "parser.rl"
{
char *np;
if(pe > p + 9 && !strncmp(MinusInfinity, p, 9)) {
@@ -529,7 +529,7 @@ tr2:
}
goto st21;
tr5:
-#line 228 "parser.rl"
+#line 229 "parser.rl"
{
char *np;
json->current_nesting++;
@@ -539,7 +539,7 @@ tr5:
}
goto st21;
tr9:
-#line 236 "parser.rl"
+#line 237 "parser.rl"
{
char *np;
json->current_nesting++;
@@ -549,7 +549,7 @@ tr9:
}
goto st21;
tr16:
-#line 198 "parser.rl"
+#line 199 "parser.rl"
{
if (json->allow_nan) {
*result = CInfinity;
@@ -559,7 +559,7 @@ tr16:
}
goto st21;
tr18:
-#line 191 "parser.rl"
+#line 192 "parser.rl"
{
if (json->allow_nan) {
*result = CNaN;
@@ -569,19 +569,19 @@ tr18:
}
goto st21;
tr22:
-#line 185 "parser.rl"
+#line 186 "parser.rl"
{
*result = Qfalse;
}
goto st21;
tr25:
-#line 182 "parser.rl"
+#line 183 "parser.rl"
{
*result = Qnil;
}
goto st21;
tr28:
-#line 188 "parser.rl"
+#line 189 "parser.rl"
{
*result = Qtrue;
}
@@ -590,9 +590,9 @@ st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
-#line 244 "parser.rl"
+#line 245 "parser.rl"
{ p--; {p++; cs = 21; goto _out;} }
-#line 595 "parser.c"
+#line 596 "parser.c"
goto st0;
st2:
if ( ++p == pe )
@@ -753,7 +753,7 @@ case 20:
_out: {}
}
-#line 265 "parser.rl"
+#line 266 "parser.rl"
if (cs >= JSON_value_first_final) {
return p;
@@ -763,7 +763,7 @@ case 20:
}
-#line 766 "parser.c"
+#line 767 "parser.c"
static const int JSON_integer_start = 1;
static const int JSON_integer_first_final = 5;
static const int JSON_integer_error = 0;
@@ -771,7 +771,7 @@ static const int JSON_integer_error = 0;
static const int JSON_integer_en_main = 1;
-#line 281 "parser.rl"
+#line 282 "parser.rl"
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -779,15 +779,15 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res
int cs = EVIL;
-#line 782 "parser.c"
+#line 783 "parser.c"
{
cs = JSON_integer_start;
}
-#line 288 "parser.rl"
+#line 289 "parser.rl"
json->memo = p;
-#line 790 "parser.c"
+#line 791 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -821,14 +821,14 @@ case 3:
goto st0;
goto tr4;
tr4:
-#line 278 "parser.rl"
+#line 279 "parser.rl"
{ p--; {p++; cs = 5; goto _out;} }
goto st5;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
-#line 831 "parser.c"
+#line 832 "parser.c"
goto st0;
st4:
if ( ++p == pe )
@@ -847,7 +847,7 @@ case 4:
_out: {}
}
-#line 290 "parser.rl"
+#line 291 "parser.rl"
if (cs >= JSON_integer_first_final) {
long len = p - json->memo;
@@ -859,7 +859,7 @@ case 4:
}
-#line 862 "parser.c"
+#line 863 "parser.c"
static const int JSON_float_start = 1;
static const int JSON_float_first_final = 10;
static const int JSON_float_error = 0;
@@ -867,7 +867,7 @@ static const int JSON_float_error = 0;
static const int JSON_float_en_main = 1;
-#line 312 "parser.rl"
+#line 313 "parser.rl"
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -875,15 +875,15 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
int cs = EVIL;
-#line 878 "parser.c"
+#line 879 "parser.c"
{
cs = JSON_float_start;
}
-#line 319 "parser.rl"
+#line 320 "parser.rl"
json->memo = p;
-#line 886 "parser.c"
+#line 887 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -941,14 +941,14 @@ case 5:
goto st0;
goto tr7;
tr7:
-#line 306 "parser.rl"
+#line 307 "parser.rl"
{ p--; {p++; cs = 10; goto _out;} }
goto st10;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
-#line 951 "parser.c"
+#line 952 "parser.c"
goto st0;
st6:
if ( ++p == pe )
@@ -1009,7 +1009,7 @@ case 9:
_out: {}
}
-#line 321 "parser.rl"
+#line 322 "parser.rl"
if (cs >= JSON_float_first_final) {
long len = p - json->memo;
@@ -1022,7 +1022,7 @@ case 9:
-#line 1025 "parser.c"
+#line 1026 "parser.c"
static const int JSON_array_start = 1;
static const int JSON_array_first_final = 17;
static const int JSON_array_error = 0;
@@ -1030,7 +1030,7 @@ static const int JSON_array_error = 0;
static const int JSON_array_en_main = 1;
-#line 357 "parser.rl"
+#line 358 "parser.rl"
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -1044,14 +1044,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
*result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class);
-#line 1047 "parser.c"
+#line 1048 "parser.c"
{
cs = JSON_array_start;
}
-#line 370 "parser.rl"
+#line 371 "parser.rl"
-#line 1054 "parser.c"
+#line 1055 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1090,7 +1090,7 @@ case 2:
goto st2;
goto st0;
tr2:
-#line 338 "parser.rl"
+#line 339 "parser.rl"
{
VALUE v = Qnil;
char *np = JSON_parse_value(json, p, pe, &v);
@@ -1106,7 +1106,7 @@ st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
-#line 1109 "parser.c"
+#line 1110 "parser.c"
switch( (*p) ) {
case 13: goto st3;
case 32: goto st3;
@@ -1206,14 +1206,14 @@ case 12:
goto st3;
goto st12;
tr4:
-#line 349 "parser.rl"
+#line 350 "parser.rl"
{ p--; {p++; cs = 17; goto _out;} }
goto st17;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
-#line 1216 "parser.c"
+#line 1217 "parser.c"
goto st0;
st13:
if ( ++p == pe )
@@ -1269,7 +1269,7 @@ case 16:
_out: {}
}
-#line 371 "parser.rl"
+#line 372 "parser.rl"
if(cs >= JSON_array_first_final) {
return p + 1;
@@ -1350,7 +1350,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
}
-#line 1353 "parser.c"
+#line 1354 "parser.c"
static const int JSON_string_start = 1;
static const int JSON_string_first_final = 8;
static const int JSON_string_error = 0;
@@ -1358,7 +1358,7 @@ static const int JSON_string_error = 0;
static const int JSON_string_en_main = 1;
-#line 470 "parser.rl"
+#line 471 "parser.rl"
static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -1367,15 +1367,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
*result = rb_str_buf_new(0);
-#line 1370 "parser.c"
+#line 1371 "parser.c"
{
cs = JSON_string_start;
}
-#line 478 "parser.rl"
+#line 479 "parser.rl"
json->memo = p;
-#line 1378 "parser.c"
+#line 1379 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1400,7 +1400,7 @@ case 2:
goto st0;
goto st2;
tr2:
-#line 456 "parser.rl"
+#line 457 "parser.rl"
{
*result = json_string_unescape(*result, json->memo + 1, p);
if (NIL_P(*result)) {
@@ -1411,14 +1411,14 @@ tr2:
{p = (( p + 1))-1;}
}
}
-#line 467 "parser.rl"
+#line 468 "parser.rl"
{ p--; {p++; cs = 8; goto _out;} }
goto st8;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
-#line 1421 "parser.c"
+#line 1422 "parser.c"
goto st0;
st3:
if ( ++p == pe )
@@ -1494,7 +1494,7 @@ case 7:
_out: {}
}
-#line 480 "parser.rl"
+#line 481 "parser.rl"
if (json->symbolize_names && json->parsing_name) {
*result = rb_str_intern(*result);
@@ -1508,7 +1508,7 @@ case 7:
-#line 1511 "parser.c"
+#line 1512 "parser.c"
static const int JSON_start = 1;
static const int JSON_first_final = 10;
static const int JSON_error = 0;
@@ -1516,7 +1516,7 @@ static const int JSON_error = 0;
static const int JSON_en_main = 1;
-#line 517 "parser.rl"
+#line 518 "parser.rl"
/*
@@ -1698,16 +1698,16 @@ static VALUE cParser_parse(VALUE self)
GET_PARSER;
-#line 1701 "parser.c"
+#line 1702 "parser.c"
{
cs = JSON_start;
}
-#line 698 "parser.rl"
+#line 699 "parser.rl"
p = json->source;
pe = p + json->len;
-#line 1710 "parser.c"
+#line 1711 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1763,7 +1763,7 @@ case 5:
goto st1;
goto st5;
tr3:
-#line 506 "parser.rl"
+#line 507 "parser.rl"
{
char *np;
json->current_nesting = 1;
@@ -1772,7 +1772,7 @@ tr3:
}
goto st10;
tr4:
-#line 499 "parser.rl"
+#line 500 "parser.rl"
{
char *np;
json->current_nesting = 1;
@@ -1784,7 +1784,7 @@ st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
-#line 1787 "parser.c"
+#line 1788 "parser.c"
switch( (*p) ) {
case 13: goto st10;
case 32: goto st10;
@@ -1841,7 +1841,7 @@ case 9:
_out: {}
}
-#line 701 "parser.rl"
+#line 702 "parser.rl"
if (cs >= JSON_first_final && p == pe) {
return result;
diff --git a/java/lib/bytelist-1.0.6.jar b/java/lib/bytelist-1.0.6.jar
new file mode 100644
index 0000000..7918e7c
--- /dev/null
+++ b/java/lib/bytelist-1.0.6.jar
Binary files differ
diff --git a/java/lib/jcodings.jar b/java/lib/jcodings.jar
new file mode 100644
index 0000000..e33fc99
--- /dev/null
+++ b/java/lib/jcodings.jar
Binary files differ
diff --git a/src/json/ext/ByteListTranscoder.java b/java/src/json/ext/ByteListTranscoder.java
index ed9e54b..ed9e54b 100644
--- a/src/json/ext/ByteListTranscoder.java
+++ b/java/src/json/ext/ByteListTranscoder.java
diff --git a/src/json/ext/Generator.java b/java/src/json/ext/Generator.java
index 230d68f..230d68f 100644
--- a/src/json/ext/Generator.java
+++ b/java/src/json/ext/Generator.java
diff --git a/src/json/ext/GeneratorMethods.java b/java/src/json/ext/GeneratorMethods.java
index 28a612d..28a612d 100644
--- a/src/json/ext/GeneratorMethods.java
+++ b/java/src/json/ext/GeneratorMethods.java
diff --git a/src/json/ext/GeneratorService.java b/java/src/json/ext/GeneratorService.java
index b8deb22..b8deb22 100644
--- a/src/json/ext/GeneratorService.java
+++ b/java/src/json/ext/GeneratorService.java
diff --git a/src/json/ext/GeneratorState.java b/java/src/json/ext/GeneratorState.java
index dc99000..dc99000 100644
--- a/src/json/ext/GeneratorState.java
+++ b/java/src/json/ext/GeneratorState.java
diff --git a/src/json/ext/OptionsReader.java b/java/src/json/ext/OptionsReader.java
index 3bc8d5f..3bc8d5f 100644
--- a/src/json/ext/OptionsReader.java
+++ b/java/src/json/ext/OptionsReader.java
diff --git a/src/json/ext/Parser.java b/java/src/json/ext/Parser.java
index e7c1b14..c8f6f3d 100644
--- a/src/json/ext/Parser.java
+++ b/java/src/json/ext/Parser.java
@@ -1,5 +1,5 @@
-// line 1 "src/json/ext/Parser.rl"
+// line 1 "Parser.rl"
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
@@ -297,11 +297,11 @@ public class Parser extends RubyObject {
}
-// line 323 "src/json/ext/Parser.rl"
+// line 323 "Parser.rl"
-// line 305 "src/json/ext/Parser.java"
+// line 305 "Parser.java"
private static byte[] init__JSON_value_actions_0()
{
return new byte [] {
@@ -415,7 +415,7 @@ static final int JSON_value_error = 0;
static final int JSON_value_en_main = 1;
-// line 429 "src/json/ext/Parser.rl"
+// line 429 "Parser.rl"
ParserResult parseValue(int p, int pe) {
@@ -423,14 +423,14 @@ static final int JSON_value_en_main = 1;
IRubyObject result = null;
-// line 427 "src/json/ext/Parser.java"
+// line 427 "Parser.java"
{
cs = JSON_value_start;
}
-// line 436 "src/json/ext/Parser.rl"
+// line 436 "Parser.rl"
-// line 434 "src/json/ext/Parser.java"
+// line 434 "Parser.java"
{
int _klen;
int _trans = 0;
@@ -456,13 +456,13 @@ case 1:
while ( _nacts-- > 0 ) {
switch ( _JSON_value_actions[_acts++] ) {
case 9:
-// line 414 "src/json/ext/Parser.rl"
+// line 414 "Parser.rl"
{
p--;
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
}
break;
-// line 466 "src/json/ext/Parser.java"
+// line 466 "Parser.java"
}
}
@@ -525,25 +525,25 @@ case 1:
switch ( _JSON_value_actions[_acts++] )
{
case 0:
-// line 331 "src/json/ext/Parser.rl"
+// line 331 "Parser.rl"
{
result = getRuntime().getNil();
}
break;
case 1:
-// line 334 "src/json/ext/Parser.rl"
+// line 334 "Parser.rl"
{
result = getRuntime().getFalse();
}
break;
case 2:
-// line 337 "src/json/ext/Parser.rl"
+// line 337 "Parser.rl"
{
result = getRuntime().getTrue();
}
break;
case 3:
-// line 340 "src/json/ext/Parser.rl"
+// line 340 "Parser.rl"
{
if (parser.allowNaN) {
result = getConstant(CONST_NAN);
@@ -553,7 +553,7 @@ case 1:
}
break;
case 4:
-// line 347 "src/json/ext/Parser.rl"
+// line 347 "Parser.rl"
{
if (parser.allowNaN) {
result = getConstant(CONST_INFINITY);
@@ -563,7 +563,7 @@ case 1:
}
break;
case 5:
-// line 354 "src/json/ext/Parser.rl"
+// line 354 "Parser.rl"
{
if (pe > p + 9 &&
absSubSequence(p, p + 9).toString().equals(JSON_MINUS_INFINITY)) {
@@ -592,7 +592,7 @@ case 1:
}
break;
case 6:
-// line 380 "src/json/ext/Parser.rl"
+// line 380 "Parser.rl"
{
ParserResult res = parseString(p, pe);
if (res == null) {
@@ -605,7 +605,7 @@ case 1:
}
break;
case 7:
-// line 390 "src/json/ext/Parser.rl"
+// line 390 "Parser.rl"
{
currentNesting++;
ParserResult res = parseArray(p, pe);
@@ -620,7 +620,7 @@ case 1:
}
break;
case 8:
-// line 402 "src/json/ext/Parser.rl"
+// line 402 "Parser.rl"
{
currentNesting++;
ParserResult res = parseObject(p, pe);
@@ -634,7 +634,7 @@ case 1:
}
}
break;
-// line 638 "src/json/ext/Parser.java"
+// line 638 "Parser.java"
}
}
}
@@ -654,7 +654,7 @@ case 5:
break; }
}
-// line 437 "src/json/ext/Parser.rl"
+// line 437 "Parser.rl"
if (cs >= JSON_value_first_final && result != null) {
return new ParserResult(result, p);
@@ -664,7 +664,7 @@ case 5:
}
-// line 668 "src/json/ext/Parser.java"
+// line 668 "Parser.java"
private static byte[] init__JSON_integer_actions_0()
{
return new byte [] {
@@ -763,22 +763,22 @@ static final int JSON_integer_error = 0;
static final int JSON_integer_en_main = 1;
-// line 456 "src/json/ext/Parser.rl"
+// line 456 "Parser.rl"
ParserResult parseInteger(int p, int pe) {
int cs = EVIL;
-// line 774 "src/json/ext/Parser.java"
+// line 774 "Parser.java"
{
cs = JSON_integer_start;
}
-// line 462 "src/json/ext/Parser.rl"
+// line 462 "Parser.rl"
int memo = p;
-// line 782 "src/json/ext/Parser.java"
+// line 782 "Parser.java"
{
int _klen;
int _trans = 0;
@@ -859,13 +859,13 @@ case 1:
switch ( _JSON_integer_actions[_acts++] )
{
case 0:
-// line 450 "src/json/ext/Parser.rl"
+// line 450 "Parser.rl"
{
p--;
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
}
break;
-// line 869 "src/json/ext/Parser.java"
+// line 869 "Parser.java"
}
}
}
@@ -885,7 +885,7 @@ case 5:
break; }
}
-// line 464 "src/json/ext/Parser.rl"
+// line 464 "Parser.rl"
if (cs < JSON_integer_first_final) {
return null;
@@ -900,7 +900,7 @@ case 5:
}
-// line 904 "src/json/ext/Parser.java"
+// line 904 "Parser.java"
private static byte[] init__JSON_float_actions_0()
{
return new byte [] {
@@ -1002,22 +1002,22 @@ static final int JSON_float_error = 0;
static final int JSON_float_en_main = 1;
-// line 492 "src/json/ext/Parser.rl"
+// line 492 "Parser.rl"
ParserResult parseFloat(int p, int pe) {
int cs = EVIL;
-// line 1013 "src/json/ext/Parser.java"
+// line 1013 "Parser.java"
{
cs = JSON_float_start;
}
-// line 498 "src/json/ext/Parser.rl"
+// line 498 "Parser.rl"
int memo = p;
-// line 1021 "src/json/ext/Parser.java"
+// line 1021 "Parser.java"
{
int _klen;
int _trans = 0;
@@ -1098,13 +1098,13 @@ case 1:
switch ( _JSON_float_actions[_acts++] )
{
case 0:
-// line 483 "src/json/ext/Parser.rl"
+// line 483 "Parser.rl"
{
p--;
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
}
break;
-// line 1108 "src/json/ext/Parser.java"
+// line 1108 "Parser.java"
}
}
}
@@ -1124,7 +1124,7 @@ case 5:
break; }
}
-// line 500 "src/json/ext/Parser.rl"
+// line 500 "Parser.rl"
if (cs < JSON_float_first_final) {
return null;
@@ -1139,7 +1139,7 @@ case 5:
}
-// line 1143 "src/json/ext/Parser.java"
+// line 1143 "Parser.java"
private static byte[] init__JSON_string_actions_0()
{
return new byte [] {
@@ -1241,7 +1241,7 @@ static final int JSON_string_error = 0;
static final int JSON_string_en_main = 1;
-// line 544 "src/json/ext/Parser.rl"
+// line 544 "Parser.rl"
ParserResult parseString(int p, int pe) {
@@ -1249,15 +1249,15 @@ static final int JSON_string_en_main = 1;
RubyString result = null;
-// line 1253 "src/json/ext/Parser.java"
+// line 1253 "Parser.java"
{
cs = JSON_string_start;
}
-// line 551 "src/json/ext/Parser.rl"
+// line 551 "Parser.rl"
int memo = p;
-// line 1261 "src/json/ext/Parser.java"
+// line 1261 "Parser.java"
{
int _klen;
int _trans = 0;
@@ -1338,7 +1338,7 @@ case 1:
switch ( _JSON_string_actions[_acts++] )
{
case 0:
-// line 519 "src/json/ext/Parser.rl"
+// line 519 "Parser.rl"
{
int offset = byteList.begin();
ByteList decoded = decoder.decode(byteList, memo + 1 - offset,
@@ -1353,13 +1353,13 @@ case 1:
}
break;
case 1:
-// line 532 "src/json/ext/Parser.rl"
+// line 532 "Parser.rl"
{
p--;
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
}
break;
-// line 1363 "src/json/ext/Parser.java"
+// line 1363 "Parser.java"
}
}
}
@@ -1379,7 +1379,7 @@ case 5:
break; }
}
-// line 553 "src/json/ext/Parser.rl"
+// line 553 "Parser.rl"
if (cs >= JSON_string_first_final && result != null) {
return new ParserResult(result, p + 1);
@@ -1389,7 +1389,7 @@ case 5:
}
-// line 1393 "src/json/ext/Parser.java"
+// line 1393 "Parser.java"
private static byte[] init__JSON_array_actions_0()
{
return new byte [] {
@@ -1502,7 +1502,7 @@ static final int JSON_array_error = 0;
static final int JSON_array_en_main = 1;
-// line 594 "src/json/ext/Parser.rl"
+// line 594 "Parser.rl"
ParserResult parseArray(int p, int pe) {
@@ -1520,14 +1520,14 @@ static final int JSON_array_en_main = 1;
IRubyObject.NULL_ARRAY, Block.NULL_BLOCK);
-// line 1524 "src/json/ext/Parser.java"
+// line 1524 "Parser.java"
{
cs = JSON_array_start;
}
-// line 611 "src/json/ext/Parser.rl"
+// line 611 "Parser.rl"
-// line 1531 "src/json/ext/Parser.java"
+// line 1531 "Parser.java"
{
int _klen;
int _trans = 0;
@@ -1608,7 +1608,7 @@ case 1:
switch ( _JSON_array_actions[_acts++] )
{
case 0:
-// line 567 "src/json/ext/Parser.rl"
+// line 567 "Parser.rl"
{
ParserResult res = parseValue(p, pe);
if (res == null) {
@@ -1621,13 +1621,13 @@ case 1:
}
break;
case 1:
-// line 578 "src/json/ext/Parser.rl"
+// line 578 "Parser.rl"
{
p--;
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
}
break;
-// line 1631 "src/json/ext/Parser.java"
+// line 1631 "Parser.java"
}
}
}
@@ -1647,7 +1647,7 @@ case 5:
break; }
}
-// line 612 "src/json/ext/Parser.rl"
+// line 612 "Parser.rl"
if (cs >= JSON_array_first_final) {
return new ParserResult(result, p + 1);
@@ -1657,7 +1657,7 @@ case 5:
}
-// line 1661 "src/json/ext/Parser.java"
+// line 1661 "Parser.java"
private static byte[] init__JSON_object_actions_0()
{
return new byte [] {
@@ -1780,7 +1780,7 @@ static final int JSON_object_error = 0;
static final int JSON_object_en_main = 1;
-// line 668 "src/json/ext/Parser.rl"
+// line 668 "Parser.rl"
ParserResult parseObject(int p, int pe) {
@@ -1799,14 +1799,14 @@ static final int JSON_object_en_main = 1;
IRubyObject.NULL_ARRAY, Block.NULL_BLOCK);
-// line 1803 "src/json/ext/Parser.java"
+// line 1803 "Parser.java"
{
cs = JSON_object_start;
}
-// line 686 "src/json/ext/Parser.rl"
+// line 686 "Parser.rl"
-// line 1810 "src/json/ext/Parser.java"
+// line 1810 "Parser.java"
{
int _klen;
int _trans = 0;
@@ -1887,7 +1887,7 @@ case 1:
switch ( _JSON_object_actions[_acts++] )
{
case 0:
-// line 626 "src/json/ext/Parser.rl"
+// line 626 "Parser.rl"
{
ParserResult res = parseValue(p, pe);
if (res == null) {
@@ -1900,7 +1900,7 @@ case 1:
}
break;
case 1:
-// line 637 "src/json/ext/Parser.rl"
+// line 637 "Parser.rl"
{
ParserResult res = parseString(p, pe);
if (res == null) {
@@ -1920,13 +1920,13 @@ case 1:
}
break;
case 2:
-// line 655 "src/json/ext/Parser.rl"
+// line 655 "Parser.rl"
{
p--;
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
}
break;
-// line 1930 "src/json/ext/Parser.java"
+// line 1930 "Parser.java"
}
}
}
@@ -1946,7 +1946,7 @@ case 5:
break; }
}
-// line 687 "src/json/ext/Parser.rl"
+// line 687 "Parser.rl"
if (cs < JSON_object_first_final) {
return null;
@@ -1972,7 +1972,7 @@ case 5:
}
-// line 1976 "src/json/ext/Parser.java"
+// line 1976 "Parser.java"
private static byte[] init__JSON_actions_0()
{
return new byte [] {
@@ -2076,7 +2076,7 @@ static final int JSON_error = 0;
static final int JSON_en_main = 1;
-// line 745 "src/json/ext/Parser.rl"
+// line 745 "Parser.rl"
public IRubyObject parse() {
@@ -2085,16 +2085,16 @@ static final int JSON_en_main = 1;
IRubyObject result = null;
-// line 2089 "src/json/ext/Parser.java"
+// line 2089 "Parser.java"
{
cs = JSON_start;
}
-// line 753 "src/json/ext/Parser.rl"
+// line 753 "Parser.rl"
p = byteList.begin();
pe = p + byteList.length();
-// line 2098 "src/json/ext/Parser.java"
+// line 2098 "Parser.java"
{
int _klen;
int _trans = 0;
@@ -2175,7 +2175,7 @@ case 1:
switch ( _JSON_actions[_acts++] )
{
case 0:
-// line 717 "src/json/ext/Parser.rl"
+// line 717 "Parser.rl"
{
currentNesting = 1;
ParserResult res = parseObject(p, pe);
@@ -2189,7 +2189,7 @@ case 1:
}
break;
case 1:
-// line 729 "src/json/ext/Parser.rl"
+// line 729 "Parser.rl"
{
currentNesting = 1;
ParserResult res = parseArray(p, pe);
@@ -2202,7 +2202,7 @@ case 1:
}
}
break;
-// line 2206 "src/json/ext/Parser.java"
+// line 2206 "Parser.java"
}
}
}
@@ -2222,7 +2222,7 @@ case 5:
break; }
}
-// line 756 "src/json/ext/Parser.rl"
+// line 756 "Parser.rl"
if (cs >= JSON_first_final && p == pe) {
return result;
diff --git a/src/json/ext/Parser.rl b/java/src/json/ext/Parser.rl
index 00badc8..00badc8 100644
--- a/src/json/ext/Parser.rl
+++ b/java/src/json/ext/Parser.rl
diff --git a/src/json/ext/ParserService.java b/java/src/json/ext/ParserService.java
index e0805a7..e0805a7 100644
--- a/src/json/ext/ParserService.java
+++ b/java/src/json/ext/ParserService.java
diff --git a/src/json/ext/RuntimeInfo.java b/java/src/json/ext/RuntimeInfo.java
index f446afe..f446afe 100644
--- a/src/json/ext/RuntimeInfo.java
+++ b/java/src/json/ext/RuntimeInfo.java
diff --git a/src/json/ext/StringDecoder.java b/java/src/json/ext/StringDecoder.java
index a4ee975..a4ee975 100644
--- a/src/json/ext/StringDecoder.java
+++ b/java/src/json/ext/StringDecoder.java
diff --git a/src/json/ext/StringEncoder.java b/java/src/json/ext/StringEncoder.java
index 57bd19b..57bd19b 100644
--- a/src/json/ext/StringEncoder.java
+++ b/java/src/json/ext/StringEncoder.java
diff --git a/src/json/ext/Utils.java b/java/src/json/ext/Utils.java
index 7a1dfee..7a1dfee 100644
--- a/src/json/ext/Utils.java
+++ b/java/src/json/ext/Utils.java
diff --git a/json-java.gemspec b/json-java.gemspec
index c2d6c43..144f650 100644
--- a/json-java.gemspec
+++ b/json-java.gemspec
@@ -12,7 +12,7 @@ spec = Gem::Specification.new do |s|
s.platform = 'java'
s.rubyforge_project = "json-jruby"
- s.files = Dir["../{docs,lib,tests}/**/*"]
+ s.files = Dir["{docs,lib,tests}/**/*"]
end
if $0 == __FILE__
diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb
index 335c6ae..94cb239 100644
--- a/lib/json/pure/generator.rb
+++ b/lib/json/pure/generator.rb
@@ -106,11 +106,13 @@ module JSON
# an unconfigured instance. If _opts_ is a State object, it is just
# returned.
def self.from_state(opts)
- case opts
- when self
+ case
+ when self === opts
opts
- when Hash
- new(opts)
+ when opts.respond_to?(:to_hash)
+ new(opts.to_hash)
+ when opts.respond_to?(:to_h)
+ new(opts.to_h)
else
SAFE_STATE_PROTOTYPE.dup
end
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
deleted file mode 100644
index 1ddf7e8..0000000
--- a/nbproject/build-impl.xml
+++ /dev/null
@@ -1,805 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT ***
-*** EDIT ../build.xml INSTEAD ***
-
-For the purpose of easier reading the script
-is divided into following sections:
-
- - initialization
- - compilation
- - jar
- - execution
- - debugging
- - javadoc
- - junit compilation
- - junit execution
- - junit debugging
- - applet
- - cleanup
-
- -->
-<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="JSON-JRuby-impl">
- <fail message="Please build using Ant 1.7.1 or higher.">
- <condition>
- <not>
- <antversion atleast="1.7.1"/>
- </not>
- </condition>
- </fail>
- <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
- <!--
- ======================
- INITIALIZATION SECTION
- ======================
- -->
- <target name="-pre-init">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="-pre-init" name="-init-private">
- <property file="nbproject/private/config.properties"/>
- <property file="nbproject/private/configs/${config}.properties"/>
- <property file="nbproject/private/private.properties"/>
- </target>
- <target depends="-pre-init,-init-private" name="-init-user">
- <property file="${user.properties.file}"/>
- <!-- The two properties below are usually overridden -->
- <!-- by the active platform. Just a fallback. -->
- <property name="default.javac.source" value="1.4"/>
- <property name="default.javac.target" value="1.4"/>
- </target>
- <target depends="-pre-init,-init-private,-init-user" name="-init-project">
- <property file="nbproject/configs/${config}.properties"/>
- <property file="nbproject/project.properties"/>
- </target>
- <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
- <available file="${manifest.file}" property="manifest.available"/>
- <condition property="main.class.available">
- <and>
- <isset property="main.class"/>
- <not>
- <equals arg1="${main.class}" arg2="" trim="true"/>
- </not>
- </and>
- </condition>
- <condition property="manifest.available+main.class">
- <and>
- <isset property="manifest.available"/>
- <isset property="main.class.available"/>
- </and>
- </condition>
- <condition property="do.mkdist">
- <and>
- <isset property="libs.CopyLibs.classpath"/>
- <not>
- <istrue value="${mkdist.disabled}"/>
- </not>
- </and>
- </condition>
- <condition property="manifest.available+main.class+mkdist.available">
- <and>
- <istrue value="${manifest.available+main.class}"/>
- <isset property="do.mkdist"/>
- </and>
- </condition>
- <condition property="manifest.available+mkdist.available">
- <and>
- <istrue value="${manifest.available}"/>
- <isset property="do.mkdist"/>
- </and>
- </condition>
- <condition property="manifest.available-mkdist.available">
- <or>
- <istrue value="${manifest.available}"/>
- <isset property="do.mkdist"/>
- </or>
- </condition>
- <condition property="manifest.available+main.class-mkdist.available">
- <or>
- <istrue value="${manifest.available+main.class}"/>
- <isset property="do.mkdist"/>
- </or>
- </condition>
- <condition property="have.tests">
- <or>
- <available file="${test.src.dir}"/>
- </or>
- </condition>
- <condition property="have.sources">
- <or>
- <available file="${src.dir}"/>
- </or>
- </condition>
- <condition property="netbeans.home+have.tests">
- <and>
- <isset property="netbeans.home"/>
- <isset property="have.tests"/>
- </and>
- </condition>
- <condition property="no.javadoc.preview">
- <and>
- <isset property="javadoc.preview"/>
- <isfalse value="${javadoc.preview}"/>
- </and>
- </condition>
- <property name="run.jvmargs" value=""/>
- <property name="javac.compilerargs" value=""/>
- <property name="work.dir" value="${basedir}"/>
- <condition property="no.deps">
- <and>
- <istrue value="${no.dependencies}"/>
- </and>
- </condition>
- <property name="javac.debug" value="true"/>
- <property name="javadoc.preview" value="true"/>
- <property name="application.args" value=""/>
- <property name="source.encoding" value="${file.encoding}"/>
- <property name="runtime.encoding" value="${source.encoding}"/>
- <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
- <and>
- <isset property="javadoc.encoding"/>
- <not>
- <equals arg1="${javadoc.encoding}" arg2=""/>
- </not>
- </and>
- </condition>
- <property name="javadoc.encoding.used" value="${source.encoding}"/>
- <property name="includes" value="**"/>
- <property name="excludes" value=""/>
- <property name="do.depend" value="false"/>
- <condition property="do.depend.true">
- <istrue value="${do.depend}"/>
- </condition>
- <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
- <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
- <length length="0" string="${endorsed.classpath}" when="greater"/>
- </condition>
- <property name="javac.fork" value="false"/>
- </target>
- <target name="-post-init">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
- <fail unless="src.dir">Must set src.dir</fail>
- <fail unless="test.src.dir">Must set test.src.dir</fail>
- <fail unless="build.dir">Must set build.dir</fail>
- <fail unless="dist.dir">Must set dist.dir</fail>
- <fail unless="build.classes.dir">Must set build.classes.dir</fail>
- <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
- <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
- <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
- <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
- <fail unless="dist.jar">Must set dist.jar</fail>
- </target>
- <target name="-init-macrodef-property">
- <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
- <attribute name="name"/>
- <attribute name="value"/>
- <sequential>
- <property name="@{name}" value="${@{value}}"/>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-macrodef-javac">
- <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.dir}" name="srcdir"/>
- <attribute default="${build.classes.dir}" name="destdir"/>
- <attribute default="${javac.classpath}" name="classpath"/>
- <attribute default="${includes}" name="includes"/>
- <attribute default="${excludes}" name="excludes"/>
- <attribute default="${javac.debug}" name="debug"/>
- <attribute default="${empty.dir}" name="sourcepath"/>
- <attribute default="${empty.dir}" name="gensrcdir"/>
- <element name="customize" optional="true"/>
- <sequential>
- <property location="${build.dir}/empty" name="empty.dir"/>
- <mkdir dir="${empty.dir}"/>
- <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
- <src>
- <dirset dir="@{gensrcdir}" erroronmissingdir="false">
- <include name="*"/>
- </dirset>
- </src>
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
- <compilerarg line="${javac.compilerargs}"/>
- <customize/>
- </javac>
- </sequential>
- </macrodef>
- <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${src.dir}" name="srcdir"/>
- <attribute default="${build.classes.dir}" name="destdir"/>
- <attribute default="${javac.classpath}" name="classpath"/>
- <sequential>
- <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- </depend>
- </sequential>
- </macrodef>
- <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${build.classes.dir}" name="destdir"/>
- <sequential>
- <fail unless="javac.includes">Must set javac.includes</fail>
- <pathconvert pathsep="," property="javac.includes.binary">
- <path>
- <filelist dir="@{destdir}" files="${javac.includes}"/>
- </path>
- <globmapper from="*.java" to="*.class"/>
- </pathconvert>
- <delete>
- <files includes="${javac.includes.binary}"/>
- </delete>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-macrodef-junit">
- <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${includes}" name="includes"/>
- <attribute default="${excludes}" name="excludes"/>
- <attribute default="**" name="testincludes"/>
- <sequential>
- <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
- <batchtest todir="${build.test.results.dir}">
- <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
- <filename name="@{testincludes}"/>
- </fileset>
- </batchtest>
- <classpath>
- <path path="${run.test.classpath}"/>
- </classpath>
- <syspropertyset>
- <propertyref prefix="test-sys-prop."/>
- <mapper from="test-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <formatter type="brief" usefile="false"/>
- <formatter type="xml"/>
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
- <jvmarg line="${run.jvmargs}"/>
- </junit>
- </sequential>
- </macrodef>
- </target>
- <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
- <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
- <attribute default="${main.class}" name="name"/>
- <attribute default="${debug.classpath}" name="classpath"/>
- <attribute default="" name="stopclassname"/>
- <sequential>
- <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- </nbjpdastart>
- </sequential>
- </macrodef>
- <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
- <attribute default="${build.classes.dir}" name="dir"/>
- <sequential>
- <nbjpdareload>
- <fileset dir="@{dir}" includes="${fix.classes}">
- <include name="${fix.includes}*.class"/>
- </fileset>
- </nbjpdareload>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-debug-args">
- <property name="version-output" value="java version &quot;${ant.java.version}"/>
- <condition property="have-jdk-older-than-1.4">
- <or>
- <contains string="${version-output}" substring="java version &quot;1.0"/>
- <contains string="${version-output}" substring="java version &quot;1.1"/>
- <contains string="${version-output}" substring="java version &quot;1.2"/>
- <contains string="${version-output}" substring="java version &quot;1.3"/>
- </or>
- </condition>
- <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
- <istrue value="${have-jdk-older-than-1.4}"/>
- </condition>
- <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
- <os family="windows"/>
- </condition>
- <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
- <isset property="debug.transport"/>
- </condition>
- </target>
- <target depends="-init-debug-args" name="-init-macrodef-debug">
- <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
- <attribute default="${main.class}" name="classname"/>
- <attribute default="${debug.classpath}" name="classpath"/>
- <element name="customize" optional="true"/>
- <sequential>
- <java classname="@{classname}" dir="${work.dir}" fork="true">
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
- <jvmarg line="${debug-args-line}"/>
- <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
- <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
- <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
- <jvmarg line="${run.jvmargs}"/>
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- <syspropertyset>
- <propertyref prefix="run-sys-prop."/>
- <mapper from="run-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <customize/>
- </java>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-macrodef-java">
- <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
- <attribute default="${main.class}" name="classname"/>
- <attribute default="${run.classpath}" name="classpath"/>
- <element name="customize" optional="true"/>
- <sequential>
- <java classname="@{classname}" dir="${work.dir}" fork="true">
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
- <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
- <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
- <jvmarg line="${run.jvmargs}"/>
- <classpath>
- <path path="@{classpath}"/>
- </classpath>
- <syspropertyset>
- <propertyref prefix="run-sys-prop."/>
- <mapper from="run-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <customize/>
- </java>
- </sequential>
- </macrodef>
- </target>
- <target name="-init-presetdef-jar">
- <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
- <jar compress="${jar.compress}" jarfile="${dist.jar}">
- <j2seproject1:fileset dir="${build.classes.dir}"/>
- </jar>
- </presetdef>
- </target>
- <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
- <!--
- ===================
- COMPILATION SECTION
- ===================
- -->
- <target name="-deps-jar-init" unless="built-jar.properties">
- <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
- <delete file="${built-jar.properties}" quiet="true"/>
- </target>
- <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
- <echo level="warn" message="Cycle detected: JSON-JRuby was already built"/>
- </target>
- <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
- <mkdir dir="${build.dir}"/>
- <touch file="${built-jar.properties}" verbose="false"/>
- <property file="${built-jar.properties}" prefix="already.built.jar."/>
- <antcall target="-warn-already-built-jar"/>
- <propertyfile file="${built-jar.properties}">
- <entry key="${basedir}" value=""/>
- </propertyfile>
- </target>
- <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
- <target depends="init" name="-check-automatic-build">
- <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
- </target>
- <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
- <antcall target="clean"/>
- </target>
- <target depends="init,deps-jar" name="-pre-pre-compile">
- <mkdir dir="${build.classes.dir}"/>
- </target>
- <target name="-pre-compile">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target if="do.depend.true" name="-compile-depend">
- <pathconvert property="build.generated.subdirs">
- <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
- <include name="*"/>
- </dirset>
- </pathconvert>
- <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
- </target>
- <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
- <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
- <copy todir="${build.classes.dir}">
- <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- </copy>
- </target>
- <target name="-post-compile">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
- <target name="-pre-compile-single">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
- <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
- <j2seproject3:force-recompile/>
- <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
- </target>
- <target name="-post-compile-single">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
- <!--
- ====================
- JAR BUILDING SECTION
- ====================
- -->
- <target depends="init" name="-pre-pre-jar">
- <dirname file="${dist.jar}" property="dist.jar.dir"/>
- <mkdir dir="${dist.jar.dir}"/>
- </target>
- <target name="-pre-jar">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
- <j2seproject1:jar/>
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
- <j2seproject1:jar manifest="${manifest.file}"/>
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
- <j2seproject1:jar manifest="${manifest.file}">
- <j2seproject1:manifest>
- <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
- </j2seproject1:manifest>
- </j2seproject1:jar>
- <echo>To run this application from the command line without Ant, try:</echo>
- <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
- <property location="${dist.jar}" name="dist.jar.resolved"/>
- <pathconvert property="run.classpath.with.dist.jar">
- <path path="${run.classpath}"/>
- <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
- </pathconvert>
- <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
- <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
- <pathconvert property="run.classpath.without.build.classes.dir">
- <path path="${run.classpath}"/>
- <map from="${build.classes.dir.resolved}" to=""/>
- </pathconvert>
- <pathconvert pathsep=" " property="jar.classpath">
- <path path="${run.classpath.without.build.classes.dir}"/>
- <chainedmapper>
- <flattenmapper/>
- <globmapper from="*" to="lib/*"/>
- </chainedmapper>
- </pathconvert>
- <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
- <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
- <fileset dir="${build.classes.dir}"/>
- <manifest>
- <attribute name="Main-Class" value="${main.class}"/>
- <attribute name="Class-Path" value="${jar.classpath}"/>
- </manifest>
- </copylibs>
- <echo>To run this application from the command line without Ant, try:</echo>
- <property location="${dist.jar}" name="dist.jar.resolved"/>
- <echo>java -jar "${dist.jar.resolved}"</echo>
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
- <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
- <pathconvert property="run.classpath.without.build.classes.dir">
- <path path="${run.classpath}"/>
- <map from="${build.classes.dir.resolved}" to=""/>
- </pathconvert>
- <pathconvert pathsep=" " property="jar.classpath">
- <path path="${run.classpath.without.build.classes.dir}"/>
- <chainedmapper>
- <flattenmapper/>
- <globmapper from="*" to="lib/*"/>
- </chainedmapper>
- </pathconvert>
- <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
- <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
- <fileset dir="${build.classes.dir}"/>
- <manifest>
- <attribute name="Class-Path" value="${jar.classpath}"/>
- </manifest>
- </copylibs>
- </target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
- <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
- <pathconvert property="run.classpath.without.build.classes.dir">
- <path path="${run.classpath}"/>
- <map from="${build.classes.dir.resolved}" to=""/>
- </pathconvert>
- <pathconvert pathsep=" " property="jar.classpath">
- <path path="${run.classpath.without.build.classes.dir}"/>
- <chainedmapper>
- <flattenmapper/>
- <globmapper from="*" to="lib/*"/>
- </chainedmapper>
- </pathconvert>
- <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
- <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
- <fileset dir="${build.classes.dir}"/>
- <manifest>
- <attribute name="Class-Path" value="${jar.classpath}"/>
- </manifest>
- </copylibs>
- </target>
- <target name="-post-jar">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
- <!--
- =================
- EXECUTION SECTION
- =================
- -->
- <target depends="init,compile" description="Run a main class." name="run">
- <j2seproject1:java>
- <customize>
- <arg line="${application.args}"/>
- </customize>
- </j2seproject1:java>
- </target>
- <target name="-do-not-recompile">
- <property name="javac.includes.binary" value=""/>
- </target>
- <target depends="init,compile-single" name="run-single">
- <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
- <j2seproject1:java classname="${run.class}"/>
- </target>
- <target depends="init,compile-test-single" name="run-test-with-main">
- <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
- <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
- </target>
- <!--
- =================
- DEBUGGING SECTION
- =================
- -->
- <target depends="init" if="netbeans.home" name="-debug-start-debugger">
- <j2seproject1:nbjpdastart name="${debug.class}"/>
- </target>
- <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
- <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
- </target>
- <target depends="init,compile" name="-debug-start-debuggee">
- <j2seproject3:debug>
- <customize>
- <arg line="${application.args}"/>
- </customize>
- </j2seproject3:debug>
- </target>
- <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
- <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
- <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
- </target>
- <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
- <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
- <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
- <j2seproject3:debug classname="${debug.class}"/>
- </target>
- <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
- <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
- <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
- <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
- </target>
- <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
- <target depends="init" name="-pre-debug-fix">
- <fail unless="fix.includes">Must set fix.includes</fail>
- <property name="javac.includes" value="${fix.includes}.java"/>
- </target>
- <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
- <j2seproject1:nbjpdareload/>
- </target>
- <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
- <!--
- ===============
- JAVADOC SECTION
- ===============
- -->
- <target depends="init" name="-javadoc-build">
- <mkdir dir="${dist.javadoc.dir}"/>
- <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
- <classpath>
- <path path="${javac.classpath}"/>
- </classpath>
- <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
- <filename name="**/*.java"/>
- </fileset>
- <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
- <include name="**/*.java"/>
- </fileset>
- </javadoc>
- </target>
- <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
- <nbbrowse file="${dist.javadoc.dir}/index.html"/>
- </target>
- <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
- <!--
- =========================
- JUNIT COMPILATION SECTION
- =========================
- -->
- <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
- <mkdir dir="${build.test.classes.dir}"/>
- </target>
- <target name="-pre-compile-test">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target if="do.depend.true" name="-compile-test-depend">
- <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
- </target>
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
- <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
- <copy todir="${build.test.classes.dir}">
- <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- </copy>
- </target>
- <target name="-post-compile-test">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
- <target name="-pre-compile-test-single">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
- <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
- <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
- <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
- <copy todir="${build.test.classes.dir}">
- <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
- </copy>
- </target>
- <target name="-post-compile-test-single">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
- <!--
- =======================
- JUNIT EXECUTION SECTION
- =======================
- -->
- <target depends="init" if="have.tests" name="-pre-test-run">
- <mkdir dir="${build.test.results.dir}"/>
- </target>
- <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
- <j2seproject3:junit testincludes="**/*Test.java"/>
- </target>
- <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
- <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
- </target>
- <target depends="init" if="have.tests" name="test-report"/>
- <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
- <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
- <target depends="init" if="have.tests" name="-pre-test-run-single">
- <mkdir dir="${build.test.results.dir}"/>
- </target>
- <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
- <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
- <j2seproject3:junit excludes="" includes="${test.includes}"/>
- </target>
- <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
- <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
- </target>
- <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
- <!--
- =======================
- JUNIT DEBUGGING SECTION
- =======================
- -->
- <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
- <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
- <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
- <delete file="${test.report.file}"/>
- <mkdir dir="${build.test.results.dir}"/>
- <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
- <customize>
- <syspropertyset>
- <propertyref prefix="test-sys-prop."/>
- <mapper from="test-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <arg value="${test.class}"/>
- <arg value="showoutput=true"/>
- <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
- <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
- </customize>
- </j2seproject3:debug>
- </target>
- <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
- <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
- </target>
- <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
- <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
- <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
- </target>
- <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
- <!--
- =========================
- APPLET EXECUTION SECTION
- =========================
- -->
- <target depends="init,compile-single" name="run-applet">
- <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
- <j2seproject1:java classname="sun.applet.AppletViewer">
- <customize>
- <arg value="${applet.url}"/>
- </customize>
- </j2seproject1:java>
- </target>
- <!--
- =========================
- APPLET DEBUGGING SECTION
- =========================
- -->
- <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
- <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
- <j2seproject3:debug classname="sun.applet.AppletViewer">
- <customize>
- <arg value="${applet.url}"/>
- </customize>
- </j2seproject3:debug>
- </target>
- <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
- <!--
- ===============
- CLEANUP SECTION
- ===============
- -->
- <target name="-deps-clean-init" unless="built-clean.properties">
- <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
- <delete file="${built-clean.properties}" quiet="true"/>
- </target>
- <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
- <echo level="warn" message="Cycle detected: JSON-JRuby was already built"/>
- </target>
- <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
- <mkdir dir="${build.dir}"/>
- <touch file="${built-clean.properties}" verbose="false"/>
- <property file="${built-clean.properties}" prefix="already.built.clean."/>
- <antcall target="-warn-already-built-clean"/>
- <propertyfile file="${built-clean.properties}">
- <entry key="${basedir}" value=""/>
- </propertyfile>
- </target>
- <target depends="init" name="-do-clean">
- <delete dir="${build.dir}"/>
- <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
- </target>
- <target name="-post-clean">
- <!-- Empty placeholder for easier customization. -->
- <!-- You can override this target in the ../build.xml file. -->
- </target>
- <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
- <target name="-check-call-dep">
- <property file="${call.built.properties}" prefix="already.built."/>
- <condition property="should.call.dep">
- <not>
- <isset property="already.built.${call.subproject}"/>
- </not>
- </condition>
- </target>
- <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
- <ant antfile="${call.script}" inheritall="false" target="${call.target}">
- <propertyset>
- <propertyref prefix="transfer."/>
- <mapper from="transfer.*" to="*" type="glob"/>
- </propertyset>
- </ant>
- </target>
-</project>
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
deleted file mode 100644
index a9c62d4..0000000
--- a/nbproject/genfiles.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-build.xml.data.CRC32=82862954
-build.xml.script.CRC32=4ee68ef3
-build.xml.stylesheet.CRC32=be360661
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=82862954
-nbproject/build-impl.xml.script.CRC32=7ab44279
-nbproject/build-impl.xml.stylesheet.CRC32=576378a2@1.32.1.45
diff --git a/nbproject/project.properties b/nbproject/project.properties
deleted file mode 100644
index e199172..0000000
--- a/nbproject/project.properties
+++ /dev/null
@@ -1,70 +0,0 @@
-application.homepage=http://json-jruby.rubyforge.org/
-application.title=JSON-JRuby
-application.vendor=mernen
-build.classes.dir=${build.dir}/classes
-build.classes.excludes=**/*.java,**/*.form
-# This directory is removed when the project is cleaned:
-build.dir=build
-build.generated.sources.dir=${build.dir}/generated-sources
-endorsed.classpath=
-jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
-lib.dir=lib
-jruby.dir=../jruby
-build.generated.dir=${build.dir}/generated
-generator.jar=${lib.dir}/json/ext/generator.jar
-parser.jar=${lib.dir}/json/ext/parser.jar
-# Only compile against the classpath explicitly listed here:
-build.sysclasspath=ignore
-build.test.classes.dir=${build.dir}/test/classes
-build.test.results.dir=${build.dir}/test/results
-debug.classpath=\
- ${run.classpath}
-debug.test.classpath=\
- ${run.test.classpath}
-# This directory is removed when the project is cleaned:
-dist.dir=dist
-dist.jar=${dist.dir}/ext.jar
-dist.javadoc.dir=${dist.dir}/javadoc
-excludes=
-file.reference.bytelist.jar=${jruby.dir}/build_lib/bytelist.jar
-includes=**
-jar.compress=false
-javac.classpath=\
- ${file.reference.bytelist.jar}:\
- ${libs.Byelist.classpath}:\
- ${libs.Constantine.classpath}:\
- ${libs.JCodings.classpath}
-# Space-separated list of extra javac options
-javac.compilerargs=-Xlint -Xlint:-serial
-javac.deprecation=true
-javac.source=1.5
-javac.target=1.5
-javac.test.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-javadoc.additionalparam=
-javadoc.author=false
-javadoc.encoding=${source.encoding}
-javadoc.noindex=false
-javadoc.nonavbar=false
-javadoc.notree=false
-javadoc.private=false
-javadoc.splitindex=true
-javadoc.use=true
-javadoc.version=false
-javadoc.windowtitle=
-meta.inf.dir=${src.dir}/META-INF
-platform.active=default_platform
-run.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-# Space-separated list of JVM arguments used when running the project
-# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
-# or test-sys-prop.name=value to set system properties for unit tests):
-run.jvmargs=
-run.test.classpath=\
- ${javac.test.classpath}:\
- ${build.test.classes.dir}
-source.encoding=UTF-8
-src.dir=src
-test.src.dir=test
diff --git a/nbproject/project.xml b/nbproject/project.xml
deleted file mode 100644
index 7a9c731..0000000
--- a/nbproject/project.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
- <type>org.netbeans.modules.java.j2seproject</type>
- <configuration>
- <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
- <name>JSON-JRuby</name>
- <minimum-ant-version>1.6.5</minimum-ant-version>
- <source-roots>
- <root id="src.dir"/>
- </source-roots>
- <test-roots>
- <root id="test.src.dir"/>
- </test-roots>
- </data>
- </configuration>
-</project>
diff --git a/tests/test_json_addition.rb b/tests/test_json_addition.rb
index 2c89e39..34f0a71 100755
--- a/tests/test_json_addition.rb
+++ b/tests/test_json_addition.rb
@@ -7,7 +7,7 @@ when 'pure' then require 'json/pure'
when 'ext' then require 'json/ext'
else require 'json'
end
-require 'json/add/core'
+load 'json/add/core.rb'
require 'date'
class TC_JSONAddition < Test::Unit::TestCase
diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb
index 69c967e..5380a06 100755
--- a/tests/test_json_generate.rb
+++ b/tests/test_json_generate.rb
@@ -84,6 +84,8 @@ EOT
assert_raise(GeneratorError) { fast_generate(666) }
end
+
+
def test_states
json = generate({1=>2}, nil)
assert_equal('{"1":2}', json)
diff --git a/tests/test_json_rails.rb b/tests/test_json_rails.rb
index 7c3d51d..daa053c 100755
--- a/tests/test_json_rails.rb
+++ b/tests/test_json_rails.rb
@@ -7,7 +7,7 @@ when 'pure' then require 'json/pure'
when 'ext' then require 'json/ext'
else require 'json'
end
-require 'json/add/rails'
+load 'json/add/rails.rb'
require 'date'
class TC_JSONRails < Test::Unit::TestCase