From 7ddeeceaf0ea843e5ccb2d7b7366bbc00d9f7b50 Mon Sep 17 00:00:00 2001 From: Johannes Rappen Date: Thu, 21 Oct 2021 01:59:26 +0200 Subject: [PATCH] [JSON] Rewrite syntax --- ...erences => Comments - JSONC.tmPreferences} | 2 +- JSON/Default.sublime-keymap | 14 +- ...=> Indentation Rules - JSON.tmPreferences} | 0 JSON/Indentation Rules - JSONC.tmPreferences | 65 ++++++ JSON/JSON (Basic).sublime-syntax | 205 ++++++++++++++++++ JSON/JSON.sublime-syntax | 166 +------------- JSON/JSONC.sublime-syntax | 109 ++++++++++ JSON/syntax_test_json.json | 123 ----------- .../syntax_test_indentation_json.mapping.json | 36 +++ ...syntax_test_indentation_json.sequence.json | 89 ++++++++ ...yntax_test_indentation_jsonc.mapping.jsonc | 36 +++ ...ntax_test_indentation_jsonc.sequence.jsonc | 89 ++++++++ .../syntax/syntax_test_jsonc.comments.jsonc | 170 +++++++++++++++ .../syntax/syntax_test_jsonc.constants.jsonc | 14 ++ .../syntax/syntax_test_jsonc.invalids.jsonc | 33 +++ JSON/tests/syntax/syntax_test_jsonc.jsonc | 73 +++++++ .../syntax/syntax_test_jsonc.numbers.jsonc | 199 +++++++++++++++++ .../syntax/syntax_test_jsonc.strings.jsonc | 68 ++++++ 18 files changed, 1203 insertions(+), 288 deletions(-) rename JSON/{Comments.tmPreferences => Comments - JSONC.tmPreferences} (94%) rename JSON/{Indentation Rules.tmPreferences => Indentation Rules - JSON.tmPreferences} (100%) create mode 100644 JSON/Indentation Rules - JSONC.tmPreferences create mode 100644 JSON/JSON (Basic).sublime-syntax create mode 100644 JSON/JSONC.sublime-syntax delete mode 100644 JSON/syntax_test_json.json create mode 100644 JSON/tests/indentation/syntax_test_indentation_json.mapping.json create mode 100644 JSON/tests/indentation/syntax_test_indentation_json.sequence.json create mode 100644 JSON/tests/indentation/syntax_test_indentation_jsonc.mapping.jsonc create mode 100644 JSON/tests/indentation/syntax_test_indentation_jsonc.sequence.jsonc create mode 100644 JSON/tests/syntax/syntax_test_jsonc.comments.jsonc create mode 100644 JSON/tests/syntax/syntax_test_jsonc.constants.jsonc create mode 100644 JSON/tests/syntax/syntax_test_jsonc.invalids.jsonc create mode 100644 JSON/tests/syntax/syntax_test_jsonc.jsonc create mode 100644 JSON/tests/syntax/syntax_test_jsonc.numbers.jsonc create mode 100644 JSON/tests/syntax/syntax_test_jsonc.strings.jsonc diff --git a/JSON/Comments.tmPreferences b/JSON/Comments - JSONC.tmPreferences similarity index 94% rename from JSON/Comments.tmPreferences rename to JSON/Comments - JSONC.tmPreferences index d9695e9cf24..425acc0a059 100644 --- a/JSON/Comments.tmPreferences +++ b/JSON/Comments - JSONC.tmPreferences @@ -2,7 +2,7 @@ scope - source.json + source.json.jsonc settings shellVariables diff --git a/JSON/Default.sublime-keymap b/JSON/Default.sublime-keymap index e11d9bce5c6..557954a6455 100644 --- a/JSON/Default.sublime-keymap +++ b/JSON/Default.sublime-keymap @@ -3,7 +3,7 @@ { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context": [ { "key": "setting.auto_match_enabled" }, - { "key": "selector", "operand": "source.json" }, + { "key": "selector", "operand": "source.json | source.json.jsonc" }, { "key": "selection_empty", "match_all": true }, { "key": "preceding_text", "operator": "not_regex_contains", "operand": "['\\w]$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |]|,|:|\\}|$)", "match_all": true } @@ -14,7 +14,7 @@ { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": [ { "key": "setting.auto_match_enabled" }, - { "key": "selector", "operand": "source.json" }, + { "key": "selector", "operand": "source.json | source.json.jsonc" }, { "key": "selection_empty", "match_all": true }, { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"\\w]$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |]|,|:|\\}|$)", "match_all": true } @@ -25,7 +25,7 @@ { "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{$0}"}, "context": [ { "key": "setting.auto_match_enabled" }, - { "key": "selector", "operand": "source.json" }, + { "key": "selector", "operand": "source.json | source.json.jsonc" }, { "key": "selection_empty", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |]|,|:|\\}|$)", "match_all": true } ] @@ -35,7 +35,7 @@ { "keys": ["["], "command": "insert_snippet", "args": {"contents": "[$0]"}, "context": [ { "key": "setting.auto_match_enabled" }, - { "key": "selector", "operand": "source.json" }, + { "key": "selector", "operand": "source.json | source.json.jsonc" }, { "key": "selection_empty", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |]|,|:|\\}|$)", "match_all": true } ] @@ -45,7 +45,7 @@ { "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context": [ { "key": "setting.auto_indent" }, - { "key": "selector", "operand": "source.json" }, + { "key": "selector", "operand": "source.json | source.json.jsonc" }, { "key": "selection_empty", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true } @@ -54,10 +54,10 @@ { "keys": ["shift+enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context": [ { "key": "setting.auto_indent" }, - { "key": "selector", "operand": "source.json" }, + { "key": "selector", "operand": "source.json | source.json.jsonc" }, { "key": "selection_empty", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true } ] }, -] \ No newline at end of file +] diff --git a/JSON/Indentation Rules.tmPreferences b/JSON/Indentation Rules - JSON.tmPreferences similarity index 100% rename from JSON/Indentation Rules.tmPreferences rename to JSON/Indentation Rules - JSON.tmPreferences diff --git a/JSON/Indentation Rules - JSONC.tmPreferences b/JSON/Indentation Rules - JSONC.tmPreferences new file mode 100644 index 00000000000..24e4b47190f --- /dev/null +++ b/JSON/Indentation Rules - JSONC.tmPreferences @@ -0,0 +1,65 @@ + + + + scope + source.json.jsonc + settings + + decreaseIndentPattern + (?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*\].*$ + ) + + increaseIndentPattern + (?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 + ($|/[/*]) + ) + + indentSquareBrackets + + + + diff --git a/JSON/JSON (Basic).sublime-syntax b/JSON/JSON (Basic).sublime-syntax new file mode 100644 index 00000000000..f0d769339cd --- /dev/null +++ b/JSON/JSON (Basic).sublime-syntax @@ -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 diff --git a/JSON/JSON.sublime-syntax b/JSON/JSON.sublime-syntax index c391ca6687e..e4d7610888d 100644 --- a/JSON/JSON.sublime-syntax +++ b/JSON/JSON.sublime-syntax @@ -1,165 +1,17 @@ %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 +# https://datatracker.ietf.org/doc/html/rfc7159 name: JSON scope: source.json version: 2 +extends: + - 'Packages/JSON/JSON (Basic).sublime-syntax' + file_extensions: - - json - - sublime-build - - sublime-color-scheme - - sublime-commands - - sublime-completions - - sublime-keymap - - sublime-macro - - sublime-menu - - sublime-mousemap - - sublime-project - - sublime-settings - - sublime-theme - - sublime-workspace - - ipynb + - ipynb # Jupyter Notebook, formerly known as iPython Notebook - Pipfile.lock - -contexts: - - prototype: - - include: comments - - main: - - include: value - - value: - - include: constant - - include: number - - include: string - - include: array - - include: object - - array: - - match: \[ - scope: punctuation.section.sequence.begin.json - push: - - meta_scope: meta.sequence.json - - match: \] - scope: punctuation.section.sequence.end.json - pop: 1 - - include: value - - match: ',' - scope: punctuation.separator.sequence.json - - match: '[^\s\]]' - scope: invalid.illegal.expected-sequence-separator.json - - comments: - - match: /\*\*(?!/) - scope: punctuation.definition.comment.json - push: - - meta_scope: comment.block.documentation.json - - meta_include_prototype: false - - match: \*/ - pop: 1 - - match: ^\s*(\*)(?!/) - captures: - 1: punctuation.definition.comment.json - - match: /\* - scope: punctuation.definition.comment.json - push: - - meta_scope: comment.block.json - - meta_include_prototype: false - - match: \*/ - pop: 1 - - match: (//).*$\n? - scope: comment.line.double-slash.js - captures: - 1: punctuation.definition.comment.json - - constant: - - match: \b(?:false|true)\b - scope: constant.language.boolean.json - - match: \bnull\b - scope: constant.language.null.json - - number: - # handles integer and decimal numbers - - match: (-?)((?:0|[1-9]\d*)(?:(?:(\.)\d+)(?:[eE][-+]?\d+)?|(?:[eE][-+]?\d+))) - scope: meta.number.float.decimal.json - captures: - 1: keyword.operator.arithmetic.json - 2: constant.numeric.value.json - 3: punctuation.separator.decimal.json - - match: (-?)(0|[1-9]\d*) - scope: meta.number.integer.decimal.json - captures: - 1: keyword.operator.arithmetic.json - 2: constant.numeric.value.json - - object: - # a JSON object - - match: \{ - scope: punctuation.section.mapping.begin.json - push: - - meta_scope: meta.mapping.json - - match: \} - scope: punctuation.section.mapping.end.json - pop: 1 - - match: \" - scope: punctuation.definition.string.begin.json - push: - - clear_scopes: 1 - - meta_scope: meta.mapping.key.json string.quoted.double.json - - meta_include_prototype: false - - include: inside-string - - 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: value - - 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 - - match: '[^\s\}]' - scope: invalid.illegal.expected-mapping-key.json - - string: - - match: \" - scope: punctuation.definition.string.begin.json - push: inside-string - - inside-string: - - meta_scope: string.quoted.double.json - - meta_include_prototype: false - - match: \" - scope: punctuation.definition.string.end.json - pop: 1 - - include: string-escape - - match: \n - scope: invalid.illegal.unclosed-string.json - pop: 1 - - string-escape: - - match: |- - (?x: # turn on extended mode - \\ # a literal backslash - (?: # ...followed by... - ["\\/bfnrt] # one of these characters - | # ...or... - u # a u - [0-9a-fA-F]{4} # and four hex digits - ) - ) - scope: constant.character.escape.json - - match: \\. - scope: invalid.illegal.unrecognized-string-escape.json diff --git a/JSON/JSONC.sublime-syntax b/JSON/JSONC.sublime-syntax new file mode 100644 index 00000000000..3417ccb8d5d --- /dev/null +++ b/JSON/JSONC.sublime-syntax @@ -0,0 +1,109 @@ +%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 (with Comments) +scope: source.json.jsonc +version: 2 + +# The JSONC syntax extends the JSON syntax with comments +# while making sure that prototype contexts are properly ex- or included. + +extends: + - 'Packages/JSON/JSON.sublime-syntax' + +file_extensions: + - json + - jsonc + - sublime-build + - sublime-color-scheme + - sublime-commands + - sublime-completions + - sublime-keymap + - sublime-macro + - sublime-menu + - sublime-mousemap + - sublime-project + - sublime-settings + - sublime-theme + - sublime-workspace + + +####[ Contexts ]######################################################################################################## + + +contexts: + prototype: + - include: comments + +####[ Comments ]######################################################################################################## + + comments: + - include: comment-line + - include: comment-block-doc + - include: comment-block + + comment-line: + - match: |- + (?x: + (//) # capture group 1: two forwards slahes + .* # zero or more of any character + $\n? # eol (end of line) optionally followed by newline + ) + scope: comment.line.double-slash.jsonc + captures: + 1: punctuation.definition.comment.jsonc + + comment-block-doc: + - match: |- + (?x: + /\*\* # forward-slash, two asterisks + (?!/) # negative look-ahead: forward-slash + ) + scope: punctuation.definition.comment.begin.jsonc + push: + - meta_scope: comment.block.documentation.jsonc + - meta_include_prototype: false + - match: |- + (?x: + \*/ # asterisk, forward-slash + ) + scope: punctuation.definition.comment.end.jsonc + pop: 1 + - match: |- + (?x: + ^ # bol (beginning of line) + \s* # zero or more whitespace characters + (\*) # capture group 1: asterisk + (?!/) # negative look-ahead: forward-slash + ) + captures: + 1: punctuation.definition.comment.jsonc + + comment-block: + - match: |- + (?x: + /\* # forward-slash, asterisk + ) + scope: punctuation.definition.comment.begin.jsonc + push: + - meta_scope: comment.block.jsonc + - meta_include_prototype: false + - match: |- + (?x: + \*/ # asterisk, forward-slash + ) + scope: punctuation.definition.comment.end.jsonc + pop: 1 + +####[ Extends ]######################################################################################################### + + inside-double-quoted-string: + - meta_prepend: true + - meta_include_prototype: false + + inside-double-quoted-string-inside-mapping: + - meta_prepend: true + - meta_include_prototype: false diff --git a/JSON/syntax_test_json.json b/JSON/syntax_test_json.json deleted file mode 100644 index 77718007718..00000000000 --- a/JSON/syntax_test_json.json +++ /dev/null @@ -1,123 +0,0 @@ -// SYNTAX TEST "Packages/JSON/JSON.sublime-syntax" - -{ -// <- meta.mapping.json punctuation.section.mapping.begin.json - "bool": false, -//^^^^^^ meta.mapping.key.json -//^^^^^^^^^^^^^^ - meta.mapping meta.mapping -// ^^^^^ constant.language.boolean.json - - "null": null, -//^^^^^^ meta.mapping.key.json -//^^^^^^^^^^^^^ - meta.mapping meta.mapping -// ^^^^ constant.language.null.json - - "dict": { "key": "value" } -// ^^^^^^^^^^^^^^^^^^ meta.mapping.value.json meta.mapping - meta.mapping meta.mapping meta.mapping -// ^ punctuation.section.mapping.begin.json -// ^ punctuation.section.mapping.end.json -// ^^ meta.mapping.value.json meta.mapping.json -// ^^^^^ meta.mapping.key.json string.quoted.double.json -// ^^ meta.mapping.value.json meta.mapping.json -// ^^^^^^^ meta.mapping.value.json meta.mapping.value.json string.quoted.double.json -// ^^ meta.mapping.value.json meta.mapping.json - -, , -// <- punctuation.separator.mapping.pair.json -//^ invalid.illegal.expected-mapping-key.json - - "sep": {}, -// ^ punctuation.separator.mapping.key-value.json - - "array": [ /**/ ], -// ^^^^^^^^ meta.mapping.value.json meta.sequence.json -// ^ punctuation.section.sequence.begin.json -// ^^^^ comment.block.json -// ^ punctuation.section.sequence.end.json - - "dict": {"foo": }, -// ^ invalid.illegal.expected-mapping-value.json -// ^ punctuation.section.mapping.end.json - "dict": {"foo": - }, -//^ invalid.illegal.expected-mapping-value.json -// ^ punctuation.section.mapping.end.json - - "dict": {"foo"/*comment*/:/*comment*/"bar"/*comment*/}, -// ^^^^^^^^^^^ comment.block.json -// ^^^^^^^^^^^ comment.block.json -// ^^^^^^^^^^^ comment.block.json - - "dict": { - "foo": "bar" - // comment -// ^ - invalid -// ^^^^^^^^^^ comment.line.double-slash.js - , -// ^ punctuation.separator.mapping.pair.json - "foo": "bar" - /* comment */ -// ^ - invalid -// ^^^^^^^^^^^^^ comment.block.json - }, -//^ punctuation.section.mapping.end.json -// ^ punctuation.separator.mapping.pair.json - - "string": "string", -// ^ punctuation.definition.string.begin.json -// ^^^^^^^^ meta.mapping.value.json string.quoted.double.json -// ^ punctuation.definition.string.end.json - - "num": 20.09, -// ^^^^^ meta.number.float.decimal.json constant.numeric.value.json -// ^ punctuation.separator.decimal.json - - "neg": -9, -// ^^ meta.number.integer.decimal.json -// ^ keyword.operator.arithmetic.json -// ^ constant.numeric.value.json - - "E": 20e10, -// ^^^^^ meta.number.float.decimal.json constant.numeric.value.json -//^^^ meta.mapping.key.json string.quoted.double.json -// ^ punctuation.separator.mapping.key-value.json - meta.mapping.key - - "escape": "\n", -// ^^ constant.character.escape.json -// ^^^^ meta.mapping.value.json string.quoted.double.json - meta.mapping.key - - "illegal": "\.", -// ^^ invalid.illegal.unrecognized-string-escape.json - - "unterminated string -//^^^^^^^^^^^^^^^^^^^^ string.quoted.double.json -// ^ string.quoted.double.json invalid.illegal.unclosed-string.json - -// <- - string - -/**/: "test", -// ^ meta.mapping.json comment.block.json -// ^ punctuation.separator.mapping.key-value.json - comment -// ^^^^^^ meta.mapping.value.json string.quoted.double.json - - "array2": - [ - "foobar", -// ^^^^^^^^ meta.mapping.value meta.sequence.json string.quoted.double.json - meta.mapping.key - ] - - [], -//^ invalid.illegal.expected-mapping-separator.json -// ^^^ invalid.illegal.expected-mapping-key.json - - "typing json": {} - ,,,, "another key": false, - - "ke//y": "value" -//^^^^^^^ meta.mapping.key.json string.quoted.double.json - comment - -/** - * -// ^ meta.mapping.json comment.block.documentation.json punctuation.definition.comment.json -*/ -} diff --git a/JSON/tests/indentation/syntax_test_indentation_json.mapping.json b/JSON/tests/indentation/syntax_test_indentation_json.mapping.json new file mode 100644 index 00000000000..cb36ba9613b --- /dev/null +++ b/JSON/tests/indentation/syntax_test_indentation_json.mapping.json @@ -0,0 +1,36 @@ +// SYNTAX TEST reindent "Packages/JSON/JSON.sublime-syntax" + +// <- source.json - source.json.jsonc + +{ + "a": + [ + "a", + "b" + ], + "b": + [ + { + "a": "a", + "b": "b" + }, + { + "a": "a", + "b": "b" + } + ], + "c": + { + "a": + { + "a": "a", + "b": "b" + }, + "b": + [ + "a", + "b", + "c" + ] + } +} diff --git a/JSON/tests/indentation/syntax_test_indentation_json.sequence.json b/JSON/tests/indentation/syntax_test_indentation_json.sequence.json new file mode 100644 index 00000000000..e84350cae63 --- /dev/null +++ b/JSON/tests/indentation/syntax_test_indentation_json.sequence.json @@ -0,0 +1,89 @@ +// SYNTAX TEST reindent "Packages/JSON/JSON.sublime-syntax" + +// <- source.json - source.json.jsonc + +[ + [ + "a", + "b", + "c" + ], + [ + 1, + 2, + 3 + ], + [ + [ + "a", + "b", + "c" + ], + [ + 1, + 2, + 3 + ], + [ + { + "a": "a", + "b": "b", + "c": "c" + }, + { + "a": "a", + "b": "b", + "c": "c" + }, + { + "a": "a", + "b": "b", + "c": "c" + } + ], + [ + [ + "a", + "b", + "c" + ], + [ + 1, + 2, + 3], + [ + {"a": "a"}, + {"b": "b"}, + {"c": "c"} + ], + [ + [ + "a", + "b", + "c" + ], + [ + 1, + 2, + 3 + ], + [ + { + "a": "a" + }, + { + "b": "b" + }, + { + "c": "c" + } + ], + [ + [0], + [0], + [0] + ] + ] + ] + ] +] diff --git a/JSON/tests/indentation/syntax_test_indentation_jsonc.mapping.jsonc b/JSON/tests/indentation/syntax_test_indentation_jsonc.mapping.jsonc new file mode 100644 index 00000000000..77dbaad820f --- /dev/null +++ b/JSON/tests/indentation/syntax_test_indentation_jsonc.mapping.jsonc @@ -0,0 +1,36 @@ +// SYNTAX TEST reindent "Packages/JSON/JSONC.sublime-syntax" + +// <- source.json.jsonc + +{ + "a": + [ + "a", + "b" + ], + "b": + [ + { + "a": "a", + "b": "b" + }, + { + "a": "a", + "b": "b" + } + ], + "c": + { + "a": + { + "a": "a", + "b": "b" + }, + "b": + [ + "a", + "b", + "c" + ] + } +} diff --git a/JSON/tests/indentation/syntax_test_indentation_jsonc.sequence.jsonc b/JSON/tests/indentation/syntax_test_indentation_jsonc.sequence.jsonc new file mode 100644 index 00000000000..0499df39f34 --- /dev/null +++ b/JSON/tests/indentation/syntax_test_indentation_jsonc.sequence.jsonc @@ -0,0 +1,89 @@ +// SYNTAX TEST reindent "Packages/JSON/JSONC.sublime-syntax" + +// <- source.json.jsonc + +[ + [ + "a", + "b", + "c" + ], + [ + 1, + 2, + 3 + ], + [ + [ + "a", + "b", + "c" + ], + [ + 1, + 2, + 3 + ], + [ + { + "a": "a", + "b": "b", + "c": "c" + }, + { + "a": "a", + "b": "b", + "c": "c" + }, + { + "a": "a", + "b": "b", + "c": "c" + } + ], + [ + [ + "a", + "b", + "c" + ], + [ + 1, + 2, + 3], + [ + {"a": "a"}, + {"b": "b"}, + {"c": "c"} + ], + [ + [ + "a", + "b", + "c" + ], + [ + 1, + 2, + 3 + ], + [ + { + "a": "a" + }, + { + "b": "b" + }, + { + "c": "c" + } + ], + [ + [0], + [0], + [0] + ] + ] + ] + ] +] diff --git a/JSON/tests/syntax/syntax_test_jsonc.comments.jsonc b/JSON/tests/syntax/syntax_test_jsonc.comments.jsonc new file mode 100644 index 00000000000..4ece15b5403 --- /dev/null +++ b/JSON/tests/syntax/syntax_test_jsonc.comments.jsonc @@ -0,0 +1,170 @@ +// SYNTAX TEST "Packages/JSON/JSONC.sublime-syntax" + +// <- source.json.jsonc + +{ + // comment // comment +// ^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash +// ^^ comment.line.double-slash punctuation.definition.comment +// ^^^^^^^^^^ - comment.line comment.line + + // comment /** comment */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash +// ^^ comment.line.double-slash punctuation.definition.comment +// ^^^^^^^^^^^^^^ - comment.line comment.block.documentation +// ^^^ - punctuation.definition.comment.begin +// ^^ - punctuation.definition.comment.end + + // comment /* comment */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash +// ^^ comment.line.double-slash punctuation.definition.comment +// ^^^^^^^^^^^^^ - comment.line comment.block +// ^^ - punctuation.definition.comment.begin +// ^^ - punctuation.definition.comment.end + + + + + + /** comment // comment */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation +// ^^^ comment.block.documentation punctuation.definition.comment.begin +// ^^^^^^^^^^^^^ - comment.line +// ^^ comment.block.documentation punctuation.definition.comment.end + + /** comment /** comment */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation +// ^^^ comment.block.documentation punctuation.definition.comment.begin +// ^^^^^^^^^^^^^^ - comment.block.documentation comment.block.documentation +// ^^ comment.block.documentation punctuation.definition.comment.end +// ^^ - comment.block.documentation comment.block.documentation punctuation.definition.comment.end + + /** comment /* comment */ +// ^^^ comment.block.documentation punctuation.definition.comment.begin +// ^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation +// ^^^^^^^^^^^^^ - comment.block.documentation comment.block +// ^^ comment.block.documentation punctuation.definition.comment.end +// ^^ - comment.block.documentation comment.block punctuation.definition.comment.end + + + + + + /** comment + // comment */ +// ^^^^^^^^^^^^^ - comment.line +// ^^ comment.block.documentation punctuation.definition.comment.end + + /** comment + /** comment */ +// ^^^^^^^^^^^^^^ - comment.block.documentation comment.block.documentation +// ^^ comment.block.documentation punctuation.definition.comment.end +// ^^ - comment.block.documentation comment.block.documentation punctuation.definition.comment.end + + /** comment + /* comment */ +// ^^^^^^^^^^^^^ - comment.block.documentation comment.block +// ^^ comment.block.documentation punctuation.definition.comment.end +// ^^ - comment.block.documentation comment.block punctuation.definition.comment.end + + + + + + /** + * comment +// ^ comment.block.documentation punctuation.definition.comment + * comment + */ + + + + + + /* comment // comment */ +// ^^ comment.block punctuation.definition.comment.begin +// ^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +// ^^^^^^^^^^^^ - comment.line +// ^^ comment.block punctuation.definition.comment.end + + /* comment /** comment */ +// ^^ comment.block punctuation.definition.comment.begin +// ^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +// ^^^^^^^^^^^^^ - comment.block comment.block.documentation +// ^^ comment.block punctuation.definition.comment.end +// ^^ - comment.block comment.block.documentation punctuation.definition.comment.end + + /* comment /* comment */ +// ^^ comment.block punctuation.definition.comment.begin +// ^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +// ^^^^^^^^^^^^ - comment.block comment.block +// ^^ comment.block punctuation.definition.comment.end +// ^^ - comment.block comment.block punctuation.definition.comment.end + + + + + + /* comment + // comment */ +// ^^^^^^^^^^^^^ - comment.line +// ^^ comment.block punctuation.definition.comment.end + + /* comment + /** comment */ +// ^^^^^^^^^^^^^ - comment.block comment.block.documentation +// ^^ comment.block punctuation.definition.comment.end +// ^^ - comment.block comment.block.documentation punctuation.definition.comment.end + + /* comment + /* comment */ +// ^^^^^^^^^^^^ - comment.block comment.block +// ^^ comment.block punctuation.definition.comment.end +// ^^ - comment.block comment.block punctuation.definition.comment.end + + + + + + /* + * comment +// ^ comment.block +// ^ - punctuation.definition.comment + * comment + */ + + + + + + "array": [ /**/ ], +// ^^^^ comment.block + + "dict": {"foo"/*comment*/:/*comment*/"bar"/*comment*/}, +// ^^^^^^^^^^^ comment.block +// ^^^^^^^^^^^ comment.block +// ^^^^^^^^^^^ comment.block + + "dict": { + "foo": "bar" + // comment +// ^^^^^^^^^^ comment.line.double-slash + , +// ^ punctuation.separator.mapping.pair + "foo": "bar" + /* comment */ +// ^^^^^^^^^^^^^ comment.block + }, + + "unterminated string + /**/: "test", +// ^^^^ meta.mapping comment.block + + "ke//y": "value" +// ^^^^^^^ meta.mapping.key string.quoted.double - comment + +/** + * +// ^ comment.block.documentation punctuation.definition.comment +*/ +} diff --git a/JSON/tests/syntax/syntax_test_jsonc.constants.jsonc b/JSON/tests/syntax/syntax_test_jsonc.constants.jsonc new file mode 100644 index 00000000000..b78b2a67b3f --- /dev/null +++ b/JSON/tests/syntax/syntax_test_jsonc.constants.jsonc @@ -0,0 +1,14 @@ +// SYNTAX TEST "Packages/JSON/JSONC.sublime-syntax" + +// <- source.json.jsonc + +{ + "bool-false": false, +// ^^^^^ constant.language.boolean + + "bool-true": true, +// ^^^^ constant.language.boolean + + "null": null +// ^^^^ constant.language.null +} diff --git a/JSON/tests/syntax/syntax_test_jsonc.invalids.jsonc b/JSON/tests/syntax/syntax_test_jsonc.invalids.jsonc new file mode 100644 index 00000000000..add102d7273 --- /dev/null +++ b/JSON/tests/syntax/syntax_test_jsonc.invalids.jsonc @@ -0,0 +1,33 @@ +// SYNTAX TEST "Packages/JSON/JSONC.sublime-syntax" + +// <- source.json.jsonc + +{ + "a": "\.", +// ^^ string.quoted.double invalid.illegal.unrecognized-string-escape - constant.character.escape + + "b": "\u123", +// ^^ string.quoted.double invalid.illegal.unrecognized-string-escape +// ^^^^^ string.quoted.double - constant.character.escape + + "c": "c" + , , +// ^ meta.mapping punctuation.separator.mapping.pair +// ^ meta.mapping invalid.illegal.expected-mapping-key + + "d": { "d": }, +// ^ meta.mapping.value meta.mapping invalid.illegal.expected-mapping-value +// ^ meta.mapping.value meta.mapping punctuation.section.mapping.end + + "e": { "e": + }, +// ^ invalid.illegal.expected-mapping-value +// ^ punctuation.section.mapping.end + + [], +// ^^^ invalid.illegal.expected-mapping-key + + "f": "f" + "g": "g" +// ^ invalid.illegal.expected-mapping-separator +} diff --git a/JSON/tests/syntax/syntax_test_jsonc.jsonc b/JSON/tests/syntax/syntax_test_jsonc.jsonc new file mode 100644 index 00000000000..122607feabd --- /dev/null +++ b/JSON/tests/syntax/syntax_test_jsonc.jsonc @@ -0,0 +1,73 @@ +// SYNTAX TEST "Packages/JSON/JSONC.sublime-syntax" + +// <- source.json.jsonc + +{ +// <- meta.mapping punctuation.section.mapping.begin + + "dict": { "key": "value" } +// ^^^^^^^^^^^^^^^^^^ meta.mapping.value meta.mapping - meta.mapping meta.mapping meta.mapping +// ^ punctuation.section.mapping.begin +// ^ punctuation.section.mapping.end +// ^^ meta.mapping.value meta.mapping +// ^^^^^ meta.mapping.key string.quoted.double +// ^^ meta.mapping.value meta.mapping +// ^^^^^^^ meta.mapping.value meta.mapping.value string.quoted.double +// ^^ meta.mapping.value meta.mapping + +, + + "sep": {}, +// ^ punctuation.separator.mapping.key-value + + "array": [ /**/ ], +// ^^^^^^^^ meta.mapping.value meta.sequence +// ^ punctuation.section.sequence.begin +// ^^^^ comment.block +// ^ punctuation.section.sequence.end + + "dict": {"foo"/*comment*/:/*comment*/"bar"/*comment*/}, +// ^^^^^^^^^^^ comment.block +// ^^^^^^^^^^^ comment.block +// ^^^^^^^^^^^ comment.block + + "dict": { + "foo": "bar" + // comment +// ^ - invalid +// ^^^^^^^^^^ comment.line.double-slash + , +// ^ punctuation.separator.mapping.pair + "foo": "bar" + /* comment */ +// ^ - invalid +// ^^^^^^^^^^^^^ comment.block + }, +//^ punctuation.section.mapping.end +// ^ punctuation.separator.mapping.pair + + "string": "string", +// ^ punctuation.definition.string.begin +// ^^^^^^^^ meta.mapping.value string.quoted.double +// ^ punctuation.definition.string.end + + "unterminated string +//^^^^^^^^^^^^^^^^^^^^ string.quoted.double +// ^ string.quoted.double invalid.illegal.unclosed-string + +// <- - string + +/**/: "test", +// ^ meta.mapping comment.block +// ^ punctuation.separator.mapping.key-value - comment +// ^^^^^^ meta.mapping.value string.quoted.double + + "array2": + [ + "foobar", +// ^^^^^^^^ meta.mapping.value meta.sequence string.quoted.double - meta.mapping.key + ] + + "typing json": {} + ,,,, "another key": false +} diff --git a/JSON/tests/syntax/syntax_test_jsonc.numbers.jsonc b/JSON/tests/syntax/syntax_test_jsonc.numbers.jsonc new file mode 100644 index 00000000000..4ae5d78f72a --- /dev/null +++ b/JSON/tests/syntax/syntax_test_jsonc.numbers.jsonc @@ -0,0 +1,199 @@ +// SYNTAX TEST "Packages/JSON/JSONC.sublime-syntax" + +// <- source.json.jsonc + +{ + "zero": 0, +// ^ meta.number.integer.decimal +// ^ constant.numeric.value + + "negative-zero": -0, +// ^^ meta.number.integer.decimal +// ^ keyword.operator.arithmetic +// ^ constant.numeric.value + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + "integer": 9, +// ^ meta.number.integer.decimal +// ^ constant.numeric.value + + "negative-integer": -9, +// ^^ meta.number.integer.decimal +// ^ keyword.operator.arithmetic +// ^ constant.numeric.value + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + "float-zero": 0.0, +// ^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative-zero": -0.0, +// ^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-zero-with-zero-exponent": 0.0e0, +// ^^^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-zero-with-negative-zero-exponent": 0.0e-0, +// ^^^^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative-zero-with-zero-exponent": -0.0e0, +// ^^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative-zero-with-negative-zero-exponent": -0.0e-0, +// ^^^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-zero-no-fraction-with-zero-exponent": 0e0, +// ^^^ meta.number.float.decimal constant.numeric.value + + "float-negative-zero-no-fraction-with-zero-exponent": -0e0, +// ^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^constant.numeric.value + + "float-zero-no-fraction-with-negative-zero-exponent": 0e-0, +// ^^^^ meta.number.float.decimal constant.numeric.value + + "float-negative-zero-no-fraction-with-negative-zero-exponent": -0e-0, +// ^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^ constant.numeric.value + + "float-zero-with-exponent": 0.0e9, +// ^^^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-zero-with-negative-exponent": 0.0e-9, +// ^^^^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative-zero-with-exponent": -0.0e9, +// ^^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative-zero-with-negative-exponent": -0.0e-9, +// ^^^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-zero-no-fraction-with-exponent": 0e9, +// ^^^ meta.number.float.decimal constant.numeric.value + + "float-negative-zero-no-fraction-with-exponent": -0e9, +// ^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^ constant.numeric.value + + "float-zero-no-fraction-with-negative-exponent": 0e-9, +// ^^^^ meta.number.float.decimal constant.numeric.value + + "float-negative-zero-no-fraction-with-negative-exponent": -0e-9, +// ^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^ constant.numeric.value + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + "float": 9.0, +// ^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative": -9.0, +// ^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-with-zero-exponent": 9.0e0, +// ^^^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-with-negative-zero-exponent": 9.0e-0, +// ^^^^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative-with-zero-exponent": -9.0e0, +// ^^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative-with-negative-zero-exponent": -9.0e-0, +// ^^^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-no-fraction-with-zero-exponent": 9e0, +// ^^^ meta.number.float.decimal constant.numeric.value + + "float-negative-no-fraction-with-zero-exponent": -9e0, +// ^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^ constant.numeric.value + + "float-no-fraction-with-negative-zero-exponent": 9e-0, +// ^^^^ meta.number.float.decimal constant.numeric.value + + "float-negative-no-fraction-with-negative-zero-exponent": -9e-0, +// ^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^ constant.numeric.value + + "float-with-exponent": 9.0e9, +// ^^^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-with-negative-exponent": 9.0e-9, +// ^^^^^^ meta.number.float.decimal constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative-with-exponent": -9.0e9, +// ^^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-negative-with-negative-exponent": -9.0e-9, +// ^^^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^^^ constant.numeric.value +// ^ punctuation.separator.decimal + + "float-no-fraction-with-exponent": 9e9, +// ^^^ meta.number.float.decimal constant.numeric.value + + "float-negative-no-fraction-with-exponent": -9e9, +// ^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^ constant.numeric.value + + "float-no-fraction-with-negative-exponent": 9e-9, +// ^^^^ meta.number.float.decimal constant.numeric.value + + "float-negative-no-fraction-with-negative-exponent": -9e-9 +// ^^^^^ meta.number.float.decimal +// ^ keyword.operator.arithmetic +// ^^^^ constant.numeric.value +} diff --git a/JSON/tests/syntax/syntax_test_jsonc.strings.jsonc b/JSON/tests/syntax/syntax_test_jsonc.strings.jsonc new file mode 100644 index 00000000000..d82475d134d --- /dev/null +++ b/JSON/tests/syntax/syntax_test_jsonc.strings.jsonc @@ -0,0 +1,68 @@ +// SYNTAX TEST "Packages/JSON/JSONC.sublime-syntax" + +// <- source.json.jsonc + +{ + "a": "\"", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^ constant.character.escape.double-quote + + "b": "\\", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^ constant.character.escape.back-slash + + "c": "\/", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^ constant.character.escape.forward-slash + + "d": "\b", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^ constant.character.escape.backspace + + "e": "\f", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^ constant.character.escape.form-feed + + "f": "\n", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^ constant.character.escape.newline + + "g": "\r", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^ constant.character.escape.carriage-return + + "h": "\t", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^ constant.character.escape.horizontal-tab + + "i": "\u1234", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^^^^^ constant.character.escape.unicode-symbol + + "j": "\u12345", +// ^^^ meta.mapping.key string.quoted.double - meta.mapping.value +// ^^^^^^^^^ meta.mapping.value string.quoted.double - meta.mapping.key +// ^^^^^^ constant.character.escape.unicode-symbol +// ^ string.quoted.double - constant.character.escape + + "ke//y": "value", +// ^^^^^^^ meta.mapping.key string.quoted.double - comment +// ^^^^^^^ meta.mapping.value string.quoted.double + + "ke/***/y": "value", +// ^^^^^^^^^^ meta.mapping.key string.quoted.double - comment +// ^^^^^^^ meta.mapping.value string.quoted.double + + "ke/**/y": "value" +// ^^^^^^^^^ meta.mapping.key string.quoted.double - comment +// ^^^^^^^ meta.mapping.value string.quoted.double +}