diff --git a/Packages/Swift/Comments.tmPreferences b/Packages/Swift/Comments.tmPreferences new file mode 100644 index 0000000..8c2748a --- /dev/null +++ b/Packages/Swift/Comments.tmPreferences @@ -0,0 +1,36 @@ + + + + + name + Comments + scope + source.swift + settings + + shellVariables + + + name + TM_COMMENT_START + value + // + + + name + TM_COMMENT_START_2 + value + /* + + + name + TM_COMMENT_END_2 + value + */ + + + + uuid + e4dfd8f5-d016-4899-b491-d46e5d32b3a3 + + diff --git a/Packages/Swift/LICENSE b/Packages/Swift/LICENSE new file mode 100644 index 0000000..c4987dd --- /dev/null +++ b/Packages/Swift/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Matthew Alexander + +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/Packages/Swift/README.md b/Packages/Swift/README.md new file mode 100644 index 0000000..c656e41 --- /dev/null +++ b/Packages/Swift/README.md @@ -0,0 +1,41 @@ +# Swift-Sublime-Package + +Cloned from [Swift-Sublime-Package](https://github.com/quiqueg/Swift-Sublime-Package). + +A [Sublime Text](http://www.sublimetext.com/) package for the [Swift programming language](https://developer.apple.com/swift/) + +## Installation + +### via Package Control (Recommended) +[Package Control](http://wbond.net/sublime_packages/package_control) is a package manager for Sublime Text 2 & 3. If you don't already have it installed, follow the [installation instructions here](https://sublime.wbond.net/installation). + +Once Package Control is installed, restart Sublime and follow these steps: +* Open the Command Pallette (`cmd + shift + p` on OS X / Linux or `ctrl + shift + p` on Windows) +* Type "install" and select "Package Control: Install Package" +* Type "swift" and press Enter + +All done! Package Control will automatically update the package whenever there's a new version. + +## License + +The MIT License (MIT) + +Copyright (c) 2014 Matthew Alexander + +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/Packages/Swift/Snippets/Array.sublime-snippet b/Packages/Swift/Snippets/Array.sublime-snippet new file mode 100644 index 0000000..7ee49a3 --- /dev/null +++ b/Packages/Swift/Snippets/Array.sublime-snippet @@ -0,0 +1,7 @@ + + +]]> + Array + source.swift + diff --git a/Packages/Swift/Snippets/Dictionary.sublime-snippet b/Packages/Swift/Snippets/Dictionary.sublime-snippet new file mode 100644 index 0000000..f5019ab --- /dev/null +++ b/Packages/Swift/Snippets/Dictionary.sublime-snippet @@ -0,0 +1,7 @@ + + +]]> + Dictionary + source.swift + diff --git a/Packages/Swift/Snippets/class-var.sublime-snippet b/Packages/Swift/Snippets/class-var.sublime-snippet new file mode 100644 index 0000000..ba1d556 --- /dev/null +++ b/Packages/Swift/Snippets/class-var.sublime-snippet @@ -0,0 +1,8 @@ + + + cv + source.swift + class var ... + diff --git a/Packages/Swift/Snippets/class.sublime-snippet b/Packages/Swift/Snippets/class.sublime-snippet new file mode 100644 index 0000000..cac1e7c --- /dev/null +++ b/Packages/Swift/Snippets/class.sublime-snippet @@ -0,0 +1,10 @@ + + + class + source.swift + class ... + diff --git a/Packages/Swift/Snippets/deinit.sublime-snippet b/Packages/Swift/Snippets/deinit.sublime-snippet new file mode 100644 index 0000000..0b26264 --- /dev/null +++ b/Packages/Swift/Snippets/deinit.sublime-snippet @@ -0,0 +1,10 @@ + + + deinit + source.swift + deinit {...} + diff --git a/Packages/Swift/Snippets/didSet.sublime-snippet b/Packages/Swift/Snippets/didSet.sublime-snippet new file mode 100644 index 0000000..2cb2538 --- /dev/null +++ b/Packages/Swift/Snippets/didSet.sublime-snippet @@ -0,0 +1,10 @@ + + + didSet + source.swift + didSet {...} + diff --git a/Packages/Swift/Snippets/else-if.sublime-snippet b/Packages/Swift/Snippets/else-if.sublime-snippet new file mode 100644 index 0000000..ed65f42 --- /dev/null +++ b/Packages/Swift/Snippets/else-if.sublime-snippet @@ -0,0 +1,10 @@ + + + elif + source.swift + else if ... + diff --git a/Packages/Swift/Snippets/else.sublime-snippet b/Packages/Swift/Snippets/else.sublime-snippet new file mode 100644 index 0000000..c0ba49a --- /dev/null +++ b/Packages/Swift/Snippets/else.sublime-snippet @@ -0,0 +1,10 @@ + + + else + source.swift + else ... + diff --git a/Packages/Swift/Snippets/enum.sublime-snippet b/Packages/Swift/Snippets/enum.sublime-snippet new file mode 100644 index 0000000..ba61463 --- /dev/null +++ b/Packages/Swift/Snippets/enum.sublime-snippet @@ -0,0 +1,9 @@ + + + enum + source.swift + diff --git a/Packages/Swift/Snippets/extension.sublime-snippet b/Packages/Swift/Snippets/extension.sublime-snippet new file mode 100644 index 0000000..75685b6 --- /dev/null +++ b/Packages/Swift/Snippets/extension.sublime-snippet @@ -0,0 +1,10 @@ + + + extension + source.swift + extension ... + diff --git a/Packages/Swift/Snippets/func.sublime-snippet b/Packages/Swift/Snippets/func.sublime-snippet new file mode 100644 index 0000000..bb6026b --- /dev/null +++ b/Packages/Swift/Snippets/func.sublime-snippet @@ -0,0 +1,9 @@ + + ${3:ReturnType} { + $4 +} +]]> + func + source.swift + diff --git a/Packages/Swift/Snippets/get.sublime-snippet b/Packages/Swift/Snippets/get.sublime-snippet new file mode 100644 index 0000000..adb89df --- /dev/null +++ b/Packages/Swift/Snippets/get.sublime-snippet @@ -0,0 +1,10 @@ + + + get + source.swift + get {...} + diff --git a/Packages/Swift/Snippets/if-else.sublime-snippet b/Packages/Swift/Snippets/if-else.sublime-snippet new file mode 100644 index 0000000..531f14c --- /dev/null +++ b/Packages/Swift/Snippets/if-else.sublime-snippet @@ -0,0 +1,12 @@ + + + ifelse + source.swift + if ... else ... + diff --git a/Packages/Swift/Snippets/if.sublime-snippet b/Packages/Swift/Snippets/if.sublime-snippet new file mode 100644 index 0000000..42990fb --- /dev/null +++ b/Packages/Swift/Snippets/if.sublime-snippet @@ -0,0 +1,10 @@ + + + if + source.swift + if ... + diff --git a/Packages/Swift/Snippets/init.sublime-snippet b/Packages/Swift/Snippets/init.sublime-snippet new file mode 100644 index 0000000..23a2a4a --- /dev/null +++ b/Packages/Swift/Snippets/init.sublime-snippet @@ -0,0 +1,10 @@ + + + init + source.swift + init(...) {...} + diff --git a/Packages/Swift/Snippets/operator.sublime-snippet b/Packages/Swift/Snippets/operator.sublime-snippet new file mode 100644 index 0000000..1c041ef --- /dev/null +++ b/Packages/Swift/Snippets/operator.sublime-snippet @@ -0,0 +1,10 @@ + + + operator + source.swift + operator ... + diff --git a/Packages/Swift/Snippets/protocol.sublime-snippet b/Packages/Swift/Snippets/protocol.sublime-snippet new file mode 100644 index 0000000..9778269 --- /dev/null +++ b/Packages/Swift/Snippets/protocol.sublime-snippet @@ -0,0 +1,10 @@ + + + protocol + source.swift + protocol ... + diff --git a/Packages/Swift/Snippets/set.sublime-snippet b/Packages/Swift/Snippets/set.sublime-snippet new file mode 100644 index 0000000..699dc6c --- /dev/null +++ b/Packages/Swift/Snippets/set.sublime-snippet @@ -0,0 +1,10 @@ + + + set + source.swift + set {...} + diff --git a/Packages/Swift/Snippets/static-var.sublime-snippet b/Packages/Swift/Snippets/static-var.sublime-snippet new file mode 100644 index 0000000..987feae --- /dev/null +++ b/Packages/Swift/Snippets/static-var.sublime-snippet @@ -0,0 +1,8 @@ + + + sv + source.swift + static var ... + diff --git a/Packages/Swift/Snippets/struct.sublime-snippet b/Packages/Swift/Snippets/struct.sublime-snippet new file mode 100644 index 0000000..137984a --- /dev/null +++ b/Packages/Swift/Snippets/struct.sublime-snippet @@ -0,0 +1,10 @@ + + + struct + source.swift + struct ... + diff --git a/Packages/Swift/Snippets/subscript.sublime-snippet b/Packages/Swift/Snippets/subscript.sublime-snippet new file mode 100644 index 0000000..dfd5399 --- /dev/null +++ b/Packages/Swift/Snippets/subscript.sublime-snippet @@ -0,0 +1,10 @@ + + ${2:ReturnType} { + $3 +} +]]> + subscript + source.swift + subscript ... + diff --git a/Packages/Swift/Snippets/swift.sublime-snippet b/Packages/Swift/Snippets/swift.sublime-snippet new file mode 100644 index 0000000..5aaf407 --- /dev/null +++ b/Packages/Swift/Snippets/swift.sublime-snippet @@ -0,0 +1,9 @@ + + + swift + source.swift + #!/usr/bin/env xcrun swift + diff --git a/Packages/Swift/Snippets/switch.sublime-snippet b/Packages/Swift/Snippets/switch.sublime-snippet new file mode 100644 index 0000000..06327b8 --- /dev/null +++ b/Packages/Swift/Snippets/switch.sublime-snippet @@ -0,0 +1,11 @@ + + + switch + source.swift + switch ... + diff --git a/Packages/Swift/Snippets/typealias.sublime-snippet b/Packages/Swift/Snippets/typealias.sublime-snippet new file mode 100644 index 0000000..fd5c7ba --- /dev/null +++ b/Packages/Swift/Snippets/typealias.sublime-snippet @@ -0,0 +1,8 @@ + + + typealias + source.swift + typealias ... = ... + diff --git a/Packages/Swift/Snippets/willSet.sublime-snippet b/Packages/Swift/Snippets/willSet.sublime-snippet new file mode 100644 index 0000000..ca79a30 --- /dev/null +++ b/Packages/Swift/Snippets/willSet.sublime-snippet @@ -0,0 +1,10 @@ + + + willSet + source.swift + willSet {...} + diff --git a/Packages/Swift/Swift.sublime-syntax b/Packages/Swift/Swift.sublime-syntax new file mode 100644 index 0000000..9194cc3 --- /dev/null +++ b/Packages/Swift/Swift.sublime-syntax @@ -0,0 +1,371 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Swift +file_extensions: + - swift +first_line_match: ^#!/.*\bswift +scope: source.swift +contexts: + main: + - include: shebang-line + - include: comment + - include: attribute + - include: literal + - include: operator + - include: declaration + - include: storage-type + - include: keyword + - include: type + - include: boolean + comment: + - include: documentation-comment + - include: block-comment + - include: in-line-comment + access-level-modifier: + - match: \b(open|public|internal|fileprivate|private)\b(?:\(set\))? + comment: access-level-modifier + scope: keyword.other.access-level-modifier.swift + arithmetic-operator: + - match: '(?&|\^~.])(\+|\-|\*|\/)(?![/=\-+!*%<>&|\^~.])' + scope: keyword.operator.arithmetic.swift + array-type: + - match: \b(Array)(<) + captures: + 1: support.type.array.swift + 2: punctuation.array.begin.swift + push: + - meta_scope: meta.array.swift + - match: (>) + captures: + 1: punctuation.array.end.swift + pop: true + - include: main + assignment-operator: + - match: '(?&|\^~.])(\+|\-|\*|\/|%|<<|>>|&|\^|\||&&|\|\|)?=(?![/=\-+!*%<>&|\^~.])' + scope: keyword.operator.assignment.swift + attribute: + - match: '((@)(\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B))(\()' + captures: + 1: storage.modifier.attribute.swift + 2: punctuation.definition.attribute.swift + 3: punctuation.definition.attribute-arguments.begin.swift + push: + - meta_content_scope: meta.attribute.arguments.swift + - match: \) + captures: + 0: punctuation.definition.attribute-arguments.end.swift + pop: true + - include: main + - match: '((@)(\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B))' + captures: + 1: storage.modifier.attribute.swift + 2: punctuation.definition.attribute.swift + bitwise-operator: + - match: '(?&|\^~.])(&|\||\^|<<|>>)(?![/=\-+!*%<>&|\^~.])' + scope: keyword.operator.bitwise.swift + block-comment: + - match: /\* + comment: Block comment + captures: + 0: punctuation.definition.comment.block.begin.swift + push: + - meta_scope: comment.block.swift + - match: \*/ + captures: + 0: punctuation.definition.comment.block.end.swift + pop: true + boolean: + - match: \b(true|false)\b + scope: keyword.constant.boolean.swift + branch-statement-keyword: + - include: if-statement-keyword + - include: switch-statement-keyword + catch-statement-keyword: + - match: \b(catch|do)\b + comment: catch-statement + scope: kewyord.control.catch.swift + code-block: + - match: '(\{)' + comment: code-block + captures: + 1: punctuation.definition.code-block.begin.swift + push: + - match: '(\})' + captures: + 1: punctuation.definition.code-block.end.swift + pop: true + - include: main + collection-type: + - include: array-type + - include: dictionary-type + - match: \b(Array|Dictionary)\b + scope: support.type.swift + comparative-operator: + - match: '(?&|\^~.])((=|!)==?|(<|>)=?|~=)(?![/=\-+!*%<>&|\^~.])' + scope: keyword.operator.comparative.swift + control-transfer-statement-keyword: + - match: \b(continue|break|fallthrough|return)\b + comment: control-transfer-statement + scope: keyword.control.transfer.swift + custom-operator: + - match: '(?<=[\s(\[{,;:])([/=\-+!*%<>&|\^~.]++)(?![\s)\]},;:])' + scope: keyword.operator.custom.prefix.unary.swift + - match: '(?&|\^~.]++)(?![\s)\]},;:\.])' + scope: keyword.operator.custom.postfix.unary.swift + - match: '(?<=[\s(\[{,;:])([/=\-+!*%<>&|\^~.]++)(?=[\s)\]},;:])' + scope: keyword.operator.custom.binary.swift + declaration: + - include: import-declaration + - include: function-declaration + declaration-modifier: + - match: \b(class|convenience|dynamic|final|lazy|(non)?mutating|optional|override|required|static|unowned((un)?safe)?|weak)\b + comment: declaration-modifier + scope: keyword.other.declaration-modifier.swift + dictionary-type: + - match: \b(Dictionary)(<) + captures: + 1: support.type.dictionary.swift + 2: punctuation.dictionary.begin.swift + push: + - meta_scope: meta.dictionary.swift + - match: (>) + captures: + 1: punctuation.dictionary.end.swift + pop: true + - include: main + documentation-comment: + - match: /\*\* + comment: Documentation comment + captures: + 0: punctuation.definition.comment.block.documentation.begin.swift + push: + - meta_scope: comment.block.documentation.swift + - match: \*/ + captures: + 0: punctuation.definition.comment.block.documentation.end.swift + pop: true + floating-point-literal: + - match: '\b([0-9][0-9_]*)(\.([0-9][0-9_]*))?([eE][+\-]?([0-9][0-9_]*))?\b' + comment: floating-point-literal -> (decimal-literal)(decimal-fraction)?(decimal-exponent)? + - match: '\b(0x\h[\h_]*)(\.(0x\h[\h_]*))?([pP][+\-]?(0x\h[\h_]*))\b' + comment: floating-point-literal -> (hexadecimal-literal)(hexadecimal-fraction)?(hexadecimal-exponent) + function-body: + - include: code-block + function-declaration: + - match: '\b(func)\s+(\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B|[/=\-+!*%<>&|\^~.]+)\s*(?=\(|<)' + comment: function-declaration + captures: + 1: storage.type.function.swift + 2: entity.type.function.swift + push: + - meta_scope: meta.function-declaration.swift + - match: '(?<=\})' + pop: true + - include: generic-parameter-clause + - include: parameter-clause + - include: function-result + - include: function-body + function-result: + - match: '(?&|\^~.])(\->)(?![/=\-+!*%<>&|\^~.])\s*' + comment: function-result + captures: + 1: keyword.operator.function-result.swift + push: + - meta_scope: meta.function-result.swift + - match: '\s*(?=\{)' + pop: true + - include: type + generic-parameter-clause: + - match: (<) + comment: generic-parameter-clause + captures: + 1: punctuation.definition.generic-parameter-clause.begin.swift + push: + - meta_scope: meta.generic-parameter-clause.swift + - match: (>) + captures: + 1: punctuation.definition.generic-parameter-clause.end.swift + pop: true + - include: main + identifier: + - match: '(\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B)' + comment: identifier + scope: meta.identifier.swift + if-statement-keyword: + - match: \b(if|else)\b + comment: if-statement + scope: keyword.control.if.swift + import-declaration: + - match: '\b(import)\s+(?:(typealias|struct|class|enum|protocol|var|func)\s+)?((?:\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B|[/=\-+!*%<>&|\^~.]+)(?:\.(?:\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B|[/=\-+!*%<>&|\^~.]+))*)' + comment: import-declaration + scope: meta.import.swift + captures: + 1: keyword.other.import.swift + 2: storage.modifier.swift + 3: support.type.module.import.swift + in-line-comment: + - match: (//).* + comment: In-line comment + scope: comment.line.double-slash.swift + captures: + 1: punctuation.definition.comment.line.double-slash.swift + increment-decrement-operator: + - match: '(?&|\^~.])(\+\+|\-\-)(?![/=\-+!*%<>&|\^~.])' + scope: keyword.operator.increment-or-decrement.swift + integer-literal: + - match: '(\B\-|\b)(0b[01][01_]*)\b' + comment: binary-literal + scope: constant.numeric.integer.binary.swift + - match: '(\B\-|\b)(0o[0-7][0-7_]*)\b' + comment: octal-literal + scope: constant.numeric.integer.octal.swift + - match: '(\B\-|\b)([0-9][0-9_]*)\b' + comment: decimal-literal + scope: constant.numeric.integer.decimal.swift + - match: '(\B\-|\b)(0x\h[\h_]*)\b' + comment: hexadecimal-literal + scope: constant.numeric.integer.hexadecimal.swift + integer-type: + - match: \bU?Int(8|16|32|64)?\b + comment: Int types + scope: support.type.swift + keyword: + - include: branch-statement-keyword + - include: control-transfer-statement-keyword + - include: loop-statement-keyword + - include: catch-statement-keyword + - include: operator-declaration-modifier + - include: declaration-modifier + - include: access-level-modifier + - match: \b(class|deinit|enum|extension|func|import|init|let|protocol|static|struct|subscript|typealias|var|throws|rethrows)\b + comment: declaration keyword + scope: keyword.declaration.swift + - match: \b(break|case|continue|default|do|else|fallthrough|if|in|for|return|switch|where|while|repeat|catch|guard|defer|try|throw)\b + comment: statement keyword + scope: keyword.statement.swift + - match: \b(as|dynamicType|is|new|super|self|Self|Type)\b + comment: expression and type keyword + scope: keyword.other.statement.swift + - match: \b(associativity|didSet|get|infix|inout|left|mutating|none|nonmutating|operator|override|postfix|precedence|prefix|right|set|unowned((un)?safe)?|weak|willSet)\b + comment: other keyword + scope: keyword.other.swift + literal: + - include: integer-literal + - include: floating-point-literal + - include: nil-literal + - include: string-literal + - include: special-literal + logical-operator: + - match: '(?&|\^~.])(!|&&|\|\|)(?![/=\-+!*%<>&|\^~.])' + scope: keyword.operator.logical.swift + loop-statement-keyword: + - match: \b(while|repeat|for|in)\b + comment: loop-statement + scope: keyword.control.loop.swift + nil-literal: + - match: \bnil\b + comment: nil-literal + scope: constant.nil.swift + operator: + - include: comparative-operator + - include: assignment-operator + - include: logical-operator + - include: remainder-operator + - include: increment-decrement-operator + - include: overflow-operator + - include: range-operator + - include: bitwise-operator + - include: arithmetic-operator + - include: ternary-operator + - include: type-casting-operator + - include: custom-operator + operator-declaration-modifier: + - match: \b(operator|prefix|infix|postfix)\b + comment: operator-declaration + scope: keyword.other.operator.swift + optional-type: + - match: \b(Optional)(<) + scope: meta.optional.swift + overflow-operator: + - match: '(?&|\^~.])\&(\+|\-|\*|\/|%)(?![/=\-+!*%<>&|\^~.])' + scope: keyword.operator.overflow.swift + parameter-clause: + - match: (\() + comment: parameter-clause + captures: + 1: punctuation.definition.function-arguments.begin.swift + push: + - meta_scope: meta.parameter-clause.swift + - match: (\)) + captures: + 1: punctuation.definition.function-arguments.end.swift + pop: true + - include: main + primitive-type: + - match: \b(Int|Float|Double|String|Bool|Character|Void)\b + comment: Primitive types + scope: support.type.swift + protocol-composition-type: + - match: \b(protocol)(<) + scope: meta.protocol.swift + range-operator: + - match: '(?&|\^~.])\.\.(?:\.)?(?![/=\-+!*%<>&|\^~.])' + scope: keyword.operator.range.swift + remainder-operator: + - match: '(?&|\^~.])\%(?![/=\-+!*%<>&|\^~.])' + scope: keyword.operator.remainder.swift + shebang-line: + - match: ^(#!).*$ + comment: Shebang line + scope: comment.line.shebang.swift + captures: + 1: punctuation.definition.comment.line.shebang.swift + special-literal: + - match: \b__(FILE|LINE|COLUMN|FUNCTION)__\b + scope: keyword.other.literal.swift + storage-type: + - match: \b(var|func|let|class|enum|struct|protocol|extension|typealias)\b + scope: storage.type.swift + string-literal: + - match: \" + captures: + 0: string.quoted.double.swift + push: + - meta_scope: meta.literal.string.swift + - match: \" + captures: + 0: string.quoted.double.swift + pop: true + - match: '\\([0tnr\"\''\\]|x\h{2}|u\h{4}|U\h{8})' + scope: constant.character.escape.swift + - match: (\\\() + captures: + 1: support.punctuation.expression.begin.swift + push: + - meta_content_scope: meta.expression.swift + - match: (\)) + captures: + 1: support.punctuation.expression.end.swift + pop: true + - include: scope:source.swift + - match: (\"|\\) + scope: invalid.illegal.swift + - match: (.) + scope: string.quoted.double.swift + switch-statement-keyword: + - match: \b(switch|case|default|where)\b + comment: switch-statement + scope: keyword.control.switch.swift + ternary-operator: + - match: '(?<=[\s(\[{,;:])(\?|:)(?=[\s)\]},;:])' + scope: keyword.operator.ternary.swift + type: + - include: primitive-type + - include: integer-type + - include: collection-type + - include: optional-type + - include: protocol-composition-type + type-casting-operator: + - match: \b(is\b|as(\?\B|\b)) + scope: keyword.operator.type-casting.swift