From 6d227c6b4f14684264265e61e7c1a319753b1c9d Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Thu, 29 Jul 2021 13:14:21 -0700 Subject: [PATCH] Add Cue package following README.md#adding-a-new-language Signed-off-by: Stephen Gutekanst --- Cue/SOURCE | 1 + Cue/VERSION | 1 + Cue/cue.tmLanguage | 1717 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 5 +- 4 files changed, 1722 insertions(+), 2 deletions(-) create mode 100644 Cue/SOURCE create mode 100644 Cue/VERSION create mode 100644 Cue/cue.tmLanguage diff --git a/Cue/SOURCE b/Cue/SOURCE new file mode 100644 index 0000000000..92867cb0ac --- /dev/null +++ b/Cue/SOURCE @@ -0,0 +1 @@ +https://github.com/cue-sh/vscode-cue/blob/master/syntaxes/cue.tmLanguage.json diff --git a/Cue/VERSION b/Cue/VERSION new file mode 100644 index 0000000000..9d01277f16 --- /dev/null +++ b/Cue/VERSION @@ -0,0 +1 @@ +7bd21882dc0e5299271597f18f2740394714cfea diff --git a/Cue/cue.tmLanguage b/Cue/cue.tmLanguage new file mode 100644 index 0000000000..f5c294f3ae --- /dev/null +++ b/Cue/cue.tmLanguage @@ -0,0 +1,1717 @@ + + + + + $schema + https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json + name + CUE + patterns + + + include + #whitespace + + + include + #comment + + + captures + + 1 + + name + keyword.other.package + + 2 + + name + entity.name.namespace + + + match + (?<![\p{L}\p{Nd}_\$\#])(package)[ \t]+([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*)(?![\p{L}\p{Nd}_\$\#]) + + + patterns + + + begin + (?<![\p{L}\p{Nd}_\$\#])(import)[ \t]+(\() + beginCaptures + + 1 + + name + keyword.other.import + + 2 + + name + punctuation.section.parens.begin + + + end + \) + endCaptures + + 0 + + name + punctuation.section.parens.end + + + name + meta.imports + patterns + + + include + #whitespace + + + include + #comment + + + captures + + 1 + + name + entity.name.namespace + + 2 + + name + punctuation.definition.string.begin + + 3 + + name + string.quoted.double-import + + 4 + + name + punctuation.colon + + 5 + + name + entity.name + + 6 + + name + punctuation.definition.string.end + + + match + (?:([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*)[ \t]+)?(")([^:"]+)(?:(:)([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*))?(") + name + meta.import-spec + + + match + ; + name + punctuation.separator + + + include + #invalid_in_parens + + + + + captures + + 1 + + name + keyword.other.import + + 2 + + name + entity.name.namespace + + 3 + + name + punctuation.definition.string.begin + + 4 + + name + string.quoted.double-import + + 5 + + name + punctuation.colon + + 6 + + name + entity.name + + 7 + + name + punctuation.definition.string.end + + + match + (?<![\p{L}\p{Nd}_\$\#])(import)[ \t]+(?:([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*)[ \t]+)?(")([^:"]+)(?:(:)([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*))?(") + name + meta.import + + + + + include + #punctuation_comma + + + include + #declaration + + + include + #invalid_in_braces + + + repository + + attribute_element + + patterns + + + begin + ([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*|_[\p{L}\p{Nd}_\$\#]+)(=) + beginCaptures + + 1 + + name + variable.other + + 2 + + name + punctuation.bind + + + end + (?=[,\)]) + patterns + + + include + #attribute_string + + + + + begin + ([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*|_[\p{L}\p{Nd}_\$\#]+)(\() + beginCaptures + + 1 + + name + variable.other + + 2 + + name + punctuation.attribute-elements.begin + + + end + \) + endCaptures + + 0 + + name + punctuation.attribute-elements.end + + + patterns + + + include + #punctuation_comma + + + include + #attribute_element + + + + + include + #attribute_string + + + + attribute_string + + patterns + + + include + #string + + + match + [^\n,"'#=\(\)]+ + name + string.unquoted + + + match + [^,\)]+ + name + invalid + + + + comment + + patterns + + + captures + + 1 + + name + punctuation.definition.comment + + + match + (//).*$\n? + name + comment.line + + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment + + + end + \*/ + name + comment.block + + + + declaration + + patterns + + + begin + (@)([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*|_[\p{L}\p{Nd}_\$\#]+)(\() + beginCaptures + + 1 + + name + punctuation.definition.annotation + + 2 + + name + variable.annotation + + 3 + + name + punctuation.attribute-elements.begin + + + end + \) + endCaptures + + 0 + + name + punctuation.attribute-elements.end + + + name + meta.annotation + patterns + + + include + #punctuation_comma + + + include + #attribute_element + + + + + match + (?<!:)::(?!:) + name + punctuation.isa + + + include + #punctuation_colon + + + match + \? + name + punctuation.option + + + match + (?<![=!><])=(?![=~]) + name + punctuation.bind + + + match + <- + name + punctuation.arrow + + + include + #expression + + + + expression + + patterns + + + patterns + + + captures + + 1 + + name + keyword.control.for + + 2 + + name + variable.other + + 3 + + name + punctuation.separator + + 4 + + name + variable.other + + 5 + + name + keyword.control.in + + + match + (?<![\p{L}\p{Nd}_\$\#])(for)[ \t]+([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*|_[\p{L}\p{Nd}_\$\#]+)(?:[ \t]*(,)[ \t]*([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*|_[\p{L}\p{Nd}_\$\#]+))?[ \t]+(in)(?![\p{L}\p{Nd}_\$\#]) + + + match + (?<![\p{L}\p{Nd}_\$\#])if(?![\p{L}\p{Nd}_\$\#]) + name + keyword.control.conditional + + + captures + + 1 + + name + keyword.control.let + + 2 + + name + variable.other + + 3 + + name + punctuation.bind + + + match + (?<![\p{L}\p{Nd}_\$\#])(let)[ \t]+([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*|_[\p{L}\p{Nd}_\$\#]+)[ \t]*(=)(?![=]) + + + + + patterns + + + match + [\+\-\*]|/(?![/*]) + name + keyword.operator + + + match + (?<![\p{L}\p{Nd}_\$\#])(?:div|mod|quo|rem)(?![\p{L}\p{Nd}_\$\#]) + name + keyword.operator.word + + + match + =[=~]|![=~]|<=|>=|[<](?![-=])|[>](?![=]) + name + keyword.operator.comparison + + + match + &{2}|\|{2}|!(?![=~]) + name + keyword.operator.logical + + + match + &(?!&)|\|(?!\|) + name + keyword.operator.set + + + + + captures + + 1 + + name + punctuation.accessor + + 2 + + name + variable.other.member + + + match + (?<!\.)(\.)([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*|_[\p{L}\p{Nd}_\$\#]+)(?![\p{L}\p{Nd}_\$\#]) + + + patterns + + + match + (?<![\p{L}\p{Nd}_\$\#])_(?!\|)(?![\p{L}\p{Nd}_\$\#]) + name + constant.language.top + + + match + (?<![\p{L}\p{Nd}_\$\#])_\|_(?![\p{L}\p{Nd}_\$\#]) + name + constant.language.bottom + + + match + (?<![\p{L}\p{Nd}_\$\#])null(?![\p{L}\p{Nd}_\$\#]) + name + constant.language.null + + + match + (?<![\p{L}\p{Nd}_\$\#])(?:true|false)(?![\p{L}\p{Nd}_\$\#]) + name + constant.language.bool + + + patterns + + + patterns + + + match + (?<![\p{L}\p{Nd}_\.])[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?(?:[eE][\+\-]?[0-9](?:_?[0-9])*)?(?![\p{L}\p{Nd}_\.]) + name + constant.numeric.float.decimal + + + match + (?<![\p{L}\p{Nd}_\.])[0-9](?:_?[0-9])*[eE][\+\-]?[0-9](?:_?[0-9])*(?![\p{L}\p{Nd}_\.]) + name + constant.numeric.float.decimal + + + match + (?<![\p{L}\p{Nd}_\.])\.[0-9](?:_?[0-9])*(?:[eE][\+\-]?[0-9](?:_?[0-9])*)?(?![\p{L}\p{Nd}_\.]) + name + constant.numeric.float.decimal + + + + + patterns + + + patterns + + + match + (?<![\p{L}\p{Nd}_\.])(?:0|[1-9](?:_?[0-9])*)(?:\.[0-9](?:_?[0-9])*)?(?:[KMGTPEYZ]i?)(?![\p{L}\p{Nd}_\.]) + name + constant.numeric.integer.other + + + match + (?<![\p{L}\p{Nd}_\.])\.[0-9](?:_?[0-9])*(?:[KMGTPEYZ]i?)(?![\p{L}\p{Nd}_\.]) + name + constant.numeric.integer.other + + + + + match + (?<![\p{L}\p{Nd}_\.])(?:0|[1-9](?:_?[0-9])*)(?![\p{L}\p{Nd}_\.]) + name + constant.numeric.integer.decimal + + + match + (?<![\p{L}\p{Nd}_\.])0b[0-1](?:_?[0-1])*(?![\p{L}\p{Nd}_\.]) + name + constant.numeric.integer.binary + + + match + (?<![\p{L}\p{Nd}_\.])0[xX][0-9a-fA-F](?:_?[0-9a-fA-F])*(?![\p{L}\p{Nd}_\.]) + name + constant.numeric.integer.hexadecimal + + + match + (?<![\p{L}\p{Nd}_\.])0o?[0-7](?:_?[0-7])*(?![\p{L}\p{Nd}_\.]) + name + constant.numeric.integer.octal + + + + + + + include + #string + + + match + (?<![\p{L}\p{Nd}_\$\#])(?:bool|u?int(?:8|16|32|64|128)?|float(?:32|64)?|string|bytes|number|rune)(?![\p{L}\p{Nd}_\$\#]) + name + support.type + + + patterns + + + begin + (?<![\p{L}\p{Nd}_\$\#])(len|close|and|or)(\() + beginCaptures + + 1 + + name + support.function + + 2 + + name + punctuation.section.parens.begin + + + end + \) + endCaptures + + 0 + + name + punctuation.section.parens.end + + + name + meta.function-call + patterns + + + include + #whitespace + + + include + #comment + + + include + #punctuation_comma + + + include + #expression + + + include + #invalid_in_parens + + + + + begin + (?<![\p{L}\p{Nd}_\$\#])([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*)(\.)(\p{Lu}[\p{L}\p{Nd}_\$\#]*)(\() + beginCaptures + + 1 + + name + support.module + + 2 + + name + punctuation + + 3 + + name + support.function + + 4 + + name + punctuation.section.parens.begin + + + end + \) + endCaptures + + 0 + + name + punctuation.section.parens.end + + + name + meta.function-call + patterns + + + include + #whitespace + + + include + #comment + + + include + #punctuation_comma + + + include + #expression + + + include + #invalid_in_parens + + + + + + + match + (?<![\p{L}\p{Nd}_\$\#])(?:[\p{L}\$\#][\p{L}\p{Nd}_\$\#]*|_[\p{L}\p{Nd}_\$\#]+)(?![\p{L}\p{Nd}_\$\#]) + name + variable.other + + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.struct.begin + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.struct.end + + + name + meta.struct + patterns + + + include + #whitespace + + + include + #comment + + + include + #punctuation_comma + + + include + #punctuation_ellipsis + + + include + #declaration + + + include + #invalid_in_braces + + + + + begin + \[ + beginCaptures + + 0 + + name + punctuation.section.brackets.begin + + + end + \] + endCaptures + + 0 + + name + punctuation.section.brackets.end + + + name + meta.brackets + patterns + + + include + #whitespace + + + include + #comment + + + include + #punctuation_colon + + + include + #punctuation_comma + + + include + #punctuation_ellipsis + + + captures + + 1 + + name + variable.other + + 2 + + name + punctuation.alias + + + match + ([\p{L}\$\#][\p{L}\p{Nd}_\$\#]*|_[\p{L}\p{Nd}_\$\#]+)[ \t]*(=) + + + include + #expression + + + match + [^\]]+ + name + invalid + + + + + begin + \( + beginCaptures + + 0 + + name + punctuation.section.parens.begin + + + end + \) + endCaptures + + 0 + + name + punctuation.section.parens.end + + + name + meta.parens + patterns + + + include + #whitespace + + + include + #comment + + + include + #punctuation_comma + + + include + #expression + + + include + #invalid_in_parens + + + + + + + + invalid_in_braces + + match + [^\}]+ + name + invalid + + invalid_in_parens + + match + [^\)]+ + name + invalid + + punctuation_colon + + match + (?<!:):(?!:) + name + punctuation.colon + + punctuation_comma + + match + , + name + punctuation.separator + + punctuation_ellipsis + + match + (?<!\.)\.{3}(?!\.) + name + punctuation.ellipsis + + string + + patterns + + + begin + #""" + beginCaptures + + 0 + + name + punctuation.definition.string.begin + + + contentName + string.quoted.double-multiline + end + """# + endCaptures + + 0 + + name + punctuation.definition.string.end + + + name + meta.string + patterns + + + match + \\#(?:"""|/|\\|[abfnrtv]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape + + + match + \\#(?:[0-7]{3}|x[0-9A-Fa-f]{2}) + name + invalid.illegal + + + begin + \\#\( + beginCaptures + + 0 + + name + punctuation.section.interpolation.begin + + + contentName + source.cue.embedded + end + \) + endCaptures + + 0 + + name + punctuation.section.interpolation.end + + + name + meta.interpolation + patterns + + + include + #whitespace + + + include + #expression + + + include + #invalid_in_parens + + + + + match + \\#. + name + invalid.illegal + + + + + begin + #" + beginCaptures + + 0 + + name + punctuation.definition.string.begin + + + contentName + string.quoted.double + end + "# + endCaptures + + 0 + + name + punctuation.definition.string.end + + + name + meta.string + patterns + + + match + \\#(?:"|/|\\|[abfnrtv]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape + + + match + \\#(?:[0-7]{3}|x[0-9A-Fa-f]{2}) + name + invalid.illegal + + + begin + \\#\( + beginCaptures + + 0 + + name + punctuation.section.interpolation.begin + + + contentName + source.cue.embedded + end + \) + endCaptures + + 0 + + name + punctuation.section.interpolation.end + + + name + meta.interpolation + patterns + + + include + #whitespace + + + include + #expression + + + include + #invalid_in_parens + + + + + match + \\#. + name + invalid.illegal + + + + + begin + #''' + beginCaptures + + 0 + + name + punctuation.definition.string.begin + + + contentName + string.quoted.single-multiline + end + '''# + endCaptures + + 0 + + name + punctuation.definition.string.end + + + name + meta.string + patterns + + + match + \\#(?:'''|/|\\|[abfnrtv]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape + + + match + \\#(?:[0-7]{3}|x[0-9A-Fa-f]{2}) + name + constant.character.escape + + + begin + \\#\( + beginCaptures + + 0 + + name + punctuation.section.interpolation.begin + + + contentName + source.cue.embedded + end + \) + endCaptures + + 0 + + name + punctuation.section.interpolation.end + + + name + meta.interpolation + patterns + + + include + #whitespace + + + include + #expression + + + include + #invalid_in_parens + + + + + match + \\#. + name + invalid.illegal + + + + + begin + #' + beginCaptures + + 0 + + name + punctuation.definition.string.begin + + + contentName + string.quoted.single + end + '# + endCaptures + + 0 + + name + punctuation.definition.string.end + + + name + meta.string + patterns + + + match + \\#(?:'|/|\\|[abfnrtv]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape + + + match + \\#(?:[0-7]{3}|x[0-9A-Fa-f]{2}) + name + constant.character.escape + + + begin + \\#\( + beginCaptures + + 0 + + name + punctuation.section.interpolation.begin + + + contentName + source.cue.embedded + end + \) + endCaptures + + 0 + + name + punctuation.section.interpolation.end + + + name + meta.interpolation + patterns + + + include + #whitespace + + + include + #expression + + + include + #invalid_in_parens + + + + + match + \\#. + name + invalid.illegal + + + + + begin + """ + beginCaptures + + 0 + + name + punctuation.definition.string.begin + + + contentName + string.quoted.double-multiline + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end + + + name + meta.string + patterns + + + match + \\(?:"""|/|\\|[abfnrtv]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape + + + match + \\(?:[0-7]{3}|x[0-9A-Fa-f]{2}) + name + invalid.illegal + + + begin + \\\( + beginCaptures + + 0 + + name + punctuation.section.interpolation.begin + + + contentName + source.cue.embedded + end + \) + endCaptures + + 0 + + name + punctuation.section.interpolation.end + + + name + meta.interpolation + patterns + + + include + #whitespace + + + include + #expression + + + include + #invalid_in_parens + + + + + match + \\. + name + invalid.illegal + + + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin + + + contentName + string.quoted.double + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end + + + name + meta.string + patterns + + + match + \\(?:"|/|\\|[abfnrtv]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape + + + match + \\(?:[0-7]{3}|x[0-9A-Fa-f]{2}) + name + invalid.illegal + + + begin + \\\( + beginCaptures + + 0 + + name + punctuation.section.interpolation.begin + + + contentName + source.cue.embedded + end + \) + endCaptures + + 0 + + name + punctuation.section.interpolation.end + + + name + meta.interpolation + patterns + + + include + #whitespace + + + include + #expression + + + include + #invalid_in_parens + + + + + match + \\. + name + invalid.illegal + + + + + begin + ''' + beginCaptures + + 0 + + name + punctuation.definition.string.begin + + + contentName + string.quoted.single-multiline + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end + + + name + meta.string + patterns + + + match + \\(?:'''|/|\\|[abfnrtv]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape + + + match + \\(?:[0-7]{3}|x[0-9A-Fa-f]{2}) + name + constant.character.escape + + + begin + \\\( + beginCaptures + + 0 + + name + punctuation.section.interpolation.begin + + + contentName + source.cue.embedded + end + \) + endCaptures + + 0 + + name + punctuation.section.interpolation.end + + + name + meta.interpolation + patterns + + + include + #whitespace + + + include + #expression + + + include + #invalid_in_parens + + + + + match + \\. + name + invalid.illegal + + + + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin + + + contentName + string.quoted.single + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end + + + name + meta.string + patterns + + + match + \\(?:'|/|\\|[abfnrtv]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape + + + match + \\(?:[0-7]{3}|x[0-9A-Fa-f]{2}) + name + constant.character.escape + + + begin + \\\( + beginCaptures + + 0 + + name + punctuation.section.interpolation.begin + + + contentName + source.cue.embedded + end + \) + endCaptures + + 0 + + name + punctuation.section.interpolation.end + + + name + meta.interpolation + patterns + + + include + #whitespace + + + include + #expression + + + include + #invalid_in_parens + + + + + match + \\. + name + invalid.illegal + + + + + begin + ` + beginCaptures + + 0 + + name + punctuation.definition.string.begin + + + contentName + string.quoted.backtick + end + ` + endCaptures + + 0 + + name + punctuation.definition.string.end + + + name + meta.string + + + + whitespace + + match + [ \t\r\n]+ + + + scopeName + source.cue + + diff --git a/README.md b/README.md index 22d48f4d4e..ad574ffe55 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ with different licenses for files generated by following the steps in a director | Coq/ | MIT | [whitequark/Sublime-Coq](https://github.com/whitequark/Sublime-Coq) | | Zig/ | MIT | [ziglang/sublime-zig-language](https://github.com/ziglang/sublime-zig-language) | | TOML/ | MIT | [sourcegraph/TOML-syntax-highlighting](https://github.com/sourcegraph/TOML-syntax-highlighting) | -| Terraform/ | MIT | [alexlouden/Terraform.tmLanguage](https://github.com/alexlouden/Terraform.tmLanguage) +| Terraform/ | MIT | [alexlouden/Terraform.tmLanguage](https://github.com/alexlouden/Terraform.tmLanguage) | | GraphQL/ | MIT | [rvantonder/gql-sublimetext-yolo](https://github.com/rvantonder/gql-sublimetext-yolo) | | DreamMaker/ | MIT | [Wirewraith/sublime-DM](https://github.com/Wirewraith/sublime-DM) | | Kotlin/ | Apache License 2.0 | [vkostyukov/kotlin-sublime-package](https://github.com/vkostyukov/kotlin-sublime-package) | @@ -90,7 +90,7 @@ with different licenses for files generated by following the steps in a director | COBOL/ | Apache License 2.0 | [bitlang/sublime_cobol](https://bitbucket.org/bitlang/sublime_cobol) | | Dart/ | BSD 3-Clause License | [guillermooo/dart-sublime-bundle-releases](http://github.com/guillermooo/dart-sublime-bundle-releases) | | Cuda/ | BSD 3-Clause License | [harrism/sublimetext-cuda-cpp](https://github.com/harrism/sublimetext-cuda-cpp) | -| Thrift/ | Common License* | [airamare01/thrift.tmbundle](https://github.com/airamare01/thrift.tmbundle) | +| Thrift/ | Common License* | [airamare01/thrift.tmbundle](https://github.com/airamare01/thrift.tmbundle) | | Smarty/ | Common License* | [amitsnyderman/sublime-smarty](https://github.com/amitsnyderman/sublime-smarty/blob/master/Syntaxes/Smarty.sublime-syntax) | | Postscript/ | Common License* | [textmate/postscript.tmbundle](https://github.com/textmate/postscript.tmbundle) | | Plist/ | Common License* | [textmate/property-list.tmbundle](https://github.com/textmate/property-list.tmbundle) | @@ -124,6 +124,7 @@ with different licenses for files generated by following the steps in a director | Ethereum/ | MIT License | [davidhq/SublimeEthereum](https://github.com/davidhq/SublimeEthereum) | | Cg/ | MIT License | [noct/sublime-shaders](https://github.com/noct/sublime-shaders) | | Elixir/ | MIT License | [princemaple/elixir-sublime-syntax](https://github.com/princemaple/elixir-sublime-syntax) | +| Cue | MIT License | [cue-sh/vscode-cue](https://github.com/cue-sh/vscode-cue) | ### Common License*