-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,203 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>scope</key> | ||
<string>source.json.jsonc</string> | ||
<key>settings</key> | ||
<dict> | ||
<key>decreaseIndentPattern</key> | ||
<string>(?x) | ||
# When an object is closed, but not opened | ||
( | ||
^ | ||
( | ||
# Consume strings | ||
"(?:[^"\\]|\\.)*" | ||
| | ||
# Consume all chars that don't start a string, comment or | ||
# open an object on this line | ||
[^"/{\n] | ||
)* | ||
\}.*$ | ||
) | ||
| | ||
# When an array is closed by itself on a line (interacts with indentSquareBrackets) | ||
( | ||
^(.*\*/)?\s*\].*$ | ||
) | ||
</string> | ||
<key>increaseIndentPattern</key> | ||
<string>(?x) | ||
# When an object is opened, but not closed | ||
( | ||
^.*\{ | ||
( | ||
# Consume strings | ||
"(?:[^"\\]|\\.)*" | ||
| | ||
# Consume all chars that don't start a string, comment or | ||
# end the object that was opened on this line | ||
[^"/}] | ||
)* | ||
# Stop matching at the end of the line, or once we hit a comment | ||
($|/[/*]) | ||
) | ||
| | ||
# When an array is opened, but not closed | ||
( | ||
^.*\[ | ||
( | ||
# Consume strings | ||
"(?:[^"\\]|\\.)*" | ||
| | ||
# Consume all chars that don't start a string, comment or | ||
# end the array that was opened on this line | ||
[^"/\]] | ||
)* | ||
# Stop matching at the end of the line, or once we hit a comment | ||
($|/[/*]) | ||
) | ||
</string> | ||
<key>indentSquareBrackets</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
%YAML 1.2 | ||
--- | ||
# https://yaml.org/spec/1.2/spec.html | ||
# https://www.sublimetext.com/docs/syntax.html | ||
# https://www.sublimetext.com/docs/syntax.html#testing | ||
# https://www.sublimetext.com/docs/scope_naming.html | ||
name: JSON (Basic) | ||
scope: source.json.basic | ||
version: 2 | ||
hidden: true | ||
|
||
|
||
####[ Variables ]####################################################################################################### | ||
|
||
|
||
variables: | ||
boolean: |- | ||
(?x: # ignore whitespace | ||
false| | ||
true | ||
) | ||
'null': |- | ||
(?x: # ignore whitespace | ||
null | ||
) | ||
####[ Contexts ]######################################################################################################## | ||
|
||
|
||
contexts: | ||
|
||
main: | ||
- include: any | ||
|
||
any: | ||
- include: 'null' | ||
- include: boolean | ||
- include: numbers | ||
- include: strings | ||
- include: sequence | ||
- include: mapping | ||
|
||
####[ Null ]############################################################################################################ | ||
|
||
'null': | ||
- match: \b({{null}})\b | ||
captures: | ||
1: constant.language.null.json | ||
|
||
####[ Boolean ]######################################################################################################### | ||
|
||
boolean: | ||
- match: \b({{boolean}})\b | ||
captures: | ||
1: constant.language.boolean.json | ||
|
||
####[ Numbers ]######################################################################################################### | ||
|
||
numbers: | ||
- include: decimal-float | ||
- include: decimal-integer | ||
|
||
decimal-float: | ||
- match: |- | ||
(?x: # ignore whitespace | ||
([-]?) # capture group 1: optional sign | ||
( # capture group 2: numeric value | ||
(?:0|[1-9]\d*) # zero or any other (positive) decimal integer | ||
(?: | ||
(?:(\.)\d+)(?:[eE][-+]?\d+)?| # ... and either a period, one or more number characters, an optional exponent | ||
(?:[eE][-+]?\d+) # ... or an exponent | ||
) | ||
) | ||
) | ||
scope: meta.number.float.decimal.json | ||
captures: | ||
1: keyword.operator.arithmetic.json | ||
2: constant.numeric.value.json | ||
3: punctuation.separator.decimal.json | ||
decimal-integer: | ||
- match: |- | ||
(?x: # ignore whitespace | ||
([-]?) # capture group 1: optional sign | ||
(0|[1-9]\d*) # capture group 2: zero or any other (positive) decimal integer | ||
) | ||
scope: meta.number.integer.decimal.json | ||
captures: | ||
1: keyword.operator.arithmetic.json | ||
2: constant.numeric.value.json | ||
####[ Strings ]######################################################################################################### | ||
|
||
strings: | ||
- include: double-quoted-string | ||
|
||
double-quoted-string: | ||
- match: '"' | ||
scope: punctuation.definition.string.begin.json | ||
push: inside-double-quoted-string | ||
|
||
inside-double-quoted-string: | ||
- meta_scope: string.quoted.double.json | ||
- match: '"' | ||
scope: punctuation.definition.string.end.json | ||
pop: 1 | ||
- include: double-quoted-string-escape | ||
- match: |- | ||
(?x: # ignore whitespace | ||
$\n? # eol (end of line) optionally followed by newline | ||
) | ||
scope: invalid.illegal.unclosed-string.json | ||
pop: 1 | ||
double-quoted-string-escape: | ||
- match: |- | ||
(?x: # ignore whitespace | ||
(\\\")| | ||
(\\\\)| | ||
(\\\/)| | ||
(\\b)| | ||
(\\f)| | ||
(\\n)| | ||
(\\r)| | ||
(\\t)| | ||
(\\u[0-9a-fA-F]{4}) # backslash, lower u, exactly four hexadecimal characters | ||
) | ||
captures: | ||
1: constant.character.escape.double-quote.json | ||
2: constant.character.escape.back-slash.json | ||
3: constant.character.escape.forward-slash.json | ||
4: constant.character.escape.backspace.json | ||
5: constant.character.escape.form-feed.json | ||
6: constant.character.escape.newline.json # linefeed | ||
7: constant.character.escape.carriage-return.json | ||
8: constant.character.escape.horizontal-tab.json | ||
9: constant.character.escape.unicode-symbol.json | ||
- match: \\. | ||
scope: invalid.illegal.unrecognized-string-escape.json | ||
|
||
####[ Sequence ]######################################################################################################## | ||
|
||
sequence: | ||
- match: \[ | ||
scope: punctuation.section.sequence.begin.json | ||
push: inside-sequence | ||
|
||
inside-sequence: | ||
- meta_scope: meta.sequence.json | ||
- match: \] | ||
scope: punctuation.section.sequence.end.json | ||
pop: 1 | ||
- include: any | ||
- match: ',' | ||
scope: punctuation.separator.sequence.json | ||
- match: '[^\s\]]' | ||
scope: invalid.illegal.expected-sequence-separator.json | ||
|
||
####[ Mapping ]######################################################################################################### | ||
|
||
mapping: | ||
- match: \{ | ||
scope: punctuation.section.mapping.begin.json | ||
push: inside-mapping | ||
|
||
inside-mapping: | ||
- meta_scope: meta.mapping.json | ||
- match: \} | ||
scope: punctuation.section.mapping.end.json | ||
pop: 1 | ||
- match: '"' | ||
scope: punctuation.definition.string.begin.json | ||
push: inside-double-quoted-string-inside-mapping | ||
- include: latter-part-of-key-value-pair-inside-mapping | ||
- match: '[^\s\}]' | ||
scope: invalid.illegal.expected-mapping-key.json | ||
|
||
inside-double-quoted-string-inside-mapping: | ||
- clear_scopes: 1 | ||
- meta_scope: meta.mapping.key.json string.quoted.double.json | ||
- include: inside-double-quoted-string | ||
|
||
latter-part-of-key-value-pair-inside-mapping: | ||
- match: ':' | ||
scope: punctuation.separator.mapping.key-value.json | ||
push: | ||
- match: ',|\s?(?=\})' | ||
scope: invalid.illegal.expected-mapping-value.json | ||
pop: 1 | ||
- match: (?=\S) | ||
set: | ||
- clear_scopes: 1 | ||
- meta_scope: meta.mapping.value.json | ||
- include: any | ||
- match: '' | ||
set: | ||
- match: ',' | ||
scope: punctuation.separator.mapping.pair.json | ||
pop: 1 | ||
- match: \s*(?=\}) | ||
pop: 1 | ||
- match: \s(?!/[/*])(?=[^\s,])|[^\s,] | ||
scope: invalid.illegal.expected-mapping-separator.json | ||
pop: 1 |
Oops, something went wrong.