json-next 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/json/next/parser/jsonx.rb +1 -1
- data/lib/json/next/pattern.rb +19 -0
- data/lib/json/next/version.rb +1 -1
- data/test/data/jsonx2.txt +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cab3b125181669cf07bc490253eea3bf4e43ce0a
|
4
|
+
data.tar.gz: 6759ea62cb24134d486826228352c9b2bb103df3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d8a33c50cf262518bbe6291f6031c135fafc72915119714b9105c4cbe8d3828ea47adcbe3f3eab7cdde98e1cdd6f4d4feb29e0501b4a32c528111c433a7e01d
|
7
|
+
data.tar.gz: 35acfddb995924c35e49d36db14ba12947c9270e79d8820e7dcb5ccbe2a4eb1d5af46767931b150a78a714edfb72edc5f0f17ede74a6f3e1751da0245912127b
|
data/README.md
CHANGED
@@ -169,6 +169,7 @@ Includes all JSON extensions from HanSON:
|
|
169
169
|
- you can use JavaScript comments, both single line (`//`) and multi-line comments (`/* */`), in all places where JSON allows whitespace.
|
170
170
|
- Commas after the last list element or object property will be ignored.
|
171
171
|
|
172
|
+
|
172
173
|
Plus all JSON extensions from SON:
|
173
174
|
|
174
175
|
- comments starts with `#` sign and ends with newline (`\n`)
|
@@ -176,6 +177,12 @@ Plus all JSON extensions from SON:
|
|
176
177
|
- comma after an array item is optional
|
177
178
|
|
178
179
|
|
180
|
+
Plus some more extra JSON extensions:
|
181
|
+
|
182
|
+
- unquoted strings following the JavaScript identifier rules can use the dash (`-`) too e.g. allows common keys such as `core-js`, `babel-preset-es2015`, `eslint-config-jquery` and others
|
183
|
+
|
184
|
+
|
185
|
+
|
179
186
|
Example:
|
180
187
|
|
181
188
|
```
|
@@ -19,7 +19,7 @@ module JSONX
|
|
19
19
|
SHELL_COMMENT = JSON::Next::SHELL_COMMENT
|
20
20
|
|
21
21
|
KEYWORDS = JSON::Next::KEYWORDS
|
22
|
-
IDENTIFIER = JSON::Next::
|
22
|
+
IDENTIFIER = JSON::Next::IDENTIFIER_EXTENDED
|
23
23
|
TRAILING_COMMA = JSON::Next::TRAILING_COMMA
|
24
24
|
|
25
25
|
UNESCAPE_MAP = JSON::Next::UNESCAPE_MAP
|
data/lib/json/next/pattern.rb
CHANGED
@@ -92,6 +92,7 @@ module JSON
|
|
92
92
|
)
|
93
93
|
>
|
94
94
|
|
95
|
+
|
95
96
|
IDENTIFIER = %<
|
96
97
|
(?<identifier>
|
97
98
|
[a-zA-Z_$]
|
@@ -99,6 +100,24 @@ module JSON
|
|
99
100
|
)
|
100
101
|
>
|
101
102
|
|
103
|
+
|
104
|
+
## note: allow extra chars for identifier (extended)
|
105
|
+
## e.g. allow dash (-) e.g:
|
106
|
+
## babel-preset-es2015
|
107
|
+
## core-js
|
108
|
+
## cross-spawn
|
109
|
+
## eslint-config-jquery
|
110
|
+
## and others
|
111
|
+
|
112
|
+
IDENTIFIER_EXTENDED = %<
|
113
|
+
(?<identifier>
|
114
|
+
[a-zA-Z_$]
|
115
|
+
[\\w_$\\-]*
|
116
|
+
)
|
117
|
+
>
|
118
|
+
|
119
|
+
|
120
|
+
|
102
121
|
TRAILING_COMMA = %<
|
103
122
|
(?<trailing_comma>,)
|
104
123
|
(?=
|
data/lib/json/next/version.rb
CHANGED
data/test/data/jsonx2.txt
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
{
|
5
5
|
name: "Cookie Monster"
|
6
6
|
/* Note the template quotes and unescaped regular quotes in the next string */
|
7
|
-
background: `Cookie Monster used to be a
|
7
|
+
background-text: `Cookie Monster used to be a
|
8
8
|
monster that ate everything, especially cookies.
|
9
9
|
These days he is forced to eat "healthy" food.`
|
10
10
|
}, {
|
11
11
|
# You can single-quote strings too:
|
12
12
|
name: 'Herry Monster',
|
13
|
-
background: `Herry Monster is a furry blue monster with a purple nose.
|
13
|
+
background-text: `Herry Monster is a furry blue monster with a purple nose.
|
14
14
|
He's mostly retired today.`
|
15
15
|
}, /* don't worry, the trailing comma will be ignored */
|
16
16
|
]
|
@@ -22,10 +22,10 @@ He's mostly retired today.`
|
|
22
22
|
"listName" => "Sesame Street Monsters",
|
23
23
|
"content" =>
|
24
24
|
[{"name" => "Cookie Monster",
|
25
|
-
"background" =>
|
25
|
+
"background-text" =>
|
26
26
|
"Cookie Monster used to be a\nmonster that ate everything, especially cookies.\nThese days he is forced to eat \"healthy\" food."},
|
27
27
|
{"name" => "Herry Monster",
|
28
|
-
"background" =>
|
28
|
+
"background-text" =>
|
29
29
|
"Herry Monster is a furry blue monster with a purple nose.\nHe's mostly retired today."}
|
30
30
|
]
|
31
31
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-next
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3.
|
33
|
+
version: '3.16'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
40
|
+
version: '3.16'
|
41
41
|
description: json-next - read generation y / next generation json versions (HanSON,
|
42
42
|
SON, JSONX/JSON11, etc.) with comments, unquoted keys, multi-line strings, trailing
|
43
43
|
commas, optional commas, and more
|