json5 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.ruby-version +1 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +60 -0
  7. data/Rakefile +1 -0
  8. data/json5.gemspec +25 -0
  9. data/lib/json5.rb +13 -0
  10. data/lib/json5/parser.rb +461 -0
  11. data/lib/json5/stringifier.rb +242 -0
  12. data/lib/json5/version.rb +3 -0
  13. data/spec/json5/parse_spec.rb +71 -0
  14. data/spec/parse-cases/arrays/empty-array.json +1 -0
  15. data/spec/parse-cases/arrays/leading-comma-array.js +3 -0
  16. data/spec/parse-cases/arrays/lone-trailing-comma-array.js +3 -0
  17. data/spec/parse-cases/arrays/no-comma-array.txt +4 -0
  18. data/spec/parse-cases/arrays/regular-array.json +5 -0
  19. data/spec/parse-cases/arrays/trailing-comma-array.json5 +3 -0
  20. data/spec/parse-cases/comments/block-comment-following-array-element.json5 +6 -0
  21. data/spec/parse-cases/comments/block-comment-following-top-level-value.json5 +5 -0
  22. data/spec/parse-cases/comments/block-comment-in-string.json +1 -0
  23. data/spec/parse-cases/comments/block-comment-preceding-top-level-value.json5 +5 -0
  24. data/spec/parse-cases/comments/block-comment-with-asterisks.json5 +7 -0
  25. data/spec/parse-cases/comments/inline-comment-following-array-element.json5 +3 -0
  26. data/spec/parse-cases/comments/inline-comment-following-top-level-value.json5 +1 -0
  27. data/spec/parse-cases/comments/inline-comment-in-string.json +1 -0
  28. data/spec/parse-cases/comments/inline-comment-preceding-top-level-value.json5 +2 -0
  29. data/spec/parse-cases/comments/top-level-block-comment.txt +4 -0
  30. data/spec/parse-cases/comments/top-level-inline-comment.txt +1 -0
  31. data/spec/parse-cases/comments/unterminated-block-comment.txt +5 -0
  32. data/spec/parse-cases/misc/empty.txt +0 -0
  33. data/spec/parse-cases/misc/npm-package.json +106 -0
  34. data/spec/parse-cases/misc/npm-package.json5 +106 -0
  35. data/spec/parse-cases/misc/readme-example.json5 +25 -0
  36. data/spec/parse-cases/numbers/binary-coffeescript.txt +1 -0
  37. data/spec/parse-cases/numbers/float-leading-decimal-point.json5 +1 -0
  38. data/spec/parse-cases/numbers/float-leading-zero.json +1 -0
  39. data/spec/parse-cases/numbers/float-trailing-decimal-point-with-integer-exponent.json5.todo +1 -0
  40. data/spec/parse-cases/numbers/float-trailing-decimal-point.json5 +1 -0
  41. data/spec/parse-cases/numbers/float-with-integer-exponent.json +1 -0
  42. data/spec/parse-cases/numbers/float.json +1 -0
  43. data/spec/parse-cases/numbers/hexadecimal-empty.txt +1 -0
  44. data/spec/parse-cases/numbers/hexadecimal-lowercase-letter.json5 +1 -0
  45. data/spec/parse-cases/numbers/hexadecimal-uppercase-x.json5 +1 -0
  46. data/spec/parse-cases/numbers/hexadecimal-with-integer-exponent.json5 +1 -0
  47. data/spec/parse-cases/numbers/hexadecimal.json5 +1 -0
  48. data/spec/parse-cases/numbers/infinity.json5 +1 -0
  49. data/spec/parse-cases/numbers/integer-with-float-exponent.txt +1 -0
  50. data/spec/parse-cases/numbers/integer-with-hexadecimal-exponent.txt +1 -0
  51. data/spec/parse-cases/numbers/integer-with-integer-exponent.json +1 -0
  52. data/spec/parse-cases/numbers/integer-with-negative-float-exponent.txt +1 -0
  53. data/spec/parse-cases/numbers/integer-with-negative-hexadecimal-exponent.txt +1 -0
  54. data/spec/parse-cases/numbers/integer-with-negative-integer-exponent.json +1 -0
  55. data/spec/parse-cases/numbers/integer-with-negative-zero-integer-exponent.json +1 -0
  56. data/spec/parse-cases/numbers/integer-with-positive-float-exponent.txt +1 -0
  57. data/spec/parse-cases/numbers/integer-with-positive-hexadecimal-exponent.txt +1 -0
  58. data/spec/parse-cases/numbers/integer-with-positive-integer-exponent.json +1 -0
  59. data/spec/parse-cases/numbers/integer-with-positive-zero-integer-exponent.json +1 -0
  60. data/spec/parse-cases/numbers/integer-with-zero-integer-exponent.json +1 -0
  61. data/spec/parse-cases/numbers/integer.json +1 -0
  62. data/spec/parse-cases/numbers/lone-decimal-point.txt +1 -0
  63. data/spec/parse-cases/numbers/nan.json5 +1 -0
  64. data/spec/parse-cases/numbers/negative-binary-coffeescript.txt +1 -0
  65. data/spec/parse-cases/numbers/negative-float-leading-decimal-point.json5 +1 -0
  66. data/spec/parse-cases/numbers/negative-float-leading-zero.json +1 -0
  67. data/spec/parse-cases/numbers/negative-float-trailing-decimal-point.json5 +1 -0
  68. data/spec/parse-cases/numbers/negative-float.json +1 -0
  69. data/spec/parse-cases/numbers/negative-hexadecimal.js +1 -0
  70. data/spec/parse-cases/numbers/negative-infinity.json5 +1 -0
  71. data/spec/parse-cases/numbers/negative-integer.json +1 -0
  72. data/spec/parse-cases/numbers/negative-noctal.js +1 -0
  73. data/spec/parse-cases/numbers/negative-octal-coffeescript.txt +1 -0
  74. data/spec/parse-cases/numbers/negative-octal.txt +1 -0
  75. data/spec/parse-cases/numbers/negative-zero-binary-coffeescript.txt +1 -0
  76. data/spec/parse-cases/numbers/negative-zero-float-leading-decimal-point.json5 +1 -0
  77. data/spec/parse-cases/numbers/negative-zero-float-trailing-decimal-point.json5 +1 -0
  78. data/spec/parse-cases/numbers/negative-zero-float.json +1 -0
  79. data/spec/parse-cases/numbers/negative-zero-hexadecimal.js +1 -0
  80. data/spec/parse-cases/numbers/negative-zero-integer.json +1 -0
  81. data/spec/parse-cases/numbers/negative-zero-octal-coffeescript.txt +1 -0
  82. data/spec/parse-cases/numbers/negative-zero-octal.txt +1 -0
  83. data/spec/parse-cases/numbers/noctal-with-leading-octal-digit.js +1 -0
  84. data/spec/parse-cases/numbers/noctal.js +1 -0
  85. data/spec/parse-cases/numbers/octal-coffeescript.txt +1 -0
  86. data/spec/parse-cases/numbers/octal.txt +1 -0
  87. data/spec/parse-cases/numbers/positive-binary-coffeescript.txt +1 -0
  88. data/spec/parse-cases/numbers/positive-float-leading-decimal-point.json5 +1 -0
  89. data/spec/parse-cases/numbers/positive-float-leading-zero.json5 +1 -0
  90. data/spec/parse-cases/numbers/positive-float-trailing-decimal-point.json5 +1 -0
  91. data/spec/parse-cases/numbers/positive-float.json5 +1 -0
  92. data/spec/parse-cases/numbers/positive-hexadecimal.js +1 -0
  93. data/spec/parse-cases/numbers/positive-infinity.json5 +1 -0
  94. data/spec/parse-cases/numbers/positive-integer.json5 +1 -0
  95. data/spec/parse-cases/numbers/positive-noctal.js +1 -0
  96. data/spec/parse-cases/numbers/positive-octal-coffeescript.txt +1 -0
  97. data/spec/parse-cases/numbers/positive-octal.txt +1 -0
  98. data/spec/parse-cases/numbers/positive-zero-binary-coffeescript.txt +1 -0
  99. data/spec/parse-cases/numbers/positive-zero-float-leading-decimal-point.json5 +1 -0
  100. data/spec/parse-cases/numbers/positive-zero-float-trailing-decimal-point.json5 +1 -0
  101. data/spec/parse-cases/numbers/positive-zero-float.json5 +1 -0
  102. data/spec/parse-cases/numbers/positive-zero-hexadecimal.js +1 -0
  103. data/spec/parse-cases/numbers/positive-zero-integer.json5 +1 -0
  104. data/spec/parse-cases/numbers/positive-zero-octal-coffeescript.txt +1 -0
  105. data/spec/parse-cases/numbers/positive-zero-octal.txt +1 -0
  106. data/spec/parse-cases/numbers/zero-binary-coffeescript.txt +1 -0
  107. data/spec/parse-cases/numbers/zero-float-leading-decimal-point.json5 +1 -0
  108. data/spec/parse-cases/numbers/zero-float-trailing-decimal-point.json5 +1 -0
  109. data/spec/parse-cases/numbers/zero-float.json +1 -0
  110. data/spec/parse-cases/numbers/zero-hexadecimal.json5 +1 -0
  111. data/spec/parse-cases/numbers/zero-integer-with-integer-exponent.json +1 -0
  112. data/spec/parse-cases/numbers/zero-integer.json +1 -0
  113. data/spec/parse-cases/numbers/zero-octal-coffeescript.txt +1 -0
  114. data/spec/parse-cases/numbers/zero-octal.txt +1 -0
  115. data/spec/parse-cases/objects/empty-object.json +1 -0
  116. data/spec/parse-cases/objects/illegal-unquoted-key-number.txt +3 -0
  117. data/spec/parse-cases/objects/illegal-unquoted-key-symbol.txt +3 -0
  118. data/spec/parse-cases/objects/leading-comma-object.txt +3 -0
  119. data/spec/parse-cases/objects/lone-trailing-comma-object.txt +3 -0
  120. data/spec/parse-cases/objects/no-comma-object.txt +4 -0
  121. data/spec/parse-cases/objects/reserved-unquoted-key.json5 +3 -0
  122. data/spec/parse-cases/objects/single-quoted-key.json5 +3 -0
  123. data/spec/parse-cases/objects/trailing-comma-object.json5 +3 -0
  124. data/spec/parse-cases/objects/unquoted-keys.json5 +8 -0
  125. data/spec/parse-cases/strings/escaped-single-quoted-string.json5 +1 -0
  126. data/spec/parse-cases/strings/multi-line-string.json5 +2 -0
  127. data/spec/parse-cases/strings/single-quoted-string.json5 +1 -0
  128. data/spec/parse-cases/strings/unescaped-multi-line-string.txt +2 -0
  129. data/spec/parse-cases/todo/unicode-escaped-unquoted-key.json5.todo +3 -0
  130. data/spec/parse-cases/todo/unicode-unquoted-key.json5.todo +3 -0
  131. data/spec/spec_helper.rb +15 -0
  132. metadata +363 -0
@@ -0,0 +1,106 @@
1
+ {
2
+ name: 'npm',
3
+ publishConfig: {
4
+ 'proprietary-attribs': false,
5
+ },
6
+ description: 'A package manager for node',
7
+ keywords: [
8
+ 'package manager',
9
+ 'modules',
10
+ 'install',
11
+ 'package.json',
12
+ ],
13
+ version: '1.1.22',
14
+ preferGlobal: true,
15
+ config: {
16
+ publishtest: false,
17
+ },
18
+ homepage: 'http://npmjs.org/',
19
+ author: 'Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)',
20
+ repository: {
21
+ type: 'git',
22
+ url: 'https://github.com/isaacs/npm',
23
+ },
24
+ bugs: {
25
+ email: 'npm-@googlegroups.com',
26
+ url: 'http://github.com/isaacs/npm/issues',
27
+ },
28
+ directories: {
29
+ doc: './doc',
30
+ man: './man',
31
+ lib: './lib',
32
+ bin: './bin',
33
+ },
34
+ main: './lib/npm.js',
35
+ bin: './bin/npm-cli.js',
36
+ dependencies: {
37
+ semver: '~1.0.14',
38
+ ini: '1',
39
+ slide: '1',
40
+ abbrev: '1',
41
+ 'graceful-fs': '~1.1.1',
42
+ minimatch: '~0.2',
43
+ nopt: '1',
44
+ 'node-uuid': '~1.3',
45
+ 'proto-list': '1',
46
+ rimraf: '2',
47
+ request: '~2.9',
48
+ which: '1',
49
+ tar: '~0.1.12',
50
+ fstream: '~0.1.17',
51
+ 'block-stream': '*',
52
+ inherits: '1',
53
+ mkdirp: '0.3',
54
+ read: '0',
55
+ 'lru-cache': '1',
56
+ 'node-gyp': '~0.4.1',
57
+ 'fstream-npm': '0 >=0.0.5',
58
+ 'uid-number': '0',
59
+ archy: '0',
60
+ chownr: '0',
61
+ },
62
+ bundleDependencies: [
63
+ 'slide',
64
+ 'ini',
65
+ 'semver',
66
+ 'abbrev',
67
+ 'graceful-fs',
68
+ 'minimatch',
69
+ 'nopt',
70
+ 'node-uuid',
71
+ 'rimraf',
72
+ 'request',
73
+ 'proto-list',
74
+ 'which',
75
+ 'tar',
76
+ 'fstream',
77
+ 'block-stream',
78
+ 'inherits',
79
+ 'mkdirp',
80
+ 'read',
81
+ 'lru-cache',
82
+ 'node-gyp',
83
+ 'fstream-npm',
84
+ 'uid-number',
85
+ 'archy',
86
+ 'chownr',
87
+ ],
88
+ devDependencies: {
89
+ ronn: 'https://github.com/isaacs/ronnjs/tarball/master',
90
+ },
91
+ engines: {
92
+ node: '0.6 || 0.7 || 0.8',
93
+ npm: '1',
94
+ },
95
+ scripts: {
96
+ test: 'node ./test/run.js',
97
+ prepublish: 'npm prune; rm -rf node_modules/*/{test,example,bench}*; make -j4 doc',
98
+ dumpconf: 'env | grep npm | sort | uniq',
99
+ },
100
+ licenses: [
101
+ {
102
+ type: 'MIT +no-false-attribs',
103
+ url: 'http://github.com/isaacs/npm/raw/master/LICENSE',
104
+ },
105
+ ],
106
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ foo: 'bar',
3
+ while: true,
4
+
5
+ this: 'is a \
6
+ multi-line string',
7
+
8
+ // this is an inline comment
9
+ here: 'is another', // inline comment
10
+
11
+ /* this is a block comment
12
+ that continues on another line */
13
+
14
+ hex: 0xDEADbeef,
15
+ half: .5,
16
+ delta: +10,
17
+ to: Infinity, // and beyond!
18
+
19
+ finally: 'a trailing comma',
20
+ oh: [
21
+ "we shouldn't forget",
22
+ 'arrays can have',
23
+ 'trailing commas too',
24
+ ],
25
+ }
@@ -0,0 +1 @@
1
+ Infinity
@@ -0,0 +1,3 @@
1
+ {
2
+ 10twenty: "ten twenty"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ multi-word: "multi-word"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ ,"foo": "bar"
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "foo": "bar"
3
+ "hello": "world"
4
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ 'hello': "world"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "foo": "bar",
3
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ hello: "world",
3
+ _: "underscore",
4
+ $: "dollar sign",
5
+ one1: "numerals",
6
+ _$_: "multiple symbols",
7
+ $_$hello123world_$_: "mixed"
8
+ }
@@ -0,0 +1,2 @@
1
+ 'hello\
2
+ world'
@@ -0,0 +1,3 @@
1
+ {
2
+ sig\u03A3ma: "the sum of all things"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ ümlåût: "that's not really an ümlaüt, but this is"
3
+ }