From b75064126d599ba4180fa95888bf087385db1b01 Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Fri, 7 Oct 2016 23:31:02 +0200 Subject: [PATCH] Initial commit --- LICENSE | 22 + README.md | 13 + .../Preferences/Comments.tmPreferences | 48 + .../Preferences/Folding.tmPreferences | 19 + .../Preferences/Indentation.tmPreferences | 19 + .../Syntaxes/kaoscript.tmLanguage | 1165 +++++++++++++++++ kaoscript.tmbundle/info.plist | 16 + 7 files changed, 1302 insertions(+) create mode 100755 LICENSE create mode 100644 README.md create mode 100644 kaoscript.tmbundle/Preferences/Comments.tmPreferences create mode 100644 kaoscript.tmbundle/Preferences/Folding.tmPreferences create mode 100644 kaoscript.tmbundle/Preferences/Indentation.tmPreferences create mode 100644 kaoscript.tmbundle/Syntaxes/kaoscript.tmLanguage create mode 100644 kaoscript.tmbundle/info.plist diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..77b2ebb --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2016 Baptiste Augrain + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6fda828 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +[kaoscript/highlight-textmate](https://github.com/kaoscript/highlight-textmate) +================================================================= + +[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](./LICENSE) + +Provides syntax highlighting support for [kaoscript](https://github.com/kaoscript/kaoscript) in [TextMate](https://macromates.com/). + +License +------- + +Copyright © 2016 Baptiste Augrain + +Licensed under the [MIT license](http://www.opensource.org/licenses/mit-license.php). \ No newline at end of file diff --git a/kaoscript.tmbundle/Preferences/Comments.tmPreferences b/kaoscript.tmbundle/Preferences/Comments.tmPreferences new file mode 100644 index 0000000..4b848fa --- /dev/null +++ b/kaoscript.tmbundle/Preferences/Comments.tmPreferences @@ -0,0 +1,48 @@ + + + + + name + Comments + scope + source.ks + settings + + shellVariables + + + name + TM_COMMENT_START + value + // + + + name + TM_COMMENT_START_2 + value + /* + + + name + TM_COMMENT_END_2 + value + */ + + + name + TM_COMMENT_START_3 + value + --- + + + name + TM_COMMENT_END_3 + value + --- + + + + uuid + CE6DB402-355E-4E09-AC79-68027F04F2FB + + diff --git a/kaoscript.tmbundle/Preferences/Folding.tmPreferences b/kaoscript.tmbundle/Preferences/Folding.tmPreferences new file mode 100644 index 0000000..92a81ba --- /dev/null +++ b/kaoscript.tmbundle/Preferences/Folding.tmPreferences @@ -0,0 +1,19 @@ + + + + + name + Folding + scope + source.ks + settings + + foldingStartMarker + \{\s*(//.*)?$|\[\s*(//.*)?$|\(\s*(//.*)?$ + foldingStopMarker + ^\s*\}|^\s*\]|^\s*\) + + uuid + A5AD523A-5272-49C1-958C-A87047BD4AD2 + + diff --git a/kaoscript.tmbundle/Preferences/Indentation.tmPreferences b/kaoscript.tmbundle/Preferences/Indentation.tmPreferences new file mode 100644 index 0000000..ad7d1e6 --- /dev/null +++ b/kaoscript.tmbundle/Preferences/Indentation.tmPreferences @@ -0,0 +1,19 @@ + + + + + name + Indentation + scope + source.ks + settings + + decreaseIndentPattern + ^\s*(?:\s*/[*].*[*]/\s*)*[})\]] + increaseIndentPattern + \{[^}"\'`]*$|\[[^\]"\'`]*$|\([^)"\'`]*$ + + uuid + A359954E-31C6-413B-8104-0B9699B530DD + + diff --git a/kaoscript.tmbundle/Syntaxes/kaoscript.tmLanguage b/kaoscript.tmbundle/Syntaxes/kaoscript.tmLanguage new file mode 100644 index 0000000..0e91a74 --- /dev/null +++ b/kaoscript.tmbundle/Syntaxes/kaoscript.tmLanguage @@ -0,0 +1,1165 @@ + + + + + name + kaoscript + scopeName + source.ks + fileTypes + + ks + + uuid + 371123EB-AE4B-471E-BB5C-1AB23093F1C9 + patterns + + + include + #string + + + include + #number + + + include + #attribute + + + include + #function-declaration + + + include + #function-arrow + + + include + #new-instance + + + include + #class-declaration + + + include + #enum-declaration + + + include + #impl-declaration + + + include + #import-declaration + + + include + #comment + + + include + #method-call + + + include + #function-call + + + include + #variable + + + include + #modifier + + + include + #keyword + + + include + #constant + + + include + #regex + + + include + #operator + + + include + #enum-expression + + + include + #comma + + + include + #period + + + repository + + arguments + + begin + \( + beginCaptures + + 0 + + name + punctuation.definition.arguments.begin.bracket.round.ks + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.arguments.end.bracket.round.ks + + + patterns + + + include + $self + + + + attribute + + name + meta.attribute.ks + begin + #!?\[ + end + \] + patterns + + + include + #string + + + + class-declaration + + name + meta.class.ks + match + \b(class)(?:\s+([a-zA-Z_$][\w$]*))(?:\s+(extends)\s+([a-zA-Z_$][\w$]*))? + captures + + 1 + + name + storage.type.class.ks + + 2 + + name + entity.name.type.class.ks + + 3 + + name + storage.modifier.ks + + 4 + + name + entity.other.inherited-class.ks + + + + comma + + name + meta.delimiter.object.comma.ks + match + , + + comment + + patterns + + + name + comment.block.documentation.ks + begin + /\*\*(?!/) + beginCaptures + + 0 + + name + punctuation.definition.comment.ks + + + end + \*/ + endCaptures + + 0 + + name + punctuation.definition.comment.ks + + + patterns + + + include + #comment_block + + + + + begin + (^[ \t]+)?(?=//) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.ks + + + end + (?=$) + patterns + + + name + comment.line.double-slash.ks + begin + // + beginCaptures + + 0 + + name + punctuation.definition.comment.ks + + + end + (?=$) + + + + + name + comment.block.header + begin + --- + beginCaptures + + 0 + + name + punctuation.definition.comment.ks + + + end + --- + endCaptures + + 0 + + name + punctuation.definition.comment.ks + + + + + include + #comment_block + + + + comment_block + + name + comment.block.ks + begin + /\* + beginCaptures + + 0 + + name + punctuation.definition.comment.ks + + + end + \*/ + endCaptures + + 0 + + name + punctuation.definition.comment.ks + + + patterns + + + include + #comment_block + + + + constant + + patterns + + + name + constant.language.boolean.$1.ks + match + (?<![$\.])\b(true|false)(?!\s*:)\b + + + name + constant.language.null.ks + match + (?<![$\.])\b(null)(?!\s*:)\b + + + name + constant.language.ks + match + (?<![$\.])\b(Infinity|NaN)(?!\s*:)\b + + + name + support.class.ks + match + (?<![$\.])\b(Array|array|Boolean|bool|class|enum|Function|func|Number|number|Object|object|RegExp|String|string)(?!\s*:)\b + + + + enum-declaration + + name + meta.enum.ks + match + \b(enum)(?:\s+([a-zA-Z_$][\w$]*)) + captures + + 1 + + name + storage.type.enum.ks + + 2 + + name + entity.name.type.enum.ks + + + + enum-expression + + match + ([a-zA-Z_$][\w$]*)(::)([a-zA-Z_$][\w$]*) + captures + + 1 + + name + variable.other.enum.ks + + 2 + + name + constant.language.delimiter.enum.ks + + 3 + + name + variable.other.enum.ks + + + + function-arrow + + match + (=>) + captures + + 0 + + name + meta.function.arrow.ks + + 1 + + name + storage.type.function.arrow.ks + + + + function-body + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.function.body.begin.bracket.curly.ks + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.function.body.end.bracket.curly.ks + + + patterns + + + include + $self + + + + function-call + + begin + ([\w$]+)\s*(?=\() + beginCaptures + + 1 + + patterns + + + name + entity.name.function.ks + match + [a-zA-Z_$][\w$]* + + + name + invalid.illegal.identifier.ks + match + \d[\w$]* + + + + + end + (?<=\)) + patterns + + + include + #arguments + + + + function-declaration + + begin + \b(func)\b(?:\s+([a-zA-Z_$][\w$]*))?\( + end + (?<=}) + captures + + 1 + + name + storage.type.function.ks + + 2 + + name + entity.name.function.ks + + + patterns + + + include + #function-parameters + + + include + #comment + + + include + #function-body + + + + function-parameters + + begin + \( + beginCaptures + + 0 + + name + punctuation.definition.parameters.begin.bracket.round.ks + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.parameters.end.bracket.round.ks + + + patterns + + + match + (\.\.\.)([a-zA-Z_$][\w$]*) + captures + + 1 + + name + keyword.operator.spread.ks + + 2 + + name + variable.parameter.rest.function.ks + + + + + include + $self + + + name + variable.parameter.function.ks + match + [a-zA-Z_$][\w$]* + + + + impl-declaration + + name + meta.class.ks + match + \b(impl)(?:\s+([a-zA-Z_$][\w$]*)) + captures + + 1 + + name + storage.type.class.ks + + 2 + + name + entity.name.type.class.ks + + + + import-declaration + + patterns + + + begin + (?<![$\.])\b(import)\s*\{ + beginCaptures + + 1 + + name + keyword.control.ks + + + end + (?<=}) + patterns + + + name + keyword.ks + match + (?<![$\.])\bas\b + + + match + \b(from)\s*([^:].*?)\s*$ + captures + + 1 + + name + keyword.ks + + 2 + + name + string.ks + + + + + name + meta.delimiter.object.comma.ks + match + , + + + name + constant.language.import-all.ks + match + \* + + + + + begin + (?<![$\.])\b(import)(?!\s*[:\(\{])\b + beginCaptures + + 1 + + name + keyword.control.ks + + + end + (?=$) + patterns + + + name + keyword.ks + match + (?<![$\.])\bas\b + + + match + \b(from)\s*([^:].*?)\s*$ + captures + + 1 + + name + keyword.ks + + 2 + + name + string.ks + + + + + name + meta.delimiter.object.comma.ks + match + , + + + name + constant.language.import-all.ks + match + \* + + + + + + keyword + + patterns + + + name + keyword.control.trycatch.ks + match + (?<![$\.])\b(catch|finally|throw|try)\b(?!\s*:|\$) + + + name + keyword.control.loop.ks + match + (?<![$\.])\b(break|continue|do|for|until|while)\b(?!\s*:|\$) + + + name + keyword.control.flow.ks + match + (?<![$\.])\b(return)\b(?!\s*:|\$) + + + name + keyword.control.conditional.ks + match + (?<![$\.])\b(else|if|switch|unless)\b(?!\s*:|\$) + + + name + keyword.control.ks + match + (?<![$\.])\b(await|export|extern|import|include|require)\b(?!\s*:|\$) + + + name + keyword.ks + match + (?<![$\.])\b(as|by|from|in|is|of|til|to|with)\b(?!\s*:|\$) + + + + method-call + + begin + (\.)\s*([\w$]+)\s*(?=\() + beginCaptures + + 1 + + name + meta.delimiter.method.period.ks + + 2 + + patterns + + + name + entity.name.function.ks + match + [a-zA-Z_$][\w$]* + + + name + invalid.illegal.identifier.ks + match + \d[\w$]* + + + + + end + (?<=\)) + patterns + + + include + #arguments + + + + modifier + + name + storage.modifier.ks + match + (?<![$\.])\b(async|extends|final|private|protected|public|static)(?!\s*:)\b + + new-instance + + name + meta.class.instance.constructor.ks + match + (new)\s+([\w$]+[\w\.$]*) + captures + + 1 + + name + keyword.operator.new.ks + + 2 + + name + entity.name.type.instance.ks + patterns + + + name + meta.delimiter.property.period.ks + match + \. + + + + + + number + + patterns + + + name + constant.numeric.binary.ks + match + \b0(b|B)[01]+\b + + + name + constant.numeric.octal.ks + match + \b0(o|O)[0-7]+\b + + + name + constant.numeric.hex.ks + match + \b0(x|X)[0-9a-fA-F]+\b + + + match + \b[0-9]+(?:(\.)[0-9]+)?\b + captures + + 0 + + name + constant.numeric.decimal.ks + + 1 + + name + meta.delimiter.decimal.period.ks + + + + + + operator + + patterns + + + name + keyword.operator.assignment.compound.ks + match + \+=|-=|\*=|(?<!\()/=|%=|\?= + + + name + keyword.operator.assignment.compound.bitwise.ks + match + <<=|>>=|>>=|&=|\^=|\|= + + + name + keyword.operator.comparison.ks + match + <=|>=|==|<|>|!= + + + name + keyword.operator.logical.ks + match + \|\||&&|! + + + name + keyword.operator.bitwise.ks + match + \^|~|&|\| + + + name + keyword.operator.assignment.ks + match + =|:= + + + name + keyword.operator.decrement.ks + match + -- + + + name + keyword.operator.increment.ks + match + \+\+ + + + name + keyword.operator.spread.ks + match + \.\.\. + + + name + keyword.operator.ks + match + \+|-|\*|/|%|\? + + + + period + + name + meta.delimiter.method.period.ks + match + \. + + regex + + name + string.regexp.ks + begin + (?<=[\[=(?:+,!]|^|return|=>|&&|\|\|)\s*(/)(?![/*+?])(?=.*/) + beginCaptures + + 1 + + name + punctuation.definition.string.begin.ks + + + end + (/)[gimuy]* + endCaptures + + 1 + + name + punctuation.definition.string.end.ks + + + patterns + + + include + source.js.regexp + + + + string + + patterns + + + name + string.quoted.single.ks + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ks + + + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.ks + + + patterns + + + include + #string-escapes + + + + + name + string.quoted.double.ks + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ks + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.ks + + + patterns + + + include + #string-escapes + + + + + begin + ` + beginCaptures + + 0 + + name + punctuation.definition.string.template.begin.ks + + + end + ` + endCaptures + + 0 + + name + punctuation.definition.string.template.end.ks + + + patterns + + + include + #template + + + include + #string-escapes + + + name + string.template.ks + match + (?:[^\\`]|\\(?:[^\(]|$))* + + + + + + string-escapes + + patterns + + + name + invalid.illegal.unicode-escape.ks + match + \\u(?![A-Fa-f0-9]{4}|{[A-Fa-f0-9]+})[^'"]* + + + name + constant.character.escape.ks + match + \\u(?:[A-Fa-f0-9]{4}|({)([A-Fa-f0-9]+)(})) + captures + + 1 + + name + punctuation.definition.unicode-escape.begin.bracket.curly.ks + + 2 + + patterns + + + name + invalid.illegal.unicode-escape.ks + match + [A-Fa-f\d]{7,}|(?!10)[A-Fa-f\d]{6} + + + + 3 + + name + punctuation.definition.unicode-escape.end.bracket.curly.ks + + + + + name + constant.character.escape.ks + match + \\(x\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.) + + + + template + + begin + \\\( + beginCaptures + + 0 + + name + punctuation.definition.template-expression.begin.ks + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.template-expression.end.ks + + + patterns + + + include + $self + + + + variable + + patterns + + + name + variable.language.ks + match + (?<![$\.])\b(?<!\$)(super|this)(?!\s*:|\$)\b + + + name + storage.type.var.ks + match + (?<![$\.])\b(let|const)(?!\s*:|\$)\b + + + + + + \ No newline at end of file diff --git a/kaoscript.tmbundle/info.plist b/kaoscript.tmbundle/info.plist new file mode 100644 index 0000000..81ca375 --- /dev/null +++ b/kaoscript.tmbundle/info.plist @@ -0,0 +1,16 @@ + + + + + contactEmailRot13 + qnvlnz@mbxhtha.bet + contactName + Baptiste Augrain + description + Support for <a href="https://github.com/kaoscript/kaoscript">kaoscript</a>. + name + Kaoscript + uuid + DDCBDB49-58EF-4A09-B664-FEC3D84D352D + +