%YAML 1.2 --- name: JSON file_extensions: - json - sublime-settings - sublime-menu - sublime-keymap - sublime-mousemap - sublime-theme - sublime-build - sublime-project - sublime-completions - sublime-commands - sublime-macro scope: source.json contexts: main: - include: value array: - match: '\[' scope: punctuation.section.array.begin.json push: - meta_scope: meta.structure.array.json - match: '\]' scope: punctuation.section.array.end.json pop: true - include: value - match: "," scope: punctuation.separator.array.json - match: '[^\s\]]' scope: invalid.illegal.expected-array-separator.json comments: - match: /\*\*(?!/) scope: punctuation.definition.comment.json push: - meta_scope: comment.block.documentation.json - match: \*/ pop: true - match: /\* scope: punctuation.definition.comment.json push: - meta_scope: comment.block.json - match: \*/ pop: true - match: (//).*$\n? scope: comment.line.double-slash.js captures: 1: punctuation.definition.comment.json constant: - match: \b(?:true|false|null)\b scope: constant.language.json number: # handles integer and decimal numbers - match: |- (?x: # turn on extended mode -? # an optional minus (?: 0 # a zero | # ...or... [1-9] # a 1-9 character \d* # followed by zero or more digits ) (?: (?: \. # a period \d+ # followed by one or more digits )? (?: [eE] # an e character [+-]? # followed by an option +/- \d+ # followed by one or more digits )? # make exponent optional )? # make decimal portion optional ) scope: constant.numeric.json object: # a JSON object - match: '\{' scope: punctuation.section.dictionary.begin.json push: - meta_scope: meta.structure.dictionary.json - match: '\}' scope: punctuation.section.dictionary.end.json pop: true - match: '"' scope: punctuation.definition.string.begin.json push: - meta_scope: meta.structure.dictionary.key.json string.quoted.double.json - include: inside-string - include: comments - match: ":" scope: punctuation.separator.dictionary.key-value.json push: - meta_scope: meta.structure.dictionary.value.json - match: '(,)|(?=\})' captures: 1: punctuation.separator.dictionary.pair.json pop: true - include: value - match: '[^\s,]' scope: invalid.illegal.expected-dictionary-separator.json - match: '[^\s\}]' scope: invalid.illegal.expected-dictionary-separator.json string: - match: '"' scope: punctuation.definition.string.begin.json push: inside-string inside-string: - meta_scope: string.quoted.double.json - match: '"' scope: punctuation.definition.string.end.json pop: true - include: string-escape - match: $\n? scope: invalid.illegal.unclosed-string.json pop: true 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 value: - include: constant - include: number - include: string - include: array - include: object - include: comments