diff --git a/extensions/json/OSSREADME.json b/extensions/json/OSSREADME.json new file mode 100644 index 0000000000000000000000000000000000000000..2d12a69da843f834811b024d544149dee6f48f18 --- /dev/null +++ b/extensions/json/OSSREADME.json @@ -0,0 +1,22 @@ +// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: +[{ + "name": "textmate/json.tmbundle", + "version": "0.0.0", + "license": "TextMate Bundle License", + "repositoryURL": "https://github.com/textmate/json.tmbundle", + "licenseDetail": [ + "Copyright (c) textmate-json.tmbundle project authors", + "", + "If not otherwise specified (see below), files in this repository fall under the following license:", + "", + "Permission to copy, use, modify, sell and distribute this", + "software is granted. This software is provided \"as is\" without", + "express or implied warranty, and with no claim as to its", + "suitability for any purpose.", + "", + "An exception is made for files in readable text which contain their own license information,", + "or files where an accompanying file exists (in the same directory) with a \"-license\" suffix added", + "to the base-name name of the original file, and an extension of txt, html, or similar. For example", + "\"tidy\" is accompanied by \"tidy-license.txt\"." + ] +}] diff --git a/extensions/json/package.json b/extensions/json/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b68380b554f88aa4c4fa88674b5c89b34a94ac0b --- /dev/null +++ b/extensions/json/package.json @@ -0,0 +1,19 @@ +{ + "name": "json", + "version": "0.1.0", + "publisher": "vscode", + "engines": { "vscode": "*" }, + "contributes": { + "languages": [{ + "id": "json", + "aliases": ["JSON", "json"], + "extensions": [".json", ".bowerrc", ".jshintrc", ".jscsrc", ".eslintrc"], + "mimetypes": ["application/json"] + }], + "grammars": [{ + // "language": "json" : commented out for now, will add once we have rule for comments + "scopeName": "source.json", + "path": "./syntaxes/JSON.tmLanguage" + }] + } +} \ No newline at end of file diff --git a/extensions/json/syntaxes/JSON.tmLanguage b/extensions/json/syntaxes/JSON.tmLanguage new file mode 100644 index 0000000000000000000000000000000000000000..b158162b2a73a498723b6172c79356df7978d512 --- /dev/null +++ b/extensions/json/syntaxes/JSON.tmLanguage @@ -0,0 +1,264 @@ + + + + + fileTypes + + json + + keyEquivalent + ^~J + name + JSON + patterns + + + include + #value + + + repository + + array + + begin + \[ + beginCaptures + + 0 + + name + punctuation.definition.array.begin.json + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.array.end.json + + + name + meta.structure.array.json + patterns + + + include + #value + + + match + , + name + punctuation.separator.array.json + + + match + [^\s\]] + name + invalid.illegal.expected-array-separator.json + + + + constant + + match + \b(?:true|false|null)\b + name + constant.language.json + + number + + comment + 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 + ) + name + constant.numeric.json + + object + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.dictionary.begin.json + + + comment + a JSON object + end + \} + endCaptures + + 0 + + name + punctuation.definition.dictionary.end.json + + + name + meta.structure.dictionary.json + patterns + + + comment + the JSON object key + include + #string + + + begin + : + beginCaptures + + 0 + + name + punctuation.separator.dictionary.key-value.json + + + end + (,)|(?=\}) + endCaptures + + 1 + + name + punctuation.separator.dictionary.pair.json + + + name + meta.structure.dictionary.value.json + patterns + + + comment + the JSON object value + include + #value + + + match + [^\s,] + name + invalid.illegal.expected-dictionary-separator.json + + + + + match + [^\s\}] + name + invalid.illegal.expected-dictionary-separator.json + + + + string + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.json + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.json + + + name + string.quoted.double.json + patterns + + + 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 + ) + ) + name + constant.character.escape.json + + + match + \\. + name + invalid.illegal.unrecognized-string-escape.json + + + + value + + comment + the 'value' diagram at http://json.org + patterns + + + include + #constant + + + include + #number + + + include + #string + + + include + #array + + + include + #object + + + + + scopeName + source.json + uuid + 0C3868E4-F96B-4E55-B204-1DCB5A20748B + + \ No newline at end of file