json_pure 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,9 +23,9 @@
23
23
 
24
24
  /* unicode */
25
25
 
26
- typedef unsigned long UTF32; /* at least 32 bits */
27
- typedef unsigned short UTF16; /* at least 16 bits */
28
- typedef unsigned char UTF8; /* typically 8 bits */
26
+ typedef unsigned long UTF32; /* at least 32 bits */
27
+ typedef unsigned short UTF16; /* at least 16 bits */
28
+ typedef unsigned char UTF8; /* typically 8 bits */
29
29
 
30
30
  #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
31
31
  #define UNI_SUR_HIGH_START (UTF32)0xD800
@@ -46,8 +46,8 @@ typedef struct JSON_ParserStruct {
46
46
  int symbolize_names;
47
47
  VALUE object_class;
48
48
  VALUE array_class;
49
- int create_additions;
50
- VALUE match_string;
49
+ int create_additions;
50
+ VALUE match_string;
51
51
  } JSON_Parser;
52
52
 
53
53
  #define GET_PARSER \
@@ -77,7 +77,7 @@ static VALUE CNaN, CInfinity, CMinusInfinity;
77
77
 
78
78
  static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
79
79
  i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, i_object_class,
80
- i_array_class, i_key_p, i_deep_const_get, i_match, i_match_string;
80
+ i_array_class, i_key_p, i_deep_const_get, i_match, i_match_string, i_aset, i_leftshift;
81
81
 
82
82
  %%{
83
83
  machine JSON_common;
@@ -119,7 +119,11 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
119
119
  if (np == NULL) {
120
120
  fhold; fbreak;
121
121
  } else {
122
- rb_hash_aset(*result, last_name, v);
122
+ if (NIL_P(json->object_class)) {
123
+ rb_hash_aset(*result, last_name, v);
124
+ } else {
125
+ rb_funcall(*result, i_aset, 2, last_name, v);
126
+ }
123
127
  fexec np;
124
128
  }
125
129
  }
@@ -342,7 +346,11 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
342
346
  if (np == NULL) {
343
347
  fhold; fbreak;
344
348
  } else {
345
- rb_ary_push(*result, v);
349
+ if (NIL_P(json->array_class)) {
350
+ rb_ary_push(*result, v);
351
+ } else {
352
+ rb_funcall(*result, i_leftshift, 1, v);
353
+ }
346
354
  fexec np;
347
355
  }
348
356
  }
@@ -809,6 +817,8 @@ void Init_parser()
809
817
  i_match_string = rb_intern("match_string");
810
818
  i_key_p = rb_intern("key?");
811
819
  i_deep_const_get = rb_intern("deep_const_get");
820
+ i_aset = rb_intern("[]=");
821
+ i_leftshift = rb_intern("<<");
812
822
  #ifdef HAVE_RUBY_ENCODING_H
813
823
  CEncoding_UTF_8 = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-8"));
814
824
  CEncoding_UTF_16BE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-16be"));
@@ -354,11 +354,7 @@ public final class Generator {
354
354
  state.decreaseDepth();
355
355
  if (objectNl.length() != 0) {
356
356
  buffer.append(objectNl);
357
- if (indent.length != 0) {
358
- for (int i = 0; i < state.getDepth(); i++) {
359
- buffer.append(indent);
360
- }
361
- }
357
+ buffer.append(Utils.repeat(state.getIndent(), state.getDepth()));
362
358
  }
363
359
  buffer.append((byte)'}');
364
360
  }
@@ -1528,7 +1528,7 @@ static final int JSON_array_error = 0;
1528
1528
  static final int JSON_array_en_main = 1;
1529
1529
 
1530
1530
 
1531
- // line 620 "Parser.rl"
1531
+ // line 624 "Parser.rl"
1532
1532
 
1533
1533
 
1534
1534
  ParserResult parseArray(int p, int pe) {
@@ -1551,7 +1551,7 @@ static final int JSON_array_en_main = 1;
1551
1551
  cs = JSON_array_start;
1552
1552
  }
1553
1553
 
1554
- // line 637 "Parser.rl"
1554
+ // line 641 "Parser.rl"
1555
1555
 
1556
1556
  // line 1557 "Parser.java"
1557
1557
  {
@@ -1641,19 +1641,23 @@ case 1:
1641
1641
  p--;
1642
1642
  { p += 1; _goto_targ = 5; if (true) continue _goto;}
1643
1643
  } else {
1644
- result.append(res.result);
1644
+ if (!parser.arrayClass.getName().equals("Array")) {
1645
+ result.callMethod(context, "<<", res.result);
1646
+ } else {
1647
+ result.append(res.result);
1648
+ }
1645
1649
  {p = (( res.p))-1;}
1646
1650
  }
1647
1651
  }
1648
1652
  break;
1649
1653
  case 1:
1650
- // line 604 "Parser.rl"
1654
+ // line 608 "Parser.rl"
1651
1655
  {
1652
1656
  p--;
1653
1657
  { p += 1; _goto_targ = 5; if (true) continue _goto;}
1654
1658
  }
1655
1659
  break;
1656
- // line 1657 "Parser.java"
1660
+ // line 1661 "Parser.java"
1657
1661
  }
1658
1662
  }
1659
1663
  }
@@ -1673,7 +1677,7 @@ case 5:
1673
1677
  break; }
1674
1678
  }
1675
1679
 
1676
- // line 638 "Parser.rl"
1680
+ // line 642 "Parser.rl"
1677
1681
 
1678
1682
  if (cs >= JSON_array_first_final) {
1679
1683
  return new ParserResult(result, p + 1);
@@ -1683,7 +1687,7 @@ case 5:
1683
1687
  }
1684
1688
 
1685
1689
 
1686
- // line 1687 "Parser.java"
1690
+ // line 1691 "Parser.java"
1687
1691
  private static byte[] init__JSON_object_actions_0()
1688
1692
  {
1689
1693
  return new byte [] {
@@ -1806,7 +1810,7 @@ static final int JSON_object_error = 0;
1806
1810
  static final int JSON_object_en_main = 1;
1807
1811
 
1808
1812
 
1809
- // line 694 "Parser.rl"
1813
+ // line 702 "Parser.rl"
1810
1814
 
1811
1815
 
1812
1816
  ParserResult parseObject(int p, int pe) {
@@ -1825,14 +1829,14 @@ static final int JSON_object_en_main = 1;
1825
1829
  IRubyObject.NULL_ARRAY, Block.NULL_BLOCK);
1826
1830
 
1827
1831
 
1828
- // line 1829 "Parser.java"
1832
+ // line 1833 "Parser.java"
1829
1833
  {
1830
1834
  cs = JSON_object_start;
1831
1835
  }
1832
1836
 
1833
- // line 712 "Parser.rl"
1837
+ // line 720 "Parser.rl"
1834
1838
 
1835
- // line 1836 "Parser.java"
1839
+ // line 1840 "Parser.java"
1836
1840
  {
1837
1841
  int _klen;
1838
1842
  int _trans = 0;
@@ -1913,20 +1917,24 @@ case 1:
1913
1917
  switch ( _JSON_object_actions[_acts++] )
1914
1918
  {
1915
1919
  case 0:
1916
- // line 652 "Parser.rl"
1920
+ // line 656 "Parser.rl"
1917
1921
  {
1918
1922
  ParserResult res = parseValue(p, pe);
1919
1923
  if (res == null) {
1920
1924
  p--;
1921
1925
  { p += 1; _goto_targ = 5; if (true) continue _goto;}
1922
1926
  } else {
1923
- result.op_aset(context, lastName, res.result);
1927
+ if (!parser.objectClass.getName().equals("Hash")) {
1928
+ result.callMethod(context, "[]=", new IRubyObject[] { lastName, res.result });
1929
+ } else {
1930
+ result.op_aset(context, lastName, res.result);
1931
+ }
1924
1932
  {p = (( res.p))-1;}
1925
1933
  }
1926
1934
  }
1927
1935
  break;
1928
1936
  case 1:
1929
- // line 663 "Parser.rl"
1937
+ // line 671 "Parser.rl"
1930
1938
  {
1931
1939
  ParserResult res = parseString(p, pe);
1932
1940
  if (res == null) {
@@ -1946,13 +1954,13 @@ case 1:
1946
1954
  }
1947
1955
  break;
1948
1956
  case 2:
1949
- // line 681 "Parser.rl"
1957
+ // line 689 "Parser.rl"
1950
1958
  {
1951
1959
  p--;
1952
1960
  { p += 1; _goto_targ = 5; if (true) continue _goto;}
1953
1961
  }
1954
1962
  break;
1955
- // line 1956 "Parser.java"
1963
+ // line 1964 "Parser.java"
1956
1964
  }
1957
1965
  }
1958
1966
  }
@@ -1972,7 +1980,7 @@ case 5:
1972
1980
  break; }
1973
1981
  }
1974
1982
 
1975
- // line 713 "Parser.rl"
1983
+ // line 721 "Parser.rl"
1976
1984
 
1977
1985
  if (cs < JSON_object_first_final) {
1978
1986
  return null;
@@ -1998,7 +2006,7 @@ case 5:
1998
2006
  }
1999
2007
 
2000
2008
 
2001
- // line 2002 "Parser.java"
2009
+ // line 2010 "Parser.java"
2002
2010
  private static byte[] init__JSON_actions_0()
2003
2011
  {
2004
2012
  return new byte [] {
@@ -2102,7 +2110,7 @@ static final int JSON_error = 0;
2102
2110
  static final int JSON_en_main = 1;
2103
2111
 
2104
2112
 
2105
- // line 771 "Parser.rl"
2113
+ // line 779 "Parser.rl"
2106
2114
 
2107
2115
 
2108
2116
  public IRubyObject parse() {
@@ -2111,16 +2119,16 @@ static final int JSON_en_main = 1;
2111
2119
  IRubyObject result = null;
2112
2120
 
2113
2121
 
2114
- // line 2115 "Parser.java"
2122
+ // line 2123 "Parser.java"
2115
2123
  {
2116
2124
  cs = JSON_start;
2117
2125
  }
2118
2126
 
2119
- // line 779 "Parser.rl"
2127
+ // line 787 "Parser.rl"
2120
2128
  p = byteList.begin();
2121
2129
  pe = p + byteList.length();
2122
2130
 
2123
- // line 2124 "Parser.java"
2131
+ // line 2132 "Parser.java"
2124
2132
  {
2125
2133
  int _klen;
2126
2134
  int _trans = 0;
@@ -2201,7 +2209,7 @@ case 1:
2201
2209
  switch ( _JSON_actions[_acts++] )
2202
2210
  {
2203
2211
  case 0:
2204
- // line 743 "Parser.rl"
2212
+ // line 751 "Parser.rl"
2205
2213
  {
2206
2214
  currentNesting = 1;
2207
2215
  ParserResult res = parseObject(p, pe);
@@ -2215,7 +2223,7 @@ case 1:
2215
2223
  }
2216
2224
  break;
2217
2225
  case 1:
2218
- // line 755 "Parser.rl"
2226
+ // line 763 "Parser.rl"
2219
2227
  {
2220
2228
  currentNesting = 1;
2221
2229
  ParserResult res = parseArray(p, pe);
@@ -2228,7 +2236,7 @@ case 1:
2228
2236
  }
2229
2237
  }
2230
2238
  break;
2231
- // line 2232 "Parser.java"
2239
+ // line 2240 "Parser.java"
2232
2240
  }
2233
2241
  }
2234
2242
  }
@@ -2248,7 +2256,7 @@ case 5:
2248
2256
  break; }
2249
2257
  }
2250
2258
 
2251
- // line 782 "Parser.rl"
2259
+ // line 790 "Parser.rl"
2252
2260
 
2253
2261
  if (cs >= JSON_first_final && p == pe) {
2254
2262
  return result;
@@ -596,7 +596,11 @@ public class Parser extends RubyObject {
596
596
  fhold;
597
597
  fbreak;
598
598
  } else {
599
- result.append(res.result);
599
+ if (!parser.arrayClass.getName().equals("Array")) {
600
+ result.callMethod(context, "<<", res.result);
601
+ } else {
602
+ result.append(res.result);
603
+ }
600
604
  fexec res.p;
601
605
  }
602
606
  }
@@ -655,7 +659,11 @@ public class Parser extends RubyObject {
655
659
  fhold;
656
660
  fbreak;
657
661
  } else {
658
- result.op_aset(context, lastName, res.result);
662
+ if (!parser.objectClass.getName().equals("Hash")) {
663
+ result.callMethod(context, "[]=", new IRubyObject[] { lastName, res.result });
664
+ } else {
665
+ result.op_aset(context, lastName, res.result);
666
+ }
659
667
  fexec res.p;
660
668
  }
661
669
  }
@@ -0,0 +1,41 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{json}
5
+ s.version = "1.5.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = [%q{Florian Frank}]
9
+ s.date = %q{2011-06-14}
10
+ s.description = %q{This is a JSON implementation as a Ruby extension in C.}
11
+ s.email = %q{flori@ping.de}
12
+ s.executables = [%q{edit_json.rb}, %q{prettify_json.rb}]
13
+ s.extensions = [%q{ext/json/ext/parser/extconf.rb}, %q{ext/json/ext/generator/extconf.rb}]
14
+ s.extra_rdoc_files = [%q{README.rdoc}]
15
+ s.files = [%q{tests}, %q{tests/test_json_string_matching.rb}, %q{tests/test_json_fixtures.rb}, %q{tests/setup_variant.rb}, %q{tests/fixtures}, %q{tests/fixtures/fail6.json}, %q{tests/fixtures/fail9.json}, %q{tests/fixtures/fail10.json}, %q{tests/fixtures/fail24.json}, %q{tests/fixtures/fail28.json}, %q{tests/fixtures/fail13.json}, %q{tests/fixtures/fail4.json}, %q{tests/fixtures/pass3.json}, %q{tests/fixtures/fail11.json}, %q{tests/fixtures/fail14.json}, %q{tests/fixtures/fail3.json}, %q{tests/fixtures/fail12.json}, %q{tests/fixtures/pass16.json}, %q{tests/fixtures/pass15.json}, %q{tests/fixtures/fail20.json}, %q{tests/fixtures/fail8.json}, %q{tests/fixtures/pass2.json}, %q{tests/fixtures/fail5.json}, %q{tests/fixtures/fail1.json}, %q{tests/fixtures/fail25.json}, %q{tests/fixtures/pass17.json}, %q{tests/fixtures/fail7.json}, %q{tests/fixtures/pass26.json}, %q{tests/fixtures/fail21.json}, %q{tests/fixtures/pass1.json}, %q{tests/fixtures/fail23.json}, %q{tests/fixtures/fail18.json}, %q{tests/fixtures/fail2.json}, %q{tests/fixtures/fail22.json}, %q{tests/fixtures/fail27.json}, %q{tests/fixtures/fail19.json}, %q{tests/test_json_unicode.rb}, %q{tests/test_json_addition.rb}, %q{tests/test_json_generate.rb}, %q{tests/test_json_encoding.rb}, %q{tests/test_json.rb}, %q{COPYING}, %q{TODO}, %q{Rakefile}, %q{benchmarks}, %q{benchmarks/data-p4-3GHz-ruby18}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat}, %q{benchmarks/parser2_benchmark.rb}, %q{benchmarks/parser_benchmark.rb}, %q{benchmarks/generator2_benchmark.rb}, %q{benchmarks/generator_benchmark.rb}, %q{benchmarks/ohai.ruby}, %q{benchmarks/data}, %q{benchmarks/ohai.json}, %q{lib}, %q{lib/json}, %q{lib/json/json.xpm}, %q{lib/json/TrueClass.xpm}, %q{lib/json/version.rb}, %q{lib/json/Array.xpm}, %q{lib/json/add}, %q{lib/json/add/core.rb}, %q{lib/json/add/rails.rb}, %q{lib/json/common.rb}, %q{lib/json/pure}, %q{lib/json/pure/generator.rb}, %q{lib/json/pure/parser.rb}, %q{lib/json/ext.rb}, %q{lib/json/pure.rb}, %q{lib/json/Key.xpm}, %q{lib/json/FalseClass.xpm}, %q{lib/json/editor.rb}, %q{lib/json/Numeric.xpm}, %q{lib/json/ext}, %q{lib/json/ext/1.9}, %q{lib/json/ext/1.8}, %q{lib/json/NilClass.xpm}, %q{lib/json/String.xpm}, %q{lib/json/Hash.xpm}, %q{lib/json.rb}, %q{README.rdoc}, %q{json_pure.gemspec}, %q{GPL}, %q{CHANGES}, %q{bin}, %q{bin/prettify_json.rb}, %q{bin/edit_json.rb}, %q{COPYING-json-jruby}, %q{ext}, %q{ext/json}, %q{ext/json/ext}, %q{ext/json/ext/parser}, %q{ext/json/ext/parser/parser.h}, %q{ext/json/ext/parser/extconf.rb}, %q{ext/json/ext/parser/parser.rl}, %q{ext/json/ext/parser/parser.c}, %q{ext/json/ext/generator}, %q{ext/json/ext/generator/generator.c}, %q{ext/json/ext/generator/extconf.rb}, %q{ext/json/ext/generator/generator.h}, %q{VERSION}, %q{data}, %q{data/prototype.js}, %q{data/index.html}, %q{data/example.json}, %q{json.gemspec}, %q{java}, %q{java/src}, %q{java/src/json}, %q{java/src/json/ext}, %q{java/src/json/ext/Parser.java}, %q{java/src/json/ext/RuntimeInfo.java}, %q{java/src/json/ext/GeneratorState.java}, %q{java/src/json/ext/OptionsReader.java}, %q{java/src/json/ext/ParserService.java}, %q{java/src/json/ext/Parser.rl}, %q{java/src/json/ext/StringEncoder.java}, %q{java/src/json/ext/GeneratorService.java}, %q{java/src/json/ext/Utils.java}, %q{java/src/json/ext/StringDecoder.java}, %q{java/src/json/ext/Generator.java}, %q{java/src/json/ext/ByteListTranscoder.java}, %q{java/src/json/ext/GeneratorMethods.java}, %q{java/lib}, %q{java/lib/bytelist-1.0.6.jar}, %q{java/lib/jcodings.jar}, %q{diagrams}, %q{README-json-jruby.markdown}, %q{install.rb}, %q{json-java.gemspec}, %q{tools}, %q{tools/fuzz.rb}, %q{tools/server.rb}, %q{./tests/test_json_string_matching.rb}, %q{./tests/test_json_fixtures.rb}, %q{./tests/test_json_unicode.rb}, %q{./tests/test_json_addition.rb}, %q{./tests/test_json_generate.rb}, %q{./tests/test_json_encoding.rb}, %q{./tests/test_json.rb}]
16
+ s.homepage = %q{http://flori.github.com/json}
17
+ s.rdoc_options = [%q{--title}, %q{JSON implemention for Ruby}, %q{--main}, %q{README.rdoc}]
18
+ s.require_paths = [%q{ext/json/ext}, %q{ext}, %q{lib}]
19
+ s.rubyforge_project = %q{json}
20
+ s.rubygems_version = %q{1.8.5}
21
+ s.summary = %q{JSON Implementation for Ruby}
22
+ s.test_files = [%q{./tests/test_json_string_matching.rb}, %q{./tests/test_json_fixtures.rb}, %q{./tests/test_json_unicode.rb}, %q{./tests/test_json_addition.rb}, %q{./tests/test_json_generate.rb}, %q{./tests/test_json_encoding.rb}, %q{./tests/test_json.rb}]
23
+
24
+ if s.respond_to? :specification_version then
25
+ s.specification_version = 3
26
+
27
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
+ s.add_development_dependency(%q<permutation>, [">= 0"])
29
+ s.add_development_dependency(%q<bullshit>, [">= 0"])
30
+ s.add_development_dependency(%q<sdoc>, [">= 0"])
31
+ else
32
+ s.add_dependency(%q<permutation>, [">= 0"])
33
+ s.add_dependency(%q<bullshit>, [">= 0"])
34
+ s.add_dependency(%q<sdoc>, [">= 0"])
35
+ end
36
+ else
37
+ s.add_dependency(%q<permutation>, [">= 0"])
38
+ s.add_dependency(%q<bullshit>, [">= 0"])
39
+ s.add_dependency(%q<sdoc>, [">= 0"])
40
+ end
41
+ end
@@ -0,0 +1,40 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{json_pure}
5
+ s.version = "1.5.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = [%q{Florian Frank}]
9
+ s.date = %q{2011-06-14}
10
+ s.description = %q{This is a JSON implementation in pure Ruby.}
11
+ s.email = %q{flori@ping.de}
12
+ s.executables = [%q{edit_json.rb}, %q{prettify_json.rb}]
13
+ s.extra_rdoc_files = [%q{README.rdoc}]
14
+ s.files = [%q{tests}, %q{tests/test_json_string_matching.rb}, %q{tests/test_json_fixtures.rb}, %q{tests/setup_variant.rb}, %q{tests/fixtures}, %q{tests/fixtures/fail6.json}, %q{tests/fixtures/fail9.json}, %q{tests/fixtures/fail10.json}, %q{tests/fixtures/fail24.json}, %q{tests/fixtures/fail28.json}, %q{tests/fixtures/fail13.json}, %q{tests/fixtures/fail4.json}, %q{tests/fixtures/pass3.json}, %q{tests/fixtures/fail11.json}, %q{tests/fixtures/fail14.json}, %q{tests/fixtures/fail3.json}, %q{tests/fixtures/fail12.json}, %q{tests/fixtures/pass16.json}, %q{tests/fixtures/pass15.json}, %q{tests/fixtures/fail20.json}, %q{tests/fixtures/fail8.json}, %q{tests/fixtures/pass2.json}, %q{tests/fixtures/fail5.json}, %q{tests/fixtures/fail1.json}, %q{tests/fixtures/fail25.json}, %q{tests/fixtures/pass17.json}, %q{tests/fixtures/fail7.json}, %q{tests/fixtures/pass26.json}, %q{tests/fixtures/fail21.json}, %q{tests/fixtures/pass1.json}, %q{tests/fixtures/fail23.json}, %q{tests/fixtures/fail18.json}, %q{tests/fixtures/fail2.json}, %q{tests/fixtures/fail22.json}, %q{tests/fixtures/fail27.json}, %q{tests/fixtures/fail19.json}, %q{tests/test_json_unicode.rb}, %q{tests/test_json_addition.rb}, %q{tests/test_json_generate.rb}, %q{tests/test_json_encoding.rb}, %q{tests/test_json.rb}, %q{COPYING}, %q{TODO}, %q{Rakefile}, %q{benchmarks}, %q{benchmarks/data-p4-3GHz-ruby18}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat}, %q{benchmarks/parser2_benchmark.rb}, %q{benchmarks/parser_benchmark.rb}, %q{benchmarks/generator2_benchmark.rb}, %q{benchmarks/generator_benchmark.rb}, %q{benchmarks/ohai.ruby}, %q{benchmarks/data}, %q{benchmarks/ohai.json}, %q{lib}, %q{lib/json}, %q{lib/json/json.xpm}, %q{lib/json/TrueClass.xpm}, %q{lib/json/version.rb}, %q{lib/json/Array.xpm}, %q{lib/json/add}, %q{lib/json/add/core.rb}, %q{lib/json/add/rails.rb}, %q{lib/json/common.rb}, %q{lib/json/pure}, %q{lib/json/pure/generator.rb}, %q{lib/json/pure/parser.rb}, %q{lib/json/ext.rb}, %q{lib/json/pure.rb}, %q{lib/json/Key.xpm}, %q{lib/json/FalseClass.xpm}, %q{lib/json/editor.rb}, %q{lib/json/Numeric.xpm}, %q{lib/json/ext}, %q{lib/json/ext/1.9}, %q{lib/json/ext/1.8}, %q{lib/json/NilClass.xpm}, %q{lib/json/String.xpm}, %q{lib/json/Hash.xpm}, %q{lib/json.rb}, %q{README.rdoc}, %q{json_pure.gemspec}, %q{GPL}, %q{CHANGES}, %q{bin}, %q{bin/prettify_json.rb}, %q{bin/edit_json.rb}, %q{COPYING-json-jruby}, %q{ext}, %q{ext/json}, %q{ext/json/ext}, %q{ext/json/ext/parser}, %q{ext/json/ext/parser/parser.h}, %q{ext/json/ext/parser/extconf.rb}, %q{ext/json/ext/parser/parser.rl}, %q{ext/json/ext/parser/parser.c}, %q{ext/json/ext/generator}, %q{ext/json/ext/generator/generator.c}, %q{ext/json/ext/generator/extconf.rb}, %q{ext/json/ext/generator/generator.h}, %q{VERSION}, %q{data}, %q{data/prototype.js}, %q{data/index.html}, %q{data/example.json}, %q{json.gemspec}, %q{java}, %q{java/src}, %q{java/src/json}, %q{java/src/json/ext}, %q{java/src/json/ext/Parser.java}, %q{java/src/json/ext/RuntimeInfo.java}, %q{java/src/json/ext/GeneratorState.java}, %q{java/src/json/ext/OptionsReader.java}, %q{java/src/json/ext/ParserService.java}, %q{java/src/json/ext/Parser.rl}, %q{java/src/json/ext/StringEncoder.java}, %q{java/src/json/ext/GeneratorService.java}, %q{java/src/json/ext/Utils.java}, %q{java/src/json/ext/StringDecoder.java}, %q{java/src/json/ext/Generator.java}, %q{java/src/json/ext/ByteListTranscoder.java}, %q{java/src/json/ext/GeneratorMethods.java}, %q{java/lib}, %q{java/lib/bytelist-1.0.6.jar}, %q{java/lib/jcodings.jar}, %q{diagrams}, %q{README-json-jruby.markdown}, %q{install.rb}, %q{json-java.gemspec}, %q{tools}, %q{tools/fuzz.rb}, %q{tools/server.rb}, %q{./tests/test_json_string_matching.rb}, %q{./tests/test_json_fixtures.rb}, %q{./tests/test_json_unicode.rb}, %q{./tests/test_json_addition.rb}, %q{./tests/test_json_generate.rb}, %q{./tests/test_json_encoding.rb}, %q{./tests/test_json.rb}]
15
+ s.homepage = %q{http://flori.github.com/json}
16
+ s.rdoc_options = [%q{--title}, %q{JSON implemention for ruby}, %q{--main}, %q{README.rdoc}]
17
+ s.require_paths = [%q{lib}]
18
+ s.rubyforge_project = %q{json}
19
+ s.rubygems_version = %q{1.8.5}
20
+ s.summary = %q{JSON Implementation for Ruby}
21
+ s.test_files = [%q{./tests/test_json_string_matching.rb}, %q{./tests/test_json_fixtures.rb}, %q{./tests/test_json_unicode.rb}, %q{./tests/test_json_addition.rb}, %q{./tests/test_json_generate.rb}, %q{./tests/test_json_encoding.rb}, %q{./tests/test_json.rb}]
22
+
23
+ if s.respond_to? :specification_version then
24
+ s.specification_version = 3
25
+
26
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
+ s.add_development_dependency(%q<permutation>, [">= 0"])
28
+ s.add_development_dependency(%q<bullshit>, [">= 0"])
29
+ s.add_development_dependency(%q<sdoc>, [">= 0"])
30
+ else
31
+ s.add_dependency(%q<permutation>, [">= 0"])
32
+ s.add_dependency(%q<bullshit>, [">= 0"])
33
+ s.add_dependency(%q<sdoc>, [">= 0"])
34
+ end
35
+ else
36
+ s.add_dependency(%q<permutation>, [">= 0"])
37
+ s.add_dependency(%q<bullshit>, [">= 0"])
38
+ s.add_dependency(%q<sdoc>, [">= 0"])
39
+ end
40
+ end
@@ -1,3 +1,55 @@
1
+ ##
2
+ # = JavaScript Object Notation (JSON)
3
+ #
4
+ # JSON is a lightweight data-interchange format. It is easy for us
5
+ # humans to read and write. Plus, equally simple for machines to generate or parse.
6
+ # JSON is completely language agnostic, making it the ideal interchange format.
7
+ #
8
+ # Built on two universally available structures:
9
+ # 1. A collection of name/value pairs. Often referred to as an _object_, hash table, record, struct, keyed list, or associative array.
10
+ # 2. An orderd list of values. More commonly named as an _array_, vector, sequence, or list.
11
+ #
12
+ # To read more about JSON visit: http://json.org
13
+ #
14
+ # == Parsing JSON
15
+ #
16
+ # To parse a JSON string received by another application, or generated within
17
+ # your existing application:
18
+ #
19
+ # require 'json'
20
+ #
21
+ # my_hash = JSON.parse('{"hello": "goodbye"}')
22
+ # puts my_hash["hello"] => "goodbye"
23
+ #
24
+ # Notice the extra quotes <tt>''</tt> around the hash notation. Ruby expects
25
+ # the argument to be a string and can't convert objects like a hash or array.
26
+ #
27
+ # Ruby converts your string into a hash
28
+ #
29
+ # == Generating JSON
30
+ #
31
+ # Creating a JSON string for communication or serialization is
32
+ # just as simple.
33
+ #
34
+ # require 'json'
35
+ #
36
+ # my_hash = {:hello => "goodbye"}
37
+ # puts JSON.generate(my_hash) => "{\"hello\":\"goodbye\"}"
38
+ #
39
+ # Or an alternative way:
40
+ #
41
+ # require 'json'
42
+ # puts {:hello => "goodbye"}.to_json => "{\"hello\":\"goodbye\"}"
43
+ #
44
+ # <tt>JSON.generate</tt> only allows objects or arrays to be converted
45
+ # to JSON syntax. While <tt>to_json</tt> accepts many Ruby classes
46
+ # even though it only acts a method for serialization:
47
+ #
48
+ # require 'json'
49
+ #
50
+ # 1.to_json => "1"
51
+ #
52
+
1
53
  require 'json/common'
2
54
  module JSON
3
55
  require 'json/version'