json 1.0.0 → 2.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES.md +503 -0
  3. data/LICENSE +56 -0
  4. data/README.md +416 -0
  5. data/ext/json/ext/fbuffer/fbuffer.h +187 -0
  6. data/ext/json/ext/generator/depend +1 -0
  7. data/ext/json/ext/generator/extconf.rb +2 -7
  8. data/ext/json/ext/generator/generator.c +1312 -338
  9. data/ext/json/ext/generator/generator.h +177 -0
  10. data/ext/json/ext/parser/depend +1 -0
  11. data/ext/json/ext/parser/extconf.rb +28 -5
  12. data/ext/json/ext/parser/parser.c +1349 -689
  13. data/ext/json/ext/parser/parser.h +96 -0
  14. data/ext/json/ext/parser/parser.rl +644 -188
  15. data/ext/json/extconf.rb +3 -0
  16. data/json.gemspec +68 -0
  17. data/lib/json/add/bigdecimal.rb +58 -0
  18. data/lib/json/add/complex.rb +51 -0
  19. data/lib/json/add/core.rb +12 -0
  20. data/lib/json/add/date.rb +54 -0
  21. data/lib/json/add/date_time.rb +67 -0
  22. data/lib/json/add/exception.rb +49 -0
  23. data/lib/json/add/ostruct.rb +54 -0
  24. data/lib/json/add/range.rb +54 -0
  25. data/lib/json/add/rational.rb +49 -0
  26. data/lib/json/add/regexp.rb +48 -0
  27. data/lib/json/add/set.rb +48 -0
  28. data/lib/json/add/struct.rb +52 -0
  29. data/lib/json/add/symbol.rb +48 -0
  30. data/lib/json/add/time.rb +59 -0
  31. data/lib/json/common.rb +588 -74
  32. data/lib/json/ext.rb +3 -1
  33. data/lib/json/generic_object.rb +75 -0
  34. data/lib/json/pure/generator.rb +311 -119
  35. data/lib/json/pure/parser.rb +182 -55
  36. data/lib/json/pure.rb +5 -65
  37. data/lib/json/version.rb +2 -1
  38. data/lib/json.rb +583 -196
  39. metadata +78 -137
  40. data/CHANGES +0 -25
  41. data/GPL +0 -340
  42. data/README +0 -77
  43. data/Rakefile +0 -250
  44. data/TODO +0 -1
  45. data/VERSION +0 -1
  46. data/benchmarks/benchmark.txt +0 -133
  47. data/benchmarks/benchmark_generator.rb +0 -44
  48. data/benchmarks/benchmark_parser.rb +0 -22
  49. data/benchmarks/benchmark_rails.rb +0 -26
  50. data/bin/edit_json.rb +0 -11
  51. data/data/example.json +0 -1
  52. data/data/index.html +0 -37
  53. data/data/prototype.js +0 -2515
  54. data/ext/json/ext/generator/Makefile +0 -149
  55. data/ext/json/ext/generator/unicode.c +0 -184
  56. data/ext/json/ext/generator/unicode.h +0 -40
  57. data/ext/json/ext/parser/Makefile +0 -149
  58. data/ext/json/ext/parser/unicode.c +0 -156
  59. data/ext/json/ext/parser/unicode.h +0 -44
  60. data/install.rb +0 -26
  61. data/lib/json/Array.xpm +0 -21
  62. data/lib/json/FalseClass.xpm +0 -21
  63. data/lib/json/Hash.xpm +0 -21
  64. data/lib/json/Key.xpm +0 -73
  65. data/lib/json/NilClass.xpm +0 -21
  66. data/lib/json/Numeric.xpm +0 -28
  67. data/lib/json/String.xpm +0 -96
  68. data/lib/json/TrueClass.xpm +0 -21
  69. data/lib/json/editor.rb +0 -1207
  70. data/lib/json/json.xpm +0 -1499
  71. data/tests/fixtures/fail1.json +0 -1
  72. data/tests/fixtures/fail10.json +0 -1
  73. data/tests/fixtures/fail11.json +0 -1
  74. data/tests/fixtures/fail12.json +0 -1
  75. data/tests/fixtures/fail13.json +0 -1
  76. data/tests/fixtures/fail14.json +0 -1
  77. data/tests/fixtures/fail15.json +0 -1
  78. data/tests/fixtures/fail16.json +0 -1
  79. data/tests/fixtures/fail17.json +0 -1
  80. data/tests/fixtures/fail19.json +0 -1
  81. data/tests/fixtures/fail2.json +0 -1
  82. data/tests/fixtures/fail20.json +0 -1
  83. data/tests/fixtures/fail21.json +0 -1
  84. data/tests/fixtures/fail22.json +0 -1
  85. data/tests/fixtures/fail23.json +0 -1
  86. data/tests/fixtures/fail24.json +0 -1
  87. data/tests/fixtures/fail25.json +0 -1
  88. data/tests/fixtures/fail26.json +0 -1
  89. data/tests/fixtures/fail27.json +0 -2
  90. data/tests/fixtures/fail28.json +0 -2
  91. data/tests/fixtures/fail3.json +0 -1
  92. data/tests/fixtures/fail4.json +0 -1
  93. data/tests/fixtures/fail5.json +0 -1
  94. data/tests/fixtures/fail6.json +0 -1
  95. data/tests/fixtures/fail7.json +0 -1
  96. data/tests/fixtures/fail8.json +0 -1
  97. data/tests/fixtures/fail9.json +0 -1
  98. data/tests/fixtures/pass1.json +0 -56
  99. data/tests/fixtures/pass18.json +0 -1
  100. data/tests/fixtures/pass2.json +0 -1
  101. data/tests/fixtures/pass3.json +0 -6
  102. data/tests/runner.rb +0 -24
  103. data/tests/test_json.rb +0 -235
  104. data/tests/test_json_addition.rb +0 -94
  105. data/tests/test_json_fixtures.rb +0 -30
  106. data/tests/test_json_generate.rb +0 -81
  107. data/tests/test_json_unicode.rb +0 -55
  108. data/tools/fuzz.rb +0 -133
  109. data/tools/server.rb +0 -62
@@ -1,44 +0,0 @@
1
-
2
- #ifndef _PARSER_UNICODE_H_
3
- #define _PARSER_UNICODE_H_
4
-
5
- #include "ruby.h"
6
-
7
- typedef unsigned long UTF32; /* at least 32 bits */
8
- typedef unsigned short UTF16; /* at least 16 bits */
9
- typedef unsigned char UTF8; /* typically 8 bits */
10
-
11
- #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
12
- #define UNI_MAX_BMP (UTF32)0x0000FFFF
13
- #define UNI_MAX_UTF16 (UTF32)0x0010FFFF
14
- #define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
15
- #define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
16
-
17
- #define UNI_SUR_HIGH_START (UTF32)0xD800
18
- #define UNI_SUR_HIGH_END (UTF32)0xDBFF
19
- #define UNI_SUR_LOW_START (UTF32)0xDC00
20
- #define UNI_SUR_LOW_END (UTF32)0xDFFF
21
-
22
- static const int halfShift = 10; /* used for shifting by 10 bits */
23
-
24
- static const UTF32 halfBase = 0x0010000UL;
25
- static const UTF32 halfMask = 0x3FFUL;
26
-
27
- typedef enum {
28
- conversionOK = 0, /* conversion successful */
29
- sourceExhausted, /* partial character in source, but hit end */
30
- targetExhausted, /* insuff. room in target for conversion */
31
- sourceIllegal /* source sequence is illegal/malformed */
32
- } ConversionResult;
33
-
34
- typedef enum {
35
- strictConversion = 0,
36
- lenientConversion
37
- } ConversionFlags;
38
-
39
- char *JSON_convert_UTF16_to_UTF8 (
40
- VALUE buffer,
41
- char *source,
42
- char *sourceEnd,
43
- ConversionFlags flags);
44
- #endif
data/install.rb DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rbconfig'
4
- require 'fileutils'
5
- include FileUtils::Verbose
6
-
7
- include Config
8
-
9
- bindir = CONFIG["bindir"]
10
- cd 'bin' do
11
- filename = 'edit_json.rb'
12
- #install(filename, bindir)
13
- end
14
- sitelibdir = CONFIG["sitelibdir"]
15
- cd 'lib' do
16
- install('json.rb', sitelibdir)
17
- mkdir_p File.join(sitelibdir, 'json')
18
- for file in Dir['json/**/*.{rb,xpm}']
19
- d = File.join(sitelibdir, file)
20
- mkdir_p File.dirname(d)
21
- install(file, d)
22
- end
23
- install(File.join('json', 'editor.rb'), File.join(sitelibdir,'json'))
24
- install(File.join('json', 'json.xpm'), File.join(sitelibdir,'json'))
25
- end
26
- warn " *** Installed PURE ruby library."
data/lib/json/Array.xpm DELETED
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * Array_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #000000",
6
- " ",
7
- " ",
8
- " ",
9
- " .......... ",
10
- " . . ",
11
- " . . ",
12
- " . . ",
13
- " . . ",
14
- " . . ",
15
- " . . ",
16
- " . . ",
17
- " . . ",
18
- " .......... ",
19
- " ",
20
- " ",
21
- " "};
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * False_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #FF0000",
6
- " ",
7
- " ",
8
- " ",
9
- " ...... ",
10
- " . ",
11
- " . ",
12
- " . ",
13
- " ...... ",
14
- " . ",
15
- " . ",
16
- " . ",
17
- " . ",
18
- " . ",
19
- " ",
20
- " ",
21
- " "};
data/lib/json/Hash.xpm DELETED
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * Hash_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #000000",
6
- " ",
7
- " ",
8
- " ",
9
- " . . ",
10
- " . . ",
11
- " . . ",
12
- " ......... ",
13
- " . . ",
14
- " . . ",
15
- " ......... ",
16
- " . . ",
17
- " . . ",
18
- " . . ",
19
- " ",
20
- " ",
21
- " "};
data/lib/json/Key.xpm DELETED
@@ -1,73 +0,0 @@
1
- /* XPM */
2
- static char * Key_xpm[] = {
3
- "16 16 54 1",
4
- " c None",
5
- ". c #110007",
6
- "+ c #0E0900",
7
- "@ c #000013",
8
- "# c #070600",
9
- "$ c #F6F006",
10
- "% c #ECE711",
11
- "& c #E5EE00",
12
- "* c #16021E",
13
- "= c #120900",
14
- "- c #EDF12B",
15
- "; c #000033",
16
- "> c #0F0000",
17
- ", c #FFFE03",
18
- "' c #E6E500",
19
- ") c #16021B",
20
- "! c #F7F502",
21
- "~ c #000E00",
22
- "{ c #130000",
23
- "] c #FFF000",
24
- "^ c #FFE711",
25
- "/ c #140005",
26
- "( c #190025",
27
- "_ c #E9DD27",
28
- ": c #E7DC04",
29
- "< c #FFEC09",
30
- "[ c #FFE707",
31
- "} c #FFDE10",
32
- "| c #150021",
33
- "1 c #160700",
34
- "2 c #FAF60E",
35
- "3 c #EFE301",
36
- "4 c #FEF300",
37
- "5 c #E7E000",
38
- "6 c #FFFF08",
39
- "7 c #0E0206",
40
- "8 c #040000",
41
- "9 c #03052E",
42
- "0 c #041212",
43
- "a c #070300",
44
- "b c #F2E713",
45
- "c c #F9DE13",
46
- "d c #36091E",
47
- "e c #00001C",
48
- "f c #1F0010",
49
- "g c #FFF500",
50
- "h c #DEDE00",
51
- "i c #050A00",
52
- "j c #FAF14A",
53
- "k c #F5F200",
54
- "l c #040404",
55
- "m c #1A0D00",
56
- "n c #EDE43D",
57
- "o c #ECE007",
58
- " ",
59
- " ",
60
- " .+@ ",
61
- " #$%&* ",
62
- " =-;>,') ",
63
- " >!~{]^/ ",
64
- " (_:<[}| ",
65
- " 1234567 ",
66
- " 890abcd ",
67
- " efghi ",
68
- " >jkl ",
69
- " mnol ",
70
- " >kl ",
71
- " ll ",
72
- " ",
73
- " "};
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * False_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #000000",
6
- " ",
7
- " ",
8
- " ",
9
- " ... ",
10
- " . . ",
11
- " . . ",
12
- " . . ",
13
- " . . ",
14
- " . . ",
15
- " . . ",
16
- " . . ",
17
- " . . ",
18
- " ... ",
19
- " ",
20
- " ",
21
- " "};
data/lib/json/Numeric.xpm DELETED
@@ -1,28 +0,0 @@
1
- /* XPM */
2
- static char * Numeric_xpm[] = {
3
- "16 16 9 1",
4
- " c None",
5
- ". c #FF0000",
6
- "+ c #0000FF",
7
- "@ c #0023DB",
8
- "# c #00EA14",
9
- "$ c #00FF00",
10
- "% c #004FAF",
11
- "& c #0028D6",
12
- "* c #00F20C",
13
- " ",
14
- " ",
15
- " ",
16
- " ... +++@#$$$$ ",
17
- " .+ %& $$ ",
18
- " . + $ ",
19
- " . + $$ ",
20
- " . ++$$$$ ",
21
- " . + $$ ",
22
- " . + $ ",
23
- " . + $ ",
24
- " . + $ $$ ",
25
- " .....++++*$$ ",
26
- " ",
27
- " ",
28
- " "};
data/lib/json/String.xpm DELETED
@@ -1,96 +0,0 @@
1
- /* XPM */
2
- static char * String_xpm[] = {
3
- "16 16 77 1",
4
- " c None",
5
- ". c #000000",
6
- "+ c #040404",
7
- "@ c #080806",
8
- "# c #090606",
9
- "$ c #EEEAE1",
10
- "% c #E7E3DA",
11
- "& c #E0DBD1",
12
- "* c #D4B46F",
13
- "= c #0C0906",
14
- "- c #E3C072",
15
- "; c #E4C072",
16
- "> c #060505",
17
- ", c #0B0A08",
18
- "' c #D5B264",
19
- ") c #D3AF5A",
20
- "! c #080602",
21
- "~ c #E1B863",
22
- "{ c #DDB151",
23
- "] c #DBAE4A",
24
- "^ c #DDB152",
25
- "/ c #DDB252",
26
- "( c #070705",
27
- "_ c #0C0A07",
28
- ": c #D3A33B",
29
- "< c #020201",
30
- "[ c #DAAA41",
31
- "} c #040302",
32
- "| c #E4D9BF",
33
- "1 c #0B0907",
34
- "2 c #030201",
35
- "3 c #020200",
36
- "4 c #C99115",
37
- "5 c #080704",
38
- "6 c #DBC8A2",
39
- "7 c #E7D7B4",
40
- "8 c #E0CD9E",
41
- "9 c #080601",
42
- "0 c #040400",
43
- "a c #010100",
44
- "b c #0B0B08",
45
- "c c #DCBF83",
46
- "d c #DCBC75",
47
- "e c #DEB559",
48
- "f c #040301",
49
- "g c #BC8815",
50
- "h c #120E07",
51
- "i c #060402",
52
- "j c #0A0804",
53
- "k c #D4A747",
54
- "l c #D6A12F",
55
- "m c #0E0C05",
56
- "n c #C8C1B0",
57
- "o c #1D1B15",
58
- "p c #D7AD51",
59
- "q c #070502",
60
- "r c #080804",
61
- "s c #BC953B",
62
- "t c #C4BDAD",
63
- "u c #0B0807",
64
- "v c #DBAC47",
65
- "w c #1B150A",
66
- "x c #B78A2C",
67
- "y c #D8A83C",
68
- "z c #D4A338",
69
- "A c #0F0B03",
70
- "B c #181105",
71
- "C c #C59325",
72
- "D c #C18E1F",
73
- "E c #060600",
74
- "F c #CC992D",
75
- "G c #B98B25",
76
- "H c #B3831F",
77
- "I c #C08C1C",
78
- "J c #060500",
79
- "K c #0E0C03",
80
- "L c #0D0A00",
81
- " ",
82
- " .+@# ",
83
- " .$%&*= ",
84
- " .-;>,')! ",
85
- " .~. .{]. ",
86
- " .^/. (_:< ",
87
- " .[.}|$12 ",
88
- " 345678}90 ",
89
- " a2bcdefgh ",
90
- " ijkl.mno ",
91
- " <pq. rstu ",
92
- " .]v. wx= ",
93
- " .yzABCDE ",
94
- " .FGHIJ ",
95
- " 0KL0 ",
96
- " "};
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * TrueClass_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #0BF311",
6
- " ",
7
- " ",
8
- " ",
9
- " ......... ",
10
- " . ",
11
- " . ",
12
- " . ",
13
- " . ",
14
- " . ",
15
- " . ",
16
- " . ",
17
- " . ",
18
- " . ",
19
- " ",
20
- " ",
21
- " "};