├── .gitignore ├── .travis.yml ├── .vscode ├── cSpell.json ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── CHANGELOG.MD ├── README.md ├── images └── SwiftIcon.png ├── license ├── package.json ├── snippets ├── README └── snippets.json ├── src └── extension.ts ├── syntaxes ├── README └── swift.tmLanguage ├── test ├── extension.test.ts └── index.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /out 3 | /node_modules 4 | *.vsix 5 | lib/** 6 | tmp/** -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | lang: node_js 2 | node_js: 3 | - node 4 | 5 | os: 6 | - osx 7 | 8 | before_install: 9 | - if [ $TRAVIS_OS_NAME == "linux" ]; then 10 | export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0; 11 | sh -e /etc/init.d/xvfb start; 12 | sleep 3; 13 | fi 14 | - echo "--- Environment ---" && env | sort && echo "--- End of Environment ---" 15 | 16 | install: 17 | - npm install 18 | - npm run vscode:prepublish 19 | 20 | script: 21 | - npm test --silent 22 | -------------------------------------------------------------------------------- /.vscode/cSpell.json: -------------------------------------------------------------------------------- 1 | // cSpell Settings 2 | { 3 | // Version of the setting file. Always 0.1 4 | "version": "0.1", 5 | // language - current active spelling language 6 | "language": "en", 7 | // words - list of words to be always considered correct 8 | "words": [ 9 | "langsrv", 10 | "languageclient" 11 | ], 12 | // flagWords - list of words to be always considered incorrect 13 | // This is useful for offensive words and common spelling errors. 14 | // For example "hte" should be "the" 15 | "flagWords": [ 16 | "hte" 17 | ] 18 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "configurations": [ 4 | { 5 | "name": "Launch Extension", 6 | "type": "extensionHost", 7 | "request": "launch", 8 | "runtimeExecutable": "${execPath}", 9 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], 10 | "stopOnEntry": false, 11 | "sourceMaps": true, 12 | "outFiles": [ "${workspaceRoot}/out/src/**/*.js" ], 13 | "preLaunchTask": "npm" 14 | }, 15 | { 16 | "name": "Launch Tests", 17 | "type": "extensionHost", 18 | "request": "launch", 19 | "runtimeExecutable": "${execPath}", 20 | "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ], 21 | "stopOnEntry": false, 22 | "sourceMaps": true, 23 | "outFiles": [ "${workspaceRoot}/out/test/**/*.js" ], 24 | "preLaunchTask": "npm" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite the default settings 2 | { 3 | "files.exclude": { 4 | ".build": true, 5 | "out": false, 6 | "node_modules": true 7 | }, 8 | "search.exclude": { 9 | ".build": true, 10 | "out": true, 11 | "node_modules": true 12 | }, 13 | "cSpell.enabled": true 14 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // Available variables which can be used inside of strings. 2 | // ${workspaceRoot}: the root folder of the team 3 | // ${file}: the current opened file 4 | // ${fileBasename}: the current opened file's basename 5 | // ${fileDirname}: the current opened file's dirname 6 | // ${fileExtname}: the current opened file's extension 7 | // ${cwd}: the current working directory of the spawned process 8 | 9 | { 10 | "version": "0.1.0", 11 | "command": "npm", 12 | "isShellCommand": true, 13 | "showOutput": "silent", 14 | "args": ["run", "compile", "--loglevel", "silent"], 15 | "isBackground": true, 16 | "problemMatcher": "$tsc-watch" 17 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | **/*.ts 2 | **/tsconfig.json 3 | test/** 4 | out/test/** 5 | lib/** 6 | tmp/** 7 | *.vsix 8 | -------------------------------------------------------------------------------- /CHANGELOG.MD: -------------------------------------------------------------------------------- 1 | ## 0.7.0 - June 9, 2017 2 | Brings along a new version of the language server (v0.15.0): 3 | - Full support for SwiftPM projects layouts. 4 | - General performance enhancements with SourceKit interaction. 5 | - The following commands were enabled: 6 | - Hover over information for code. 7 | - Go to definition support (only within your project for now, no module file generation). 8 | 9 | *Known Issues*: When new files are added, or if completions stop, rebuild your project. 10 | 11 | ## 0.6.0 - June 3, 2017 12 | This is a big infrastructural update as the binaries for the language server are no longer packaged 13 | within the extension any longer. Instead, they are downloaded on first run. This provides excellent 14 | ground work for support multiple platforms with a light-weight extension download. 15 | 16 | Other fixes: 17 | - Fixed issue with the settings pulled from the wrong key. 18 | 19 | ## 0.5.5 - June 3, 2017 20 | - Packaged a new `langsrv` that fixes some `@rpath` issues that pointed to local user folders. 21 | 22 | ## 0.5.4 - June 3, 2017 23 | - Packaged a new `langsrv` tool that fixes some completion item errors on unsaved buffers, 24 | including a bug when at the end of the document. 25 | 26 | ## 0.5.3 - June 3, 2017 27 | - Updated the `README` to better reflect the published name. 28 | - Fixes to the `README` about configuration settings. 29 | - The packaged `langsrv` tool should now find your `sourcekitd` frameworks when using the Toolchain 30 | installs and Xcode. 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Swift for Visual Studio Code 2 | 3 | An extension for VS Code which provides support for the Swift language, providing the following: 4 | 5 | * Completion Lists 6 | * Signature Help 7 | * Snippets 8 | * Quick Info 9 | * Goto Definition 10 | 11 | Please note that this extension will *ONLY* work with Swift Package Manager projects for the time 12 | being. If a `Package.swift` file is not in the root of your project, this extension will fail. 13 | 14 | Also note, this is an early beta release. There will be bugs. Please file any issues you run into 15 | over here: https://github.com/owensd/vscode-swift. 16 | 17 | ## Installation 18 | 19 | Obviously, you'll need to have Visual Studio Code installed. Then search for the `Swift for Visual 20 | Studio Code` extension from the command palette (`cmd+shift+p`|`ctrl+shift+p`). 21 | 22 | You'll need to ensure that the `swift` tool is on your command path is one of the supported 23 | versions. As of now, only Swift 3.1 is supported. If you are using development snapshots, you can 24 | configure your project to use the correct version of Swift with the `swift-langsrv. 25 | 26 | > _Note:_ It is entirely possible to use development snapshots. However, they are untested and 27 | > unsupported. The problem is that the SourceKit binary may simply not load for mis-matched versions 28 | > of Swift. 29 | > 30 | > `swift.toolchainPath` - the path to the root of the Swift toolchain, for example: 31 | > `/Library/Developer/Toolchains/swift-3.1.1-RELEASE.xctoolchain` 32 | 33 | ### macOS 34 | 35 | If you have the correct version of Swift installed, there is no other action necessary as all of the 36 | dependencies are installed for you. 37 | 38 | 39 | ### Linux (in progress) 40 | 41 | The fundamental problem is Swift 3.1 does not build with SourceKit... this is being addressed in 42 | Swift 4. There are workarounds that I will published within the next few releases. 43 | 44 | ### Windows Linux Subsystem (experimental) 45 | 46 | This setup is identical as the Linux setup with the exception of some additional Visual Studio Code 47 | setup that is required. For one, the default shell needs to point to `C:\Windows\sysnative\bash.exe`. 48 | This should be enough to get you going, but your mileage may vary here. In later versions, this will 49 | be more flushed out as there are still reliability issues with `swift` itself in this environment. 50 | 51 | ## Swift JIRA Bug Links 52 | 53 | The extension also provides easy hot-links to any of the Swift bugs with a specially crafted comment 54 | `// SwiftBug(SR-2688)`. You can disable this feature with the `kiad.swift.enableSwiftBugLinks` 55 | setting. 56 | 57 | ## License 58 | [MIT](LICENSE) -------------------------------------------------------------------------------- /images/SwiftIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owensd/vscode-swift/6b03de080504b42e28f1647171a5583c704e0158/images/SwiftIcon.png -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Kiad Studios, LLC. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-swift", 3 | "displayName": "Swift for Visual Studio Code", 4 | "description": "Provides rich language support for Swift PM projects in Visual Studio Code.", 5 | "author": "David Owens II", 6 | "license": "MIT", 7 | "version": "0.8.0", 8 | "publisher": "kiadstudios", 9 | "preview": true, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/owensd/vscode-swift" 13 | }, 14 | "engines": { 15 | "vscode": "^1.8.0" 16 | }, 17 | "categories": [ 18 | "Languages", 19 | "Snippets" 20 | ], 21 | "activationEvents": [ 22 | "onLanguage:swift" 23 | ], 24 | "keywords": [ 25 | "swift", "ios", "macos", "apple", "ide" 26 | ], 27 | "main": "./out/src/extension", 28 | "files": [ 29 | "CHANGELOG.md", 30 | "images/**", 31 | "node_modules/**", 32 | "out/**", 33 | "package.json", 34 | "README.md", 35 | "snippets/**", 36 | "syntaxes/**" 37 | ], 38 | "contributes": { 39 | "languages": [{ 40 | "id": "swift", 41 | "extension": [".swift"] 42 | }], 43 | "grammars": [{ 44 | "language": "swift", 45 | "scopeName": "source.swift", 46 | "path": "./syntaxes/swift.tmLanguage" 47 | }], 48 | "snippets": [{ 49 | "language": "swift", 50 | "path": "./snippets/snippets.json" 51 | }], 52 | "configuration": { 53 | "type": "object", 54 | "title": "Swift Language Server Configuration", 55 | "properties": { 56 | "swift.languageServerPath": { 57 | "type": "string", 58 | "default": "lib/usr/bin/langsrv", 59 | "description": "The path to the Swift Language Server utility." 60 | }, 61 | "swift.enableLanguageServer": { 62 | "type": "bool", 63 | "default": true, 64 | "description": "Option to turn off the language server." 65 | }, 66 | "swift.enableSwiftBugLinks": { 67 | "type": "bool", 68 | "default": true, 69 | "description": "Option to turn off Swift JIRA but linking." 70 | }, 71 | "swift.toolchainPath": { 72 | "type": "string", 73 | "default": null, 74 | "description": "The toolchain path for the version of Swift to be used." 75 | } 76 | } 77 | } 78 | }, 79 | "scripts": { 80 | "vscode:prepublish": "tsc -p ./", 81 | "compile": "tsc -watch -p ./", 82 | "update-vscode": "node ./node_modules/vscode/bin/install", 83 | "postinstall": "node ./node_modules/vscode/bin/install" 84 | }, 85 | "devDependencies": { 86 | "@types/mocha": "^2.2.33", 87 | "@types/node": "^6.0.52", 88 | "typescript": "^2.1.5", 89 | "vscode": "^1.0.3" 90 | }, 91 | "dependencies": { 92 | "vscode-languageclient": "^3.1.0", 93 | "unzip": "^0.1.11", 94 | "request": "^2.81.0" 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /snippets/README: -------------------------------------------------------------------------------- 1 | Generated with `yo code` from these files: https://github.com/textmate/swift.tmbundle/tree/master/Snippets. -------------------------------------------------------------------------------- /snippets/snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "ca": { 3 | "prefix": "ca", 4 | "body": "case ${1:pattern}:$0", 5 | "description": "case" 6 | }, 7 | "cv": { 8 | "prefix": "cv", 9 | "body": "class var ${1:name}", 10 | "description": "class var" 11 | }, 12 | "de": { 13 | "prefix": "de", 14 | "body": "deinit {\n\t$1\n}", 15 | "description": "deinit" 16 | }, 17 | "di": { 18 | "prefix": "di", 19 | "body": "didSet {\n\t$1\n}", 20 | "description": "didSet" 21 | }, 22 | "fixme": { 23 | "prefix": "fixme", 24 | "body": "// FIXME: ", 25 | "description": "Fixme" 26 | }, 27 | "jira": { 28 | "prefix": "jira", 29 | "body": "SwiftBug(SR-${1})", 30 | "description": "SwiftBug(SR-####)" 31 | }, 32 | "mark": { 33 | "prefix": "mark", 34 | "body": "// MARK: ", 35 | "description": "Mark" 36 | }, 37 | "param": { 38 | "prefix": "param", 39 | "body": ":param: ", 40 | "description": "Param" 41 | }, 42 | "returns": { 43 | "prefix": "returns", 44 | "body": ":returns: ", 45 | "description": "Returns" 46 | }, 47 | "swift": { 48 | "prefix": "swift", 49 | "body": "#!/usr/bin/env swift\n", 50 | "description": "#!/usr/bin/env swift" 51 | }, 52 | "sv": { 53 | "prefix": "sv", 54 | "body": "static var ${1:name}", 55 | "description": "static var" 56 | }, 57 | "sw": { 58 | "prefix": "sw", 59 | "body": "switch ${1:value} {\ncase ${2:pattern}:\n\t$3\n}", 60 | "description": "switch" 61 | }, 62 | "todo": { 63 | "prefix": "todo", 64 | "body": "// TODO: ", 65 | "description": "Todo" 66 | }, 67 | "ty": { 68 | "prefix": "ty", 69 | "body": "typealias ${1:Foo} = ${2:Bar}", 70 | "description": "typealias" 71 | }, 72 | "wi": { 73 | "prefix": "wi", 74 | "body": "willSet {\n\t$1\n}", 75 | "description": "willSet" 76 | } 77 | } -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------------------------- 2 | * Copyright (c) Kiad Studios, LLC. All rights reserved. 3 | * Licensed under the MIT License. See License in the project root for license information. 4 | * ------------------------------------------------------------------------------------------ */ 5 | 'use strict'; 6 | 7 | import * as path from 'path'; 8 | import * as fs from 'fs'; 9 | import * as request from 'request'; 10 | import * as unzip from 'unzip'; 11 | 12 | import { window, languages, workspace, commands, Uri, Range, Disposable, ExtensionContext, TextDocument, CancellationToken, DocumentLink, extensions } from 'vscode'; 13 | import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind } from 'vscode-languageclient'; 14 | 15 | let languageServerId = 'swift'; 16 | let extensionPath = ''; 17 | 18 | // The version of the language server known to work with this extension. 19 | let languageServerAssetsUrl = "https://github.com/owensd/swift-langsrv/releases/download/v0.16.1/langsrv-macos-v0.16.1.zip" 20 | 21 | function normalize(path: string): string { 22 | if (path.charAt(0) != '/') { 23 | return extensionPath + '/' + path 24 | } 25 | return path 26 | } 27 | 28 | function registerSwiftBugLinkProvider(context: ExtensionContext) { 29 | // Provides easy access to Swift bugs. 30 | // example: 31 | // SwiftBug(SR-2688) 32 | let disposableSwiftBugLinkProvider = languages.registerDocumentLinkProvider('swift', { 33 | provideDocumentLinks: function(document: TextDocument, token: CancellationToken): DocumentLink[] { 34 | let links: DocumentLink[] = []; 35 | let re = /(SwiftBug\((SR-\d+)\))/g; 36 | let documentText = document.getText(); 37 | 38 | var match 39 | while ((match = re.exec(documentText)) != null) { 40 | let pos = document.positionAt(match.index); 41 | let range = new Range(pos, pos.translate(0, match[0].length + 1)); 42 | if (match[1]) { 43 | let uri = Uri.parse('https://bugs.swift.org/browse/' + match[2]); 44 | links.push(new DocumentLink(range, uri)); 45 | } 46 | } 47 | return links; 48 | } 49 | }); 50 | context.subscriptions.push(disposableSwiftBugLinkProvider); 51 | } 52 | 53 | // Launches the Swift Language Server tool. 54 | function registerSwiftLanguageServer(context: ExtensionContext) { 55 | let config = workspace.getConfiguration(languageServerId); 56 | let langsrvPath = normalize(config.get('languageServerPath', 'lib/usr/bin/langsrv')); 57 | let debugOptions = ["--nolazy", "--debug=6009"]; 58 | 59 | fs.exists(langsrvPath, (exists: boolean) => { 60 | if (exists) { 61 | // TODO(owensd): Think about doing PATCH level updates here. 62 | 63 | let serverOptions: ServerOptions = { 64 | run : { command: langsrvPath }, 65 | debug: { command: langsrvPath, args: debugOptions } 66 | } 67 | 68 | let clientOptions: LanguageClientOptions = { 69 | documentSelector: ['swift'], 70 | synchronize: { 71 | configurationSection: languageServerId, 72 | fileEvents: workspace.createFileSystemWatcher('**/.swift'), 73 | } 74 | } 75 | 76 | let swiftLanguageServer = new LanguageClient(languageServerId, 'Swift Language Server', serverOptions, clientOptions); 77 | context.subscriptions.push(swiftLanguageServer.start()); 78 | } 79 | else { 80 | // download the language server 81 | let tmpPath = normalize('tmp'); 82 | let libPath = normalize(path.join('lib', 'usr', 'bin')); 83 | if (!fs.existsSync(tmpPath)) { fs.mkdirSync(tmpPath); } 84 | if (!fs.existsSync(libPath)) { 85 | fs.mkdirSync(normalize('lib')); 86 | fs.mkdirSync(normalize(path.join('lib', 'usr'))); 87 | fs.mkdirSync(libPath); 88 | } 89 | 90 | let tmpAssetsPath = path.join(tmpPath, 'assets.zip'); 91 | let channel = window.createOutputChannel("Swift"); 92 | channel.appendLine('Downloading Language Server assets from ' + languageServerAssetsUrl); 93 | channel.show(); 94 | 95 | request(languageServerAssetsUrl) 96 | .pipe(fs.createWriteStream(tmpAssetsPath)) 97 | .on('close', function () { 98 | channel.appendLine('Assets downloaded to: ' + tmpAssetsPath); 99 | channel.appendLine('Extracting assets to ' + libPath); 100 | 101 | fs.createReadStream(tmpAssetsPath) 102 | .pipe(unzip.Extract({path: libPath})) 103 | .on('close', function () { 104 | fs.chmod(path.join(libPath, 'langsrv'), "755"); 105 | window.showInformationMessage('You will need to reload the window to load the language server.', 'Reload Window') 106 | .then(function (value) { 107 | commands.executeCommand('workbench.action.reloadWindow'); 108 | }); 109 | }) 110 | .on('error', function (e) { 111 | channel.appendLine('Error: ' + e); 112 | window.showErrorMessage('There was an error unpacking the language server assets from: ' + tmpAssetsPath); 113 | }); 114 | }) 115 | .on('error', function () { 116 | window.showErrorMessage('There was an error downloading the language server from: ' + languageServerAssetsUrl); 117 | }); 118 | } 119 | }); 120 | } 121 | 122 | export function activate(context: ExtensionContext) { 123 | extensionPath = context.extensionPath; 124 | let config = workspace.getConfiguration(languageServerId); 125 | 126 | let enableBugLinks = config.get('enableSwiftBugLinks', true); 127 | if (enableBugLinks) { registerSwiftBugLinkProvider(context); } 128 | 129 | let enableLanguageServer = config.get('enableLanguageServer', true); 130 | if (enableLanguageServer) { registerSwiftLanguageServer(context); } 131 | } 132 | -------------------------------------------------------------------------------- /syntaxes/README: -------------------------------------------------------------------------------- 1 | This file is from https://github.com/textmate/swift.tmbundle. -------------------------------------------------------------------------------- /syntaxes/swift.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | comment 6 | See swift.tmbundle/grammar-test.swift for test cases. 7 | fileTypes 8 | 9 | swift 10 | 11 | firstLineMatch 12 | ^#!/.*\bswift 13 | keyEquivalent 14 | ^~S 15 | name 16 | Swift 17 | patterns 18 | 19 | 20 | include 21 | #root 22 | 23 | 24 | repository 25 | 26 | attributes 27 | 28 | patterns 29 | 30 | 31 | begin 32 | ((@)available)(\() 33 | beginCaptures 34 | 35 | 1 36 | 37 | name 38 | storage.modifier.attribute.swift 39 | 40 | 2 41 | 42 | name 43 | punctuation.definition.attribute.swift 44 | 45 | 3 46 | 47 | name 48 | punctuation.definition.arguments.begin.swift 49 | 50 | 51 | end 52 | \) 53 | endCaptures 54 | 55 | 0 56 | 57 | name 58 | punctuation.definition.arguments.end.swift 59 | 60 | 61 | name 62 | meta.attribute.available.swift 63 | patterns 64 | 65 | 66 | captures 67 | 68 | 1 69 | 70 | name 71 | keyword.other.platform.os.swift 72 | 73 | 2 74 | 75 | name 76 | constant.numeric.swift 77 | 78 | 79 | match 80 | \b((?:iOS|macOS|OSX|watchOS|tvOS)(?:ApplicationExtension)?)\b(?:\s+([0-9]+(?:\.[0-9]+)*\b))? 81 | 82 | 83 | begin 84 | \b(introduced|deprecated|obsoleted)\s*(:)\s* 85 | beginCaptures 86 | 87 | 1 88 | 89 | name 90 | keyword.other.swift 91 | 92 | 2 93 | 94 | name 95 | punctuation.separator.key-value.swift 96 | 97 | 98 | end 99 | (?!\G) 100 | patterns 101 | 102 | 103 | match 104 | \b[0-9]+(?:\.[0-9]+)*\b 105 | name 106 | constant.numeric.swift 107 | 108 | 109 | 110 | 111 | begin 112 | \b(message|renamed)\s*(:)\s*(?=") 113 | beginCaptures 114 | 115 | 1 116 | 117 | name 118 | keyword.other.swift 119 | 120 | 2 121 | 122 | name 123 | punctuation.separator.key-value.swift 124 | 125 | 126 | end 127 | (?!\G) 128 | patterns 129 | 130 | 131 | include 132 | #literals 133 | 134 | 135 | 136 | 137 | captures 138 | 139 | 1 140 | 141 | name 142 | keyword.other.platform.all.swift 143 | 144 | 2 145 | 146 | name 147 | keyword.other.swift 148 | 149 | 3 150 | 151 | name 152 | invalid.illegal.character-not-allowed-here.swift 153 | 154 | 155 | match 156 | (?:(\*)|\b(deprecated|unavailable)\b)\s*(.*?)(?=[,)]) 157 | 158 | 159 | 160 | 161 | begin 162 | ((@)objc)(\() 163 | beginCaptures 164 | 165 | 1 166 | 167 | name 168 | storage.modifier.attribute.swift 169 | 170 | 2 171 | 172 | name 173 | punctuation.definition.attribute.swift 174 | 175 | 3 176 | 177 | name 178 | punctuation.definition.arguments.begin.swift 179 | 180 | 181 | end 182 | \) 183 | endCaptures 184 | 185 | 0 186 | 187 | name 188 | punctuation.definition.arguments.end.swift 189 | 190 | 191 | name 192 | meta.attribute.objc.swift 193 | patterns 194 | 195 | 196 | captures 197 | 198 | 1 199 | 200 | name 201 | invalid.illegal.missing-colon-after-selector-piece.swift 202 | 203 | 204 | match 205 | \w*(?::(?:\w*:)*(\w*))? 206 | name 207 | entity.name.function.swift 208 | 209 | 210 | 211 | 212 | begin 213 | (@)(?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>) 214 | beginCaptures 215 | 216 | 0 217 | 218 | name 219 | storage.modifier.attribute.swift 220 | 221 | 1 222 | 223 | name 224 | punctuation.definition.attribute.swift 225 | 226 | 2 227 | 228 | name 229 | punctuation.definition.identifier.swift 230 | 231 | 3 232 | 233 | name 234 | punctuation.definition.identifier.swift 235 | 236 | 237 | comment 238 | any other attribute 239 | end 240 | (?!\G\() 241 | name 242 | meta.attribute.swift 243 | patterns 244 | 245 | 246 | begin 247 | \( 248 | beginCaptures 249 | 250 | 0 251 | 252 | name 253 | punctuation.definition.arguments.begin.swift 254 | 255 | 256 | end 257 | \) 258 | endCaptures 259 | 260 | 0 261 | 262 | name 263 | punctuation.definition.arguments.end.swift 264 | 265 | 266 | name 267 | meta.arguments.attribute.swift 268 | patterns 269 | 270 | 271 | include 272 | #expressions 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | builtin-functions 281 | 282 | patterns 283 | 284 | 285 | comment 286 | Member functions in the standard library in Swift 3 which may be used with trailing closures and no parentheses 287 | match 288 | (?<=\.)(?:s(?:ort(?:ed)?|plit)|contains|index|partition|f(?:i(?:lter|rst)|orEach|latMap)|with(?:MutableCharacters|CString|U(?:nsafe(?:Mutable(?:BufferPointer|Pointer(?:s|To(?:Header|Elements)))|BufferPointer)|TF8Buffer))|m(?:in|a(?:p|x)))(?=\s*[({])\b 289 | name 290 | support.function.swift 291 | 292 | 293 | comment 294 | Member functions in the standard library in Swift 3 295 | match 296 | (?<=\.)(?:s(?:ymmetricDifference|t(?:oreBytes|arts|ride)|ortInPlace|u(?:ccessor|ffix|btract(?:ing|InPlace|WithOverflow)?)|quareRoot|amePosition)|h(?:oldsUnique(?:Reference|OrPinnedReference)|as(?:Suffix|Prefix))|ne(?:gate(?:d)?|xt)|c(?:o(?:untByEnumerating|py(?:Bytes)?)|lamp(?:ed)?|reate)|t(?:o(?:IntMax|Opaque|UIntMax)|ake(?:RetainedValue|UnretainedValue)|r(?:uncatingRemainder|a(?:nscodedLength|ilSurrogate)))|i(?:s(?:MutableAndUniquelyReferenced(?:OrPinned)?|S(?:trictSu(?:perset(?:Of)?|bset(?:Of)?)|u(?:perset(?:Of)?|bset(?:Of)?))|Continuation|T(?:otallyOrdered|railSurrogate)|Disjoint(?:With)?|Unique(?:Reference|lyReferenced(?:OrPinned)?)|Equal|Le(?:ss(?:ThanOrEqualTo)?|adSurrogate))|n(?:sert(?:ContentsOf)?|tersect(?:ion|InPlace)?|itialize(?:Memory|From)?|dex(?:Of|ForKey)))|o(?:verlaps|bjectAt)|d(?:i(?:stance(?:To)?|vide(?:d|WithOverflow)?)|e(?:s(?:cendant|troy)|code(?:CString)?|initialize|alloc(?:ate(?:Capacity)?)?)|rop(?:First|Last))|u(?:n(?:ion(?:InPlace)?|derestimateCount|wrappedOrError)|p(?:date(?:Value)?|percased))|join(?:ed|WithSeparator)|p(?:op(?:First|Last)|ass(?:Retained|Unretained)|re(?:decessor|fix))|e(?:scape(?:d)?|n(?:code|umerate(?:d)?)|lementsEqual|xclusiveOr(?:InPlace)?)|f(?:orm(?:Remainder|S(?:ymmetricDifference|quareRoot)|TruncatingRemainder|In(?:tersection|dex)|Union)|latten|rom(?:CString(?:RepairingIllFormedUTF8)?|Opaque))|w(?:i(?:thMemoryRebound|dth)|rite(?:To)?)|l(?:o(?:wercased|ad)|e(?:adSurrogate|xicographical(?:Compare|lyPrecedes)))|a(?:ss(?:ign(?:BackwardFrom|From)?|umingMemoryBound)|d(?:d(?:ing(?:Product)?|Product|WithOverflow)?|vanced(?:By)?)|utorelease|ppend(?:ContentsOf)?|lloc(?:ate)?|bs)|r(?:ound(?:ed)?|e(?:serveCapacity|tain|duce|place(?:Range|Subrange)?|verse(?:d)?|quest(?:NativeBuffer|UniqueMutableBackingBuffer)|lease|m(?:ove(?:Range|Subrange|Value(?:ForKey)?|First|Last|A(?:tIndex|ll))?|ainder(?:WithOverflow)?)))|ge(?:nerate|t(?:Objects|Element))|m(?:in(?:imum(?:Magnitude)?|Element)|ove(?:Initialize(?:Memory|BackwardFrom|From)?|Assign(?:From)?)?|ultipl(?:y(?:WithOverflow)?|ied)|easure|a(?:ke(?:Iterator|Description)|x(?:imum(?:Magnitude)?|Element)))|bindMemory)(?=\s*\() 297 | name 298 | support.function.swift 299 | 300 | 301 | comment 302 | Member functions in the standard library in Swift 2 only 303 | match 304 | (?<=\.)(?:s(?:uperclassMirror|amePositionIn|tartsWith)|nextObject|c(?:haracterAtIndex|o(?:untByEnumeratingWithState|pyWithZone)|ustom(?:Mirror|PlaygroundQuickLook))|is(?:EmptyInput|ASCII)|object(?:Enumerator|ForKey|AtIndex)|join|put|keyEnumerator|withUnsafeMutablePointerToValue|length|getMirror|m(?:oveInitializeAssignFrom|ember))(?=\s*\() 305 | name 306 | support.function.swift 307 | 308 | 309 | 310 | builtin-global-functions 311 | 312 | patterns 313 | 314 | 315 | begin 316 | \b(type)(\()\s*(of)(:) 317 | beginCaptures 318 | 319 | 1 320 | 321 | name 322 | support.function.dynamic-type.swift 323 | 324 | 2 325 | 326 | name 327 | punctuation.definition.arguments.begin.swift 328 | 329 | 3 330 | 331 | name 332 | support.variable.parameter.swift 333 | 334 | 4 335 | 336 | name 337 | punctuation.separator.argument-label.begin.swift 338 | 339 | 340 | end 341 | \) 342 | endCaptures 343 | 344 | 0 345 | 346 | name 347 | punctuation.definition.arguments.end.swift 348 | 349 | 350 | patterns 351 | 352 | 353 | include 354 | #expressions 355 | 356 | 357 | 358 | 359 | comment 360 | Global functions available in Swift 3 which may be used with trailing closures and no parentheses 361 | match 362 | \b(?:anyGenerator|autoreleasepool)(?=\s*[({])\b 363 | name 364 | support.function.swift 365 | 366 | 367 | comment 368 | Global functions available in Swift 3 369 | match 370 | \b(?:s(?:tride(?:of(?:Value)?)?|izeof(?:Value)?|equence|wap)|numericCast|transcode|is(?:UniquelyReferenced(?:NonObjC)?|KnownUniquelyReferenced)|zip|d(?:ump|ebugPrint)|unsafe(?:BitCast|Downcast|Unwrap|Address(?:Of)?)|pr(?:int|econdition(?:Failure)?)|fatalError|with(?:Unsafe(?:MutablePointer|Pointer)|ExtendedLifetime|VaList)|a(?:ssert(?:ionFailure)?|lignof(?:Value)?|bs)|re(?:peatElement|adLine)|getVaList|m(?:in|ax))(?=\s*\() 371 | name 372 | support.function.swift 373 | 374 | 375 | comment 376 | Global functions available in Swift 2 only 377 | match 378 | \b(?:s(?:ort|uffix|pli(?:ce|t))|insert|overlaps|d(?:istance|rop(?:First|Last))|join|prefix|extend|withUnsafe(?:MutablePointers|Pointers)|lazy|advance|re(?:flect|move(?:Range|Last|A(?:tIndex|ll))))(?=\s*\() 379 | name 380 | support.function.swift 381 | 382 | 383 | 384 | builtin-properties 385 | 386 | patterns 387 | 388 | 389 | match 390 | 393 | 394 | name 395 | support.variable.swift 396 | 397 | 398 | comment 399 | Properties in the standard library in Swift 3 400 | match 401 | (?<=\.)(?:s(?:t(?:artIndex|ri(?:ngValue|de))|i(?:ze|gn(?:BitIndex|ificand(?:Bit(?:Count|Pattern)|Width)?|alingNaN)?)|u(?:perclassMirror|mmary|bscriptBaseAddress))|h(?:eader|as(?:hValue|PointerRepresentation))|n(?:ulTerminatedUTF8|ext(?:Down|Up)|a(?:n|tiveOwner))|c(?:haracters|ount(?:TrailingZeros)?|ustom(?:Mirror|PlaygroundQuickLook)|apacity)|i(?:s(?:S(?:ign(?:Minus|aling(?:NaN)?)|ubnormal)|N(?:ormal|aN)|Canonical|Infinite|Zero|Empty|Finite|ASCII)|n(?:dices|finity)|dentity)|owner|de(?:scription|bugDescription)|u(?:n(?:safelyUnwrapped|icodeScalar(?:s)?|derestimatedCount)|tf(?:16|8(?:Start|C(?:String|odeUnitCount))?)|intValue|ppercaseString|lp(?:OfOne)?)|p(?:i|ointee)|e(?:ndIndex|lements|xponent(?:Bit(?:Count|Pattern))?)|value(?:s)?|keys|quietNaN|f(?:irst(?:ElementAddress(?:IfContiguous)?)?|loatingPointClass)|l(?:ittleEndian|owercaseString|eastNo(?:nzeroMagnitude|rmalMagnitude)|a(?:st|zy))|a(?:l(?:ignment|l(?:ocatedElementCount|Zeros))|rray(?:PropertyIsNativeTypeChecked)?)|ra(?:dix|wValue)|greatestFiniteMagnitude|m(?:in|emory|ax)|b(?:yteS(?:ize|wapped)|i(?:nade|tPattern|gEndian)|uffer|ase(?:Address)?))\b 402 | name 403 | support.variable.swift 404 | 405 | 406 | comment 407 | Properties in the standard library in Swift 2 only 408 | match 409 | (?<=\.)(?:boolValue|disposition|end|objectIdentifier|quickLookObject|start|valueType)\b 410 | name 411 | support.variable.swift 412 | 413 | 414 | comment 415 | Enum cases in the standard library - note that there is some overlap between these and the properties 416 | match 417 | (?<=\.)(?:s(?:calarValue|i(?:ze|gnalingNaN)|o(?:und|me)|uppressed|prite|et)|n(?:one|egative(?:Subnormal|Normal|Infinity|Zero))|c(?:ol(?:or|lection)|ustomized)|t(?:o(?:NearestOr(?:Even|AwayFromZero)|wardZero)|uple|ext)|i(?:nt|mage)|optional|d(?:ictionary|o(?:uble|wn))|u(?:Int|p|rl)|p(?:o(?:sitive(?:Subnormal|Normal|Infinity|Zero)|int)|lus)|e(?:rror|mptyInput)|view|quietNaN|float|a(?:ttributedString|wayFromZero)|r(?:ectangle|ange)|generated|minus|b(?:ool|ezierPath))\b 418 | name 419 | support.variable.swift 420 | 421 | 422 | 423 | builtin-types 424 | 425 | comment 426 | Types provided in the standard library 427 | patterns 428 | 429 | 430 | include 431 | #builtin-class-type 432 | 433 | 434 | include 435 | #builtin-enum-type 436 | 437 | 438 | include 439 | #builtin-protocol-type 440 | 441 | 442 | include 443 | #builtin-struct-type 444 | 445 | 446 | include 447 | #builtin-typealias 448 | 449 | 450 | match 451 | \bAny\b 452 | name 453 | support.type.any.swift 454 | 455 | 456 | repository 457 | 458 | builtin-class-type 459 | 460 | comment 461 | Builtin class types 462 | match 463 | \b(Managed(Buffer|ProtoBuffer)|NonObjectiveCBase|AnyGenerator)\b 464 | name 465 | support.class.swift 466 | 467 | builtin-enum-type 468 | 469 | patterns 470 | 471 | 472 | comment 473 | CommandLine is an enum, but it acts like a constant 474 | match 475 | \b(?:CommandLine|Process(?=\.))\b 476 | name 477 | support.constant.swift 478 | 479 | 480 | comment 481 | The return type of a function that never returns 482 | match 483 | \bNever\b 484 | name 485 | support.constant.never.swift 486 | 487 | 488 | comment 489 | Enum types in the standard library in Swift 3 490 | match 491 | \b(?:ImplicitlyUnwrappedOptional|Representation|MemoryLayout|FloatingPointClassification|SetIndexRepresentation|SetIteratorRepresentation|FloatingPointRoundingRule|UnicodeDecodingResult|Optional|DictionaryIndexRepresentation|AncestorRepresentation|DisplayStyle|PlaygroundQuickLook|Never|FloatingPointSign|Bit|DictionaryIteratorRepresentation)\b 492 | name 493 | support.type.swift 494 | 495 | 496 | comment 497 | Enum types in the standard library in Swift 2 only 498 | match 499 | \b(?:MirrorDisposition|QuickLookObject)\b 500 | name 501 | support.type.swift 502 | 503 | 504 | 505 | builtin-protocol-type 506 | 507 | patterns 508 | 509 | 510 | comment 511 | Protocols in the standard library in Swift 3 512 | match 513 | \b(?:Ra(?:n(?:domAccess(?:Collection|Indexable)|geReplaceable(?:Collection|Indexable))|wRepresentable)|M(?:irrorPath|utable(?:Collection|Indexable))|Bi(?:naryFloatingPoint|twiseOperations|directional(?:Collection|Indexable))|S(?:tr(?:ideable|eamable)|igned(?:Number|Integer)|e(?:tAlgebra|quence))|Hashable|C(?:o(?:llection|mparable)|ustom(?:Reflectable|StringConvertible|DebugStringConvertible|PlaygroundQuickLookable|LeafReflectable)|VarArg)|TextOutputStream|I(?:n(?:teger(?:Arithmetic)?|dexable(?:Base)?)|teratorProtocol)|OptionSet|Un(?:signedInteger|icodeCodec)|E(?:quatable|rror|xpressibleBy(?:BooleanLiteral|String(?:Interpolation|Literal)|NilLiteral|IntegerLiteral|DictionaryLiteral|UnicodeScalarLiteral|ExtendedGraphemeClusterLiteral|FloatLiteral|ArrayLiteral))|FloatingPoint|L(?:osslessStringConvertible|azy(?:SequenceProtocol|CollectionProtocol))|A(?:nyObject|bsoluteValuable))\b 514 | name 515 | support.type.swift 516 | 517 | 518 | comment 519 | Protocols in the standard library in Swift 2 only 520 | match 521 | \b(?:Ran(?:domAccessIndexType|geReplaceableCollectionType)|GeneratorType|M(?:irror(?:Type|PathType)|utable(?:Sliceable|CollectionType))|B(?:i(?:twiseOperationsType|directionalIndexType)|oolean(?:Type|LiteralConvertible))|S(?:tring(?:InterpolationConvertible|LiteralConvertible)|i(?:nkType|gned(?:NumberType|IntegerType))|e(?:tAlgebraType|quenceType)|liceable)|NilLiteralConvertible|C(?:ollectionType|VarArgType)|Inte(?:rvalType|ger(?:Type|LiteralConvertible|ArithmeticType))|O(?:utputStreamType|ptionSetType)|DictionaryLiteralConvertible|Un(?:signedIntegerType|icode(?:ScalarLiteralConvertible|CodecType))|E(?:rrorType|xten(?:sibleCollectionType|dedGraphemeClusterLiteralConvertible))|F(?:orwardIndexType|loat(?:ingPointType|LiteralConvertible))|A(?:nyCollectionType|rrayLiteralConvertible))\b 522 | name 523 | support.type.swift 524 | 525 | 526 | 527 | builtin-struct-type 528 | 529 | patterns 530 | 531 | 532 | comment 533 | Structs in the standard library in Swift 3 534 | match 535 | \b(?:R(?:e(?:peat(?:ed)?|versed(?:RandomAccess(?:Collection|Index)|Collection|Index))|an(?:domAccessSlice|ge(?:Replaceable(?:RandomAccessSlice|BidirectionalSlice|Slice)|Generator)?))|Generator(?:Sequence|OfOne)|M(?:irror|utable(?:Ran(?:domAccessSlice|geReplaceable(?:RandomAccessSlice|BidirectionalSlice|Slice))|BidirectionalSlice|Slice)|anagedBufferPointer)|B(?:idirectionalSlice|ool)|S(?:t(?:aticString|ri(?:ng|deT(?:hrough(?:Generator|Iterator)?|o(?:Generator|Iterator)?)))|et(?:I(?:ndex|terator))?|lice)|HalfOpenInterval|C(?:haracter(?:View)?|o(?:ntiguousArray|untable(?:Range|ClosedRange)|llectionOfOne)|OpaquePointer|losed(?:Range(?:I(?:ndex|terator))?|Interval)|VaListPointer)|I(?:n(?:t(?:16|8|32|64)?|d(?:ices|ex(?:ing(?:Generator|Iterator))?))|terator(?:Sequence|OverOne)?)|Zip2(?:Sequence|Iterator)|O(?:paquePointer|bjectIdentifier)|D(?:ictionary(?:I(?:ndex|terator)|Literal)?|ouble|efault(?:RandomAccessIndices|BidirectionalIndices|Indices))|U(?:n(?:safe(?:RawPointer|Mutable(?:RawPointer|BufferPointer|Pointer)|BufferPointer(?:Generator|Iterator)?|Pointer)|icodeScalar(?:View)?|foldSequence|managed)|TF(?:16(?:View)?|8(?:View)?|32)|Int(?:16|8|32|64)?)|Join(?:Generator|ed(?:Sequence|Iterator))|PermutationGenerator|E(?:numerate(?:Generator|Sequence|d(?:Sequence|Iterator))|mpty(?:Generator|Collection|Iterator))|Fl(?:oat(?:80)?|atten(?:Generator|BidirectionalCollection(?:Index)?|Sequence|Collection(?:Index)?|Iterator))|L(?:egacyChildren|azy(?:RandomAccessCollection|Map(?:RandomAccessCollection|Generator|BidirectionalCollection|Sequence|Collection|Iterator)|BidirectionalCollection|Sequence|Collection|Filter(?:Generator|BidirectionalCollection|Sequence|Collection|I(?:ndex|terator))))|A(?:ny(?:RandomAccessCollection|Generator|BidirectionalCollection|Sequence|Hashable|Collection|I(?:ndex|terator))|utoreleasingUnsafeMutablePointer|rray(?:Slice)?))\b 536 | name 537 | support.type.swift 538 | 539 | 540 | comment 541 | Structs in the standard library in Swift 2 only 542 | match 543 | \b(?:R(?:everse(?:RandomAccess(?:Collection|Index)|Collection|Index)|awByte)|Map(?:Generator|Sequence|Collection)|S(?:inkOf|etGenerator)|Zip2Generator|DictionaryGenerator|Filter(?:Generator|Sequence|Collection(?:Index)?)|LazyForwardCollection|Any(?:RandomAccessIndex|BidirectionalIndex|Forward(?:Collection|Index)))\b 544 | name 545 | support.type.swift 546 | 547 | 548 | 549 | builtin-typealias 550 | 551 | patterns 552 | 553 | 554 | comment 555 | Typealiases in the standard library in Swift 3 556 | match 557 | \b(?:Raw(?:Significand|Exponent|Value)|B(?:ooleanLiteralType|uffer|ase)|S(?:t(?:orage|r(?:i(?:ngLiteralType|de)|eam(?:1|2)))|ubSequence)|NativeBuffer|C(?:hild(?:ren)?|Bool|S(?:hort|ignedChar)|odeUnit|Char(?:16|32)?|Int|Double|Unsigned(?:Short|Char|Int|Long(?:Long)?)|Float|WideChar|Long(?:Long)?)|I(?:n(?:t(?:Max|egerLiteralType)|d(?:ices|ex(?:Distance)?))|terator)|Distance|U(?:n(?:icodeScalar(?:Type|Index|View|LiteralType)|foldFirstSequence)|TF(?:16(?:Index|View)|8Index)|IntMax)|E(?:lement(?:s)?|x(?:tendedGraphemeCluster(?:Type|LiteralType)|ponent))|V(?:oid|alue)|Key|Float(?:32|LiteralType|64)|AnyClass)\b 558 | name 559 | support.type.swift 560 | 561 | 562 | comment 563 | Typealiases in the standard library in Swift 2 only 564 | match 565 | \b(?:Generator|PlaygroundQuickLook|UWord|Word)\b 566 | name 567 | support.type.swift 568 | 569 | 570 | 571 | 572 | 573 | code-block 574 | 575 | begin 576 | \{ 577 | beginCaptures 578 | 579 | 0 580 | 581 | name 582 | punctuation.section.scope.begin.swift 583 | 584 | 585 | end 586 | \} 587 | endCaptures 588 | 589 | 0 590 | 591 | name 592 | punctuation.section.scope.end.swift 593 | 594 | 595 | patterns 596 | 597 | 598 | include 599 | $self 600 | 601 | 602 | 603 | comments 604 | 605 | patterns 606 | 607 | 608 | captures 609 | 610 | 1 611 | 612 | name 613 | punctuation.definition.comment.swift 614 | 615 | 616 | match 617 | \A^(#!).*$\n? 618 | name 619 | comment.line.number-sign.swift 620 | 621 | 622 | begin 623 | /\*\*(?!/) 624 | beginCaptures 625 | 626 | 0 627 | 628 | name 629 | punctuation.definition.comment.begin.swift 630 | 631 | 632 | end 633 | \*/ 634 | endCaptures 635 | 636 | 0 637 | 638 | name 639 | punctuation.definition.comment.end.swift 640 | 641 | 642 | name 643 | comment.block.documentation.swift 644 | patterns 645 | 646 | 647 | include 648 | #nested 649 | 650 | 651 | 652 | 653 | begin 654 | /\*: 655 | beginCaptures 656 | 657 | 0 658 | 659 | name 660 | punctuation.definition.comment.begin.swift 661 | 662 | 663 | end 664 | \*/ 665 | endCaptures 666 | 667 | 0 668 | 669 | name 670 | punctuation.definition.comment.end.swift 671 | 672 | 673 | name 674 | comment.block.documentation.playground.swift 675 | patterns 676 | 677 | 678 | include 679 | #nested 680 | 681 | 682 | 683 | 684 | begin 685 | /\* 686 | beginCaptures 687 | 688 | 0 689 | 690 | name 691 | punctuation.definition.comment.begin.swift 692 | 693 | 694 | end 695 | \*/ 696 | endCaptures 697 | 698 | 0 699 | 700 | name 701 | punctuation.definition.comment.end.swift 702 | 703 | 704 | name 705 | comment.block.swift 706 | patterns 707 | 708 | 709 | include 710 | #nested 711 | 712 | 713 | 714 | 715 | match 716 | \*/ 717 | name 718 | invalid.illegal.unexpected-end-of-block-comment.swift 719 | 720 | 721 | begin 722 | (^[ \t]+)?(?=//) 723 | beginCaptures 724 | 725 | 1 726 | 727 | name 728 | punctuation.whitespace.comment.leading.swift 729 | 730 | 731 | end 732 | (?!\G) 733 | patterns 734 | 735 | 736 | begin 737 | /// 738 | beginCaptures 739 | 740 | 0 741 | 742 | name 743 | punctuation.definition.comment.swift 744 | 745 | 746 | end 747 | ^ 748 | name 749 | comment.line.triple-slash.documentation.swift 750 | 751 | 752 | begin 753 | //: 754 | beginCaptures 755 | 756 | 0 757 | 758 | name 759 | punctuation.definition.comment.swift 760 | 761 | 762 | end 763 | ^ 764 | name 765 | comment.line.double-slash.documentation.swift 766 | 767 | 768 | begin 769 | // 770 | beginCaptures 771 | 772 | 0 773 | 774 | name 775 | punctuation.definition.comment.swift 776 | 777 | 778 | end 779 | ^ 780 | name 781 | comment.line.double-slash.swift 782 | 783 | 784 | 785 | 786 | repository 787 | 788 | nested 789 | 790 | begin 791 | /\* 792 | end 793 | \*/ 794 | patterns 795 | 796 | 797 | include 798 | #nested 799 | 800 | 801 | 802 | 803 | 804 | compiler-control 805 | 806 | patterns 807 | 808 | 809 | begin 810 | ^\s*(#)(if|elseif)\s+(false)\b.*?(?=$|//|/\*) 811 | beginCaptures 812 | 813 | 0 814 | 815 | name 816 | meta.preprocessor.conditional.swift 817 | 818 | 1 819 | 820 | name 821 | punctuation.definition.preprocessor.swift 822 | 823 | 2 824 | 825 | name 826 | keyword.control.preprocessor.conditional.swift 827 | 828 | 3 829 | 830 | name 831 | constant.language.boolean.swift 832 | 833 | 834 | contentName 835 | comment.block.preprocessor.swift 836 | end 837 | (?=^\s*(#(elseif|else|endif)\b)) 838 | 839 | 840 | begin 841 | ^\s*(#)(if|elseif)\s+ 842 | captures 843 | 844 | 1 845 | 846 | name 847 | punctuation.definition.preprocessor.swift 848 | 849 | 2 850 | 851 | name 852 | keyword.control.preprocessor.conditional.swift 853 | 854 | 855 | end 856 | (?=\s*(?://|/\*))|$ 857 | name 858 | meta.preprocessor.conditional.swift 859 | patterns 860 | 861 | 862 | match 863 | (&&|\|\|) 864 | name 865 | keyword.operator.logical.swift 866 | 867 | 868 | match 869 | \b(true|false)\b 870 | name 871 | constant.language.boolean.swift 872 | 873 | 874 | captures 875 | 876 | 1 877 | 878 | name 879 | keyword.other.condition.swift 880 | 881 | 2 882 | 883 | name 884 | punctuation.definition.parameters.begin.swift 885 | 886 | 3 887 | 888 | name 889 | support.constant.platform.architecture.swift 890 | 891 | 4 892 | 893 | name 894 | punctuation.definition.parameters.end.swift 895 | 896 | 897 | match 898 | \b(arch)\s*(\()\s*(?:(arm|arm64|powerpc64|powerpc64le|i386|x86_64|s390x)|\w+)\s*(\)) 899 | 900 | 901 | captures 902 | 903 | 1 904 | 905 | name 906 | keyword.other.condition.swift 907 | 908 | 2 909 | 910 | name 911 | punctuation.definition.parameters.begin.swift 912 | 913 | 3 914 | 915 | name 916 | support.constant.platform.os.swift 917 | 918 | 4 919 | 920 | name 921 | punctuation.definition.parameters.end.swift 922 | 923 | 924 | match 925 | \b(os)\s*(\()\s*(?:(macOS|OSX|iOS|tvOS|watchOS|Android|Linux|FreeBSD|Windows|PS4)|\w+)\s*(\)) 926 | 927 | 928 | begin 929 | \b(swift)\s*(\() 930 | beginCaptures 931 | 932 | 1 933 | 934 | name 935 | keyword.other.condition.swift 936 | 937 | 2 938 | 939 | name 940 | punctuation.definition.parameters.begin.swift 941 | 942 | 943 | end 944 | (\))|$ 945 | endCaptures 946 | 947 | 1 948 | 949 | name 950 | punctuation.definition.parameters.end.swift 951 | 952 | 953 | patterns 954 | 955 | 956 | match 957 | >= 958 | name 959 | keyword.operator.comparison.swift 960 | 961 | 962 | match 963 | \b[0-9]+(?:\.[0-9]+)*\b 964 | name 965 | constant.numeric.swift 966 | 967 | 968 | 969 | 970 | 971 | 972 | captures 973 | 974 | 1 975 | 976 | name 977 | punctuation.definition.preprocessor.swift 978 | 979 | 2 980 | 981 | name 982 | keyword.control.preprocessor.conditional.swift 983 | 984 | 3 985 | 986 | patterns 987 | 988 | 989 | match 990 | \S+ 991 | name 992 | invalid.illegal.character-not-allowed-here.swift 993 | 994 | 995 | 996 | 997 | match 998 | ^\s*(#)(else|endif)(.*?)(?=$|//|/\*) 999 | name 1000 | meta.preprocessor.conditional.swift 1001 | 1002 | 1003 | captures 1004 | 1005 | 1 1006 | 1007 | name 1008 | punctuation.definition.preprocessor.swift 1009 | 1010 | 2 1011 | 1012 | name 1013 | keyword.control.preprocessor.sourcelocation.swift 1014 | 1015 | 4 1016 | 1017 | name 1018 | punctuation.definition.parameters.begin.swift 1019 | 1020 | 5 1021 | 1022 | patterns 1023 | 1024 | 1025 | begin 1026 | (file)\s*(:)\s*(?=") 1027 | beginCaptures 1028 | 1029 | 1 1030 | 1031 | name 1032 | support.variable.parameter.swift 1033 | 1034 | 2 1035 | 1036 | name 1037 | punctuation.separator.key-value.swift 1038 | 1039 | 1040 | end 1041 | (?!\G) 1042 | patterns 1043 | 1044 | 1045 | include 1046 | #literals 1047 | 1048 | 1049 | 1050 | 1051 | captures 1052 | 1053 | 1 1054 | 1055 | name 1056 | support.variable.parameter.swift 1057 | 1058 | 2 1059 | 1060 | name 1061 | punctuation.separator.key-value.swift 1062 | 1063 | 3 1064 | 1065 | name 1066 | constant.numeric.integer.swift 1067 | 1068 | 1069 | match 1070 | (line)\s*(:)\s*([0-9]+) 1071 | 1072 | 1073 | match 1074 | , 1075 | name 1076 | punctuation.separator.parameters.swift 1077 | 1078 | 1079 | match 1080 | \S+ 1081 | name 1082 | invalid.illegal.character-not-allowed-here.swift 1083 | 1084 | 1085 | 1086 | 6 1087 | 1088 | name 1089 | punctuation.definition.parameters.begin.swift 1090 | 1091 | 7 1092 | 1093 | patterns 1094 | 1095 | 1096 | match 1097 | \S+ 1098 | name 1099 | invalid.illegal.character-not-allowed-here.swift 1100 | 1101 | 1102 | 1103 | 1104 | match 1105 | ^\s*(#)(sourceLocation)((\()([^)]*)(\)))(.*?)(?=$|//|/\*) 1106 | name 1107 | meta.preprocessor.sourcelocation.swift 1108 | 1109 | 1110 | 1111 | declarations 1112 | 1113 | patterns 1114 | 1115 | 1116 | include 1117 | #function 1118 | 1119 | 1120 | include 1121 | #function-initializer 1122 | 1123 | 1124 | include 1125 | #import 1126 | 1127 | 1128 | include 1129 | #operator 1130 | 1131 | 1132 | include 1133 | #precedencegroup 1134 | 1135 | 1136 | include 1137 | #protocol 1138 | 1139 | 1140 | include 1141 | #type 1142 | 1143 | 1144 | include 1145 | #extension 1146 | 1147 | 1148 | include 1149 | #typealias 1150 | 1151 | 1152 | repository 1153 | 1154 | available-types 1155 | 1156 | patterns 1157 | 1158 | 1159 | include 1160 | #comments 1161 | 1162 | 1163 | include 1164 | #builtin-types 1165 | 1166 | 1167 | include 1168 | #attributes 1169 | 1170 | 1171 | match 1172 | \b(?:throws|rethrows)\b 1173 | name 1174 | keyword.control.exception.swift 1175 | 1176 | 1177 | match 1178 | \binout\b 1179 | name 1180 | storage.modifier.swift 1181 | 1182 | 1183 | match 1184 | \bSelf\b 1185 | name 1186 | variable.language.swift 1187 | 1188 | 1189 | captures 1190 | 1191 | 1 1192 | 1193 | name 1194 | keyword.operator.type.function.swift 1195 | 1196 | 1197 | match 1198 | (?<![/=\-+!*%<>&|\^~.])(->)(?![/=\-+!*%<>&|\^~.]) 1199 | 1200 | 1201 | captures 1202 | 1203 | 1 1204 | 1205 | name 1206 | keyword.operator.type.composition.swift 1207 | 1208 | 1209 | comment 1210 | Swift 3: A & B 1211 | match 1212 | (?<![/=\-+!*%<>&|\^~.])(&)(?![/=\-+!*%<>&|\^~.]) 1213 | 1214 | 1215 | match 1216 | [?!] 1217 | name 1218 | keyword.operator.type.optional.swift 1219 | 1220 | 1221 | match 1222 | \.\.\. 1223 | name 1224 | keyword.operator.function.variadic-parameter.swift 1225 | 1226 | 1227 | comment 1228 | Swift 2: protocol<A, B> 1229 | match 1230 | \bprotocol\b 1231 | name 1232 | keyword.operator.type.composition.swift 1233 | 1234 | 1235 | match 1236 | (?<=\.)(?:Protocol|Type)\b 1237 | name 1238 | keyword.operator.type.metatype.swift 1239 | 1240 | 1241 | include 1242 | #tuple-type 1243 | 1244 | 1245 | include 1246 | #collection-type 1247 | 1248 | 1249 | include 1250 | #generic-argument-clause 1251 | 1252 | 1253 | repository 1254 | 1255 | collection-type 1256 | 1257 | begin 1258 | \[ 1259 | beginCaptures 1260 | 1261 | 0 1262 | 1263 | name 1264 | punctuation.section.collection-type.begin.swift 1265 | 1266 | 1267 | comment 1268 | array and dictionary types [Value] and [Key: Value] 1269 | end 1270 | \]|(?=[>){}]) 1271 | endCaptures 1272 | 1273 | 0 1274 | 1275 | name 1276 | punctuation.section.collection-type.end.swift 1277 | 1278 | 1279 | patterns 1280 | 1281 | 1282 | include 1283 | #available-types 1284 | 1285 | 1286 | begin 1287 | : 1288 | beginCaptures 1289 | 1290 | 0 1291 | 1292 | name 1293 | punctuation.separator.key-value.swift 1294 | 1295 | 1296 | end 1297 | (?=\]|[>){}]) 1298 | patterns 1299 | 1300 | 1301 | match 1302 | : 1303 | name 1304 | invalid.illegal.extra-colon-in-dictionary-type.swift 1305 | 1306 | 1307 | include 1308 | #available-types 1309 | 1310 | 1311 | 1312 | 1313 | 1314 | tuple-type 1315 | 1316 | begin 1317 | \( 1318 | beginCaptures 1319 | 1320 | 0 1321 | 1322 | name 1323 | punctuation.section.tuple-type.begin.swift 1324 | 1325 | 1326 | end 1327 | \)|(?=[>\]{}]) 1328 | endCaptures 1329 | 1330 | 0 1331 | 1332 | name 1333 | punctuation.section.tuple-type.end.swift 1334 | 1335 | 1336 | patterns 1337 | 1338 | 1339 | include 1340 | #available-types 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | extension 1347 | 1348 | begin 1349 | \b(extension)\s+((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>)) 1350 | beginCaptures 1351 | 1352 | 1 1353 | 1354 | name 1355 | storage.type.$1.swift 1356 | 1357 | 2 1358 | 1359 | name 1360 | entity.name.type.swift 1361 | patterns 1362 | 1363 | 1364 | include 1365 | #available-types 1366 | 1367 | 1368 | 1369 | 3 1370 | 1371 | name 1372 | punctuation.definition.identifier.swift 1373 | 1374 | 4 1375 | 1376 | name 1377 | punctuation.definition.identifier.swift 1378 | 1379 | 1380 | end 1381 | (?<=\}) 1382 | name 1383 | meta.definition.type.$1.swift 1384 | patterns 1385 | 1386 | 1387 | include 1388 | #comments 1389 | 1390 | 1391 | comment 1392 | SE-0143: Conditional Conformances 1393 | include 1394 | #generic-where-clause 1395 | 1396 | 1397 | include 1398 | #inheritance-clause 1399 | 1400 | 1401 | begin 1402 | \{ 1403 | beginCaptures 1404 | 1405 | 0 1406 | 1407 | name 1408 | punctuation.definition.type.begin.swift 1409 | 1410 | 1411 | end 1412 | \} 1413 | endCaptures 1414 | 1415 | 0 1416 | 1417 | name 1418 | punctuation.definition.type.end.swift 1419 | 1420 | 1421 | name 1422 | meta.definition.type.body.swift 1423 | patterns 1424 | 1425 | 1426 | include 1427 | $self 1428 | 1429 | 1430 | 1431 | 1432 | 1433 | function 1434 | 1435 | begin 1436 | (?x) 1437 | \b 1438 | (func) 1439 | \s+ 1440 | ( 1441 | (?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>) 1442 | | (?: 1443 | ( 1444 | (?<oph> # operator-head 1445 | [/=\-+!*%<>&|^~?] 1446 | | [\x{00A1}-\x{00A7}] 1447 | | [\x{00A9}\x{00AB}] 1448 | | [\x{00AC}\x{00AE}] 1449 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 1450 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 1451 | | [\x{2030}-\x{203E}] 1452 | | [\x{2041}-\x{2053}] 1453 | | [\x{2055}-\x{205E}] 1454 | | [\x{2190}-\x{23FF}] 1455 | | [\x{2500}-\x{2775}] 1456 | | [\x{2794}-\x{2BFF}] 1457 | | [\x{2E00}-\x{2E7F}] 1458 | | [\x{3001}-\x{3003}] 1459 | | [\x{3008}-\x{3030}] 1460 | ) 1461 | ( 1462 | \g<oph> 1463 | | (?<opc> # operator-character 1464 | [\x{0300}-\x{036F}] 1465 | | [\x{1DC0}-\x{1DFF}] 1466 | | [\x{20D0}-\x{20FF}] 1467 | | [\x{FE00}-\x{FE0F}] 1468 | | [\x{FE20}-\x{FE2F}] 1469 | | [\x{E0100}-\x{E01EF}] 1470 | ) 1471 | )* 1472 | ) 1473 | | ( \. ( \g<oph> | \g<opc> | \. )+ ) # Dot operators 1474 | ) 1475 | ) 1476 | \s* 1477 | (?=\(|<) 1478 | 1479 | beginCaptures 1480 | 1481 | 1 1482 | 1483 | name 1484 | storage.type.function.swift 1485 | 1486 | 2 1487 | 1488 | name 1489 | entity.name.function.swift 1490 | 1491 | 3 1492 | 1493 | name 1494 | punctuation.definition.identifier.swift 1495 | 1496 | 4 1497 | 1498 | name 1499 | punctuation.definition.identifier.swift 1500 | 1501 | 1502 | end 1503 | (?<=\})|$(?# functions in protocol declarations or generated interfaces have no body) 1504 | name 1505 | meta.definition.function.swift 1506 | patterns 1507 | 1508 | 1509 | include 1510 | #comments 1511 | 1512 | 1513 | include 1514 | #generic-parameter-clause 1515 | 1516 | 1517 | include 1518 | #parameter-clause 1519 | 1520 | 1521 | include 1522 | #function-result 1523 | 1524 | 1525 | match 1526 | \b(?:throws|rethrows)\b 1527 | name 1528 | keyword.control.exception.swift 1529 | 1530 | 1531 | comment 1532 | Swift 3: generic constraints after the parameters and return type 1533 | include 1534 | #generic-where-clause 1535 | 1536 | 1537 | begin 1538 | (\{) 1539 | beginCaptures 1540 | 1541 | 1 1542 | 1543 | name 1544 | punctuation.section.function.begin.swift 1545 | 1546 | 1547 | end 1548 | (\}) 1549 | endCaptures 1550 | 1551 | 1 1552 | 1553 | name 1554 | punctuation.section.function.end.swift 1555 | 1556 | 1557 | name 1558 | meta.definition.function.body.swift 1559 | patterns 1560 | 1561 | 1562 | include 1563 | $self 1564 | 1565 | 1566 | 1567 | 1568 | 1569 | function-initializer 1570 | 1571 | begin 1572 | (?<!\.)\b(init[?!]*(?# only one is valid, but we want the in⇥ snippet to produce something that looks good))\s*(?=\(|<) 1573 | beginCaptures 1574 | 1575 | 1 1576 | 1577 | name 1578 | storage.type.function.swift 1579 | patterns 1580 | 1581 | 1582 | match 1583 | (?<=[?!])[?!]+ 1584 | name 1585 | invalid.illegal.character-not-allowed-here.swift 1586 | 1587 | 1588 | 1589 | 1590 | end 1591 | (?<=\})|$ 1592 | name 1593 | meta.definition.function.initializer.swift 1594 | patterns 1595 | 1596 | 1597 | include 1598 | #comments 1599 | 1600 | 1601 | include 1602 | #generic-parameter-clause 1603 | 1604 | 1605 | include 1606 | #parameter-clause 1607 | 1608 | 1609 | match 1610 | \b(?:throws|rethrows)\b 1611 | name 1612 | keyword.control.exception.swift 1613 | 1614 | 1615 | comment 1616 | Swift 3: generic constraints after the parameters and return type 1617 | include 1618 | #generic-where-clause 1619 | 1620 | 1621 | begin 1622 | (\{) 1623 | beginCaptures 1624 | 1625 | 1 1626 | 1627 | name 1628 | punctuation.section.function.begin.swift 1629 | 1630 | 1631 | end 1632 | (\}) 1633 | endCaptures 1634 | 1635 | 1 1636 | 1637 | name 1638 | punctuation.section.function.end.swift 1639 | 1640 | 1641 | name 1642 | meta.definition.function.body.swift 1643 | patterns 1644 | 1645 | 1646 | include 1647 | $self 1648 | 1649 | 1650 | 1651 | 1652 | 1653 | function-result 1654 | 1655 | begin 1656 | (?<![/=\-+!*%<>&|\^~.])(->)(?![/=\-+!*%<>&|\^~.])\s* 1657 | beginCaptures 1658 | 1659 | 1 1660 | 1661 | name 1662 | keyword.operator.function-result.swift 1663 | 1664 | 1665 | end 1666 | (?!\G)(?=\{|\bwhere\b|;)|$ 1667 | name 1668 | meta.function-result.swift 1669 | patterns 1670 | 1671 | 1672 | include 1673 | #available-types 1674 | 1675 | 1676 | 1677 | generic-argument-clause 1678 | 1679 | begin 1680 | < 1681 | beginCaptures 1682 | 1683 | 0 1684 | 1685 | name 1686 | punctuation.separator.generic-argument-clause.begin.swift 1687 | 1688 | 1689 | end 1690 | >|(?=[)\]{}]) 1691 | endCaptures 1692 | 1693 | 0 1694 | 1695 | name 1696 | punctuation.separator.generic-argument-clause.end.swift 1697 | 1698 | 1699 | name 1700 | meta.generic-argument-clause.swift 1701 | patterns 1702 | 1703 | 1704 | include 1705 | #available-types 1706 | 1707 | 1708 | 1709 | generic-parameter-clause 1710 | 1711 | begin 1712 | < 1713 | beginCaptures 1714 | 1715 | 0 1716 | 1717 | name 1718 | punctuation.separator.generic-parameter-clause.begin.swift 1719 | 1720 | 1721 | end 1722 | >|(?=[^\w\d:<>\s,=&`])(?# characters besides these are never valid in a generic param list -- even if it's not really a valid clause, we should stop trying to parse it if we see one of them.) 1723 | endCaptures 1724 | 1725 | 0 1726 | 1727 | name 1728 | punctuation.separator.generic-parameter-clause.end.swift 1729 | 1730 | 1731 | name 1732 | meta.generic-parameter-clause.swift 1733 | patterns 1734 | 1735 | 1736 | include 1737 | #comments 1738 | 1739 | 1740 | comment 1741 | Swift 2: constraints inside the generic param list 1742 | include 1743 | #generic-where-clause 1744 | 1745 | 1746 | captures 1747 | 1748 | 1 1749 | 1750 | name 1751 | variable.language.generic-parameter.swift 1752 | 1753 | 1754 | match 1755 | \b((?!\d)\w[\w\d]*)\b 1756 | 1757 | 1758 | match 1759 | , 1760 | name 1761 | punctuation.separator.generic-parameters.swift 1762 | 1763 | 1764 | begin 1765 | (:)\s* 1766 | beginCaptures 1767 | 1768 | 1 1769 | 1770 | name 1771 | punctuation.separator.generic-parameter-constraint.swift 1772 | 1773 | 1774 | end 1775 | (?=[,>]|(?!\G)\bwhere\b) 1776 | name 1777 | meta.generic-parameter-constraint.swift 1778 | patterns 1779 | 1780 | 1781 | begin 1782 | \G 1783 | end 1784 | (?=[,>]|(?!\G)\bwhere\b) 1785 | name 1786 | entity.other.inherited-class.swift 1787 | patterns 1788 | 1789 | 1790 | include 1791 | #type-identifier 1792 | 1793 | 1794 | 1795 | 1796 | 1797 | 1798 | 1799 | generic-where-clause 1800 | 1801 | begin 1802 | \b(where)\b\s* 1803 | beginCaptures 1804 | 1805 | 1 1806 | 1807 | name 1808 | keyword.other.generic-constraint-introducer.swift 1809 | 1810 | 1811 | end 1812 | (?!\G)$|(?=[>{};\n]|//|/\*) 1813 | name 1814 | meta.generic-where-clause.swift 1815 | patterns 1816 | 1817 | 1818 | include 1819 | #comments 1820 | 1821 | 1822 | include 1823 | #requirement-list 1824 | 1825 | 1826 | repository 1827 | 1828 | requirement-list 1829 | 1830 | begin 1831 | \G|,\s* 1832 | end 1833 | (?=[,>{};\n]|//|/\*) 1834 | patterns 1835 | 1836 | 1837 | include 1838 | #comments 1839 | 1840 | 1841 | include 1842 | #constraint 1843 | 1844 | 1845 | include 1846 | #available-types 1847 | 1848 | 1849 | begin 1850 | (?<![/=\-+!*%<>&|\^~.])(==)(?![/=\-+!*%<>&|\^~.]) 1851 | beginCaptures 1852 | 1853 | 1 1854 | 1855 | name 1856 | keyword.operator.generic-constraint.same-type.swift 1857 | 1858 | 1859 | end 1860 | (?=\s*[,>{};\n]|//|/\*) 1861 | name 1862 | meta.generic-where-clause.same-type-requirement.swift 1863 | patterns 1864 | 1865 | 1866 | include 1867 | #available-types 1868 | 1869 | 1870 | 1871 | 1872 | begin 1873 | (?<![/=\-+!*%<>&|\^~.])(:)(?![/=\-+!*%<>&|\^~.]) 1874 | beginCaptures 1875 | 1876 | 1 1877 | 1878 | name 1879 | keyword.operator.generic-constraint.conforms-to.swift 1880 | 1881 | 1882 | end 1883 | (?=\s*[,>{};\n]|//|/\*) 1884 | name 1885 | meta.generic-where-clause.conformance-requirement.swift 1886 | patterns 1887 | 1888 | 1889 | begin 1890 | \G\s* 1891 | contentName 1892 | entity.other.inherited-class.swift 1893 | end 1894 | (?=\s*[,>{};\n]|//|/\*) 1895 | patterns 1896 | 1897 | 1898 | include 1899 | #available-types 1900 | 1901 | 1902 | 1903 | 1904 | 1905 | 1906 | 1907 | 1908 | 1909 | import 1910 | 1911 | begin 1912 | (?<!\.)\b(import)\s+ 1913 | beginCaptures 1914 | 1915 | 1 1916 | 1917 | name 1918 | keyword.control.import.swift 1919 | 1920 | 1921 | end 1922 | (;)|$\n?|(?=//|/\*) 1923 | endCaptures 1924 | 1925 | 1 1926 | 1927 | name 1928 | punctuation.terminator.statement.swift 1929 | 1930 | 1931 | name 1932 | meta.import.swift 1933 | patterns 1934 | 1935 | 1936 | begin 1937 | \G(?!;|$|//|/\*)(?:(typealias|struct|class|enum|protocol|var|func)\s+)? 1938 | beginCaptures 1939 | 1940 | 1 1941 | 1942 | name 1943 | storage.modifier.swift 1944 | 1945 | 1946 | end 1947 | (?=;|$|//|/\*) 1948 | patterns 1949 | 1950 | 1951 | captures 1952 | 1953 | 1 1954 | 1955 | name 1956 | punctuation.definition.identifier.swift 1957 | 1958 | 2 1959 | 1960 | name 1961 | punctuation.definition.identifier.swift 1962 | 1963 | 1964 | match 1965 | (?x) 1966 | (?<=\G|\.) 1967 | (?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>) 1968 | 1969 | name 1970 | entity.name.type.swift 1971 | 1972 | 1973 | match 1974 | (?x) 1975 | (?<=\G|\.) 1976 | \$[0-9]+ 1977 | 1978 | name 1979 | entity.name.type.swift 1980 | 1981 | 1982 | captures 1983 | 1984 | 1 1985 | 1986 | patterns 1987 | 1988 | 1989 | match 1990 | \. 1991 | name 1992 | invalid.illegal.dot-not-allowed-here.swift 1993 | 1994 | 1995 | 1996 | 1997 | match 1998 | (?x) 1999 | (?<=\G|\.) 2000 | (?: 2001 | ( 2002 | (?<oph> # operator-head 2003 | [/=\-+!*%<>&|^~?] 2004 | | [\x{00A1}-\x{00A7}] 2005 | | [\x{00A9}\x{00AB}] 2006 | | [\x{00AC}\x{00AE}] 2007 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 2008 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 2009 | | [\x{2030}-\x{203E}] 2010 | | [\x{2041}-\x{2053}] 2011 | | [\x{2055}-\x{205E}] 2012 | | [\x{2190}-\x{23FF}] 2013 | | [\x{2500}-\x{2775}] 2014 | | [\x{2794}-\x{2BFF}] 2015 | | [\x{2E00}-\x{2E7F}] 2016 | | [\x{3001}-\x{3003}] 2017 | | [\x{3008}-\x{3030}] 2018 | ) 2019 | ( 2020 | \g<oph> 2021 | | (?<opc> # operator-character 2022 | [\x{0300}-\x{036F}] 2023 | | [\x{1DC0}-\x{1DFF}] 2024 | | [\x{20D0}-\x{20FF}] 2025 | | [\x{FE00}-\x{FE0F}] 2026 | | [\x{FE20}-\x{FE2F}] 2027 | | [\x{E0100}-\x{E01EF}] 2028 | ) 2029 | )* 2030 | ) 2031 | | ( \. ( \g<oph> | \g<opc> | \. )+ ) # Dot operators 2032 | ) 2033 | (?=\.|;|$|//|/\*|\s) 2034 | 2035 | name 2036 | entity.name.type.swift 2037 | 2038 | 2039 | match 2040 | \. 2041 | name 2042 | punctuation.separator.import.swift 2043 | 2044 | 2045 | begin 2046 | (?!\s*(;|$|//|/\*)) 2047 | end 2048 | (?=\s*(;|$|//|/\*)) 2049 | name 2050 | invalid.illegal.character-not-allowed-here.swift 2051 | 2052 | 2053 | 2054 | 2055 | 2056 | inheritance-clause 2057 | 2058 | begin 2059 | (:)(?=\s*\{)|(:)\s* 2060 | beginCaptures 2061 | 2062 | 1 2063 | 2064 | name 2065 | invalid.illegal.empty-inheritance-clause.swift 2066 | 2067 | 2 2068 | 2069 | name 2070 | punctuation.separator.inheritance-clause.swift 2071 | 2072 | 2073 | end 2074 | (?!\G)$|(?=[={}]|(?!\G)\bwhere\b) 2075 | name 2076 | meta.inheritance-clause.swift 2077 | patterns 2078 | 2079 | 2080 | begin 2081 | \bclass\b 2082 | beginCaptures 2083 | 2084 | 0 2085 | 2086 | name 2087 | storage.type.class.swift 2088 | 2089 | 2090 | end 2091 | (?=[={}]|(?!\G)\bwhere\b) 2092 | patterns 2093 | 2094 | 2095 | include 2096 | #comments 2097 | 2098 | 2099 | include 2100 | #more-types 2101 | 2102 | 2103 | 2104 | 2105 | begin 2106 | \G 2107 | end 2108 | (?!\G)$|(?=[={}]|(?!\G)\bwhere\b) 2109 | patterns 2110 | 2111 | 2112 | include 2113 | #comments 2114 | 2115 | 2116 | include 2117 | #inherited-type 2118 | 2119 | 2120 | include 2121 | #more-types 2122 | 2123 | 2124 | 2125 | 2126 | repository 2127 | 2128 | inherited-type 2129 | 2130 | begin 2131 | (?=[`\p{L}_]) 2132 | end 2133 | (?!\G) 2134 | name 2135 | entity.other.inherited-class.swift 2136 | patterns 2137 | 2138 | 2139 | include 2140 | #type-identifier 2141 | 2142 | 2143 | 2144 | more-types 2145 | 2146 | begin 2147 | ,\s* 2148 | end 2149 | (?!\G)(?!//|/\*)|(?=[,={}]|(?!\G)\bwhere\b) 2150 | name 2151 | meta.inheritance-list.more-types 2152 | patterns 2153 | 2154 | 2155 | include 2156 | #comments 2157 | 2158 | 2159 | include 2160 | #inherited-type 2161 | 2162 | 2163 | include 2164 | #more-types 2165 | 2166 | 2167 | 2168 | 2169 | 2170 | operator 2171 | 2172 | begin 2173 | (?x) 2174 | (?: 2175 | \b(prefix|infix|postfix) 2176 | \s+ 2177 | )? 2178 | \b 2179 | (operator) 2180 | \s+ 2181 | ( 2182 | ( 2183 | (?<oph> # operator-head 2184 | [/=\-+!*%<>&|^~?] 2185 | | [\x{00A1}-\x{00A7}] 2186 | | [\x{00A9}\x{00AB}] 2187 | | [\x{00AC}\x{00AE}] 2188 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 2189 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 2190 | | [\x{2030}-\x{203E}] 2191 | | [\x{2041}-\x{2053}] 2192 | | [\x{2055}-\x{205E}] 2193 | | [\x{2190}-\x{23FF}] 2194 | | [\x{2500}-\x{2775}] 2195 | | [\x{2794}-\x{2BFF}] 2196 | | [\x{2E00}-\x{2E7F}] 2197 | | [\x{3001}-\x{3003}] 2198 | | [\x{3008}-\x{3030}] 2199 | ) 2200 | ( 2201 | \g<oph> 2202 | | \. # Invalid dot 2203 | | (?<opc> # operator-character 2204 | [\x{0300}-\x{036F}] 2205 | | [\x{1DC0}-\x{1DFF}] 2206 | | [\x{20D0}-\x{20FF}] 2207 | | [\x{FE00}-\x{FE0F}] 2208 | | [\x{FE20}-\x{FE2F}] 2209 | | [\x{E0100}-\x{E01EF}] 2210 | ) 2211 | )*+ 2212 | ) 2213 | | ( \. ( \g<oph> | \g<opc> | \. )++ ) # Dot operators 2214 | ) 2215 | \s* 2216 | 2217 | beginCaptures 2218 | 2219 | 1 2220 | 2221 | name 2222 | storage.modifier.swift 2223 | 2224 | 2 2225 | 2226 | name 2227 | storage.type.function.operator.swift 2228 | 2229 | 3 2230 | 2231 | name 2232 | entity.name.function.operator.swift 2233 | 2234 | 4 2235 | 2236 | patterns 2237 | 2238 | 2239 | match 2240 | \. 2241 | name 2242 | invalid.illegal.dot-not-allowed-here.swift 2243 | 2244 | 2245 | 2246 | 2247 | end 2248 | (;)|$\n?|(?=//|/\*) 2249 | endCaptures 2250 | 2251 | 1 2252 | 2253 | name 2254 | punctuation.terminator.statement.swift 2255 | 2256 | 2257 | name 2258 | meta.definition.operator.swift 2259 | patterns 2260 | 2261 | 2262 | include 2263 | #swift2 2264 | 2265 | 2266 | include 2267 | #swift3 2268 | 2269 | 2270 | match 2271 | ((?!$|;|//|/\*)\S)+ 2272 | name 2273 | invalid.illegal.character-not-allowed-here.swift 2274 | 2275 | 2276 | repository 2277 | 2278 | swift2 2279 | 2280 | begin 2281 | \G(\{) 2282 | beginCaptures 2283 | 2284 | 1 2285 | 2286 | name 2287 | punctuation.definition.operator.begin.swift 2288 | 2289 | 2290 | end 2291 | (\}) 2292 | endCaptures 2293 | 2294 | 1 2295 | 2296 | name 2297 | punctuation.definition.operator.end.swift 2298 | 2299 | 2300 | patterns 2301 | 2302 | 2303 | include 2304 | #comments 2305 | 2306 | 2307 | captures 2308 | 2309 | 1 2310 | 2311 | name 2312 | storage.modifier.swift 2313 | 2314 | 2 2315 | 2316 | name 2317 | keyword.other.operator.associativity.swift 2318 | 2319 | 2320 | match 2321 | \b(associativity)\s+(left|right)\b 2322 | 2323 | 2324 | captures 2325 | 2326 | 1 2327 | 2328 | name 2329 | storage.modifier.swift 2330 | 2331 | 2 2332 | 2333 | name 2334 | constant.numeric.integer.swift 2335 | 2336 | 2337 | match 2338 | \b(precedence)\s+([0-9]+)\b 2339 | 2340 | 2341 | captures 2342 | 2343 | 1 2344 | 2345 | name 2346 | storage.modifier.swift 2347 | 2348 | 2349 | match 2350 | \b(assignment)\b 2351 | 2352 | 2353 | 2354 | swift3 2355 | 2356 | captures 2357 | 2358 | 2 2359 | 2360 | name 2361 | entity.other.inherited-class.swift 2362 | patterns 2363 | 2364 | 2365 | include 2366 | #types-precedencegroup 2367 | 2368 | 2369 | 2370 | 3 2371 | 2372 | name 2373 | punctuation.definition.identifier.swift 2374 | 2375 | 4 2376 | 2377 | name 2378 | punctuation.definition.identifier.swift 2379 | 2380 | 2381 | match 2382 | \G(:)\s*((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>)) 2383 | 2384 | 2385 | 2386 | parameter-clause 2387 | 2388 | begin 2389 | (\() 2390 | beginCaptures 2391 | 2392 | 1 2393 | 2394 | name 2395 | punctuation.definition.parameters.begin.swift 2396 | 2397 | 2398 | end 2399 | (\)) 2400 | endCaptures 2401 | 2402 | 1 2403 | 2404 | name 2405 | punctuation.definition.parameters.end.swift 2406 | 2407 | 2408 | name 2409 | meta.parameter-clause.swift 2410 | patterns 2411 | 2412 | 2413 | include 2414 | #parameter-list 2415 | 2416 | 2417 | 2418 | parameter-list 2419 | 2420 | patterns 2421 | 2422 | 2423 | captures 2424 | 2425 | 1 2426 | 2427 | name 2428 | entity.name.function.swift 2429 | 2430 | 2 2431 | 2432 | name 2433 | punctuation.definition.identifier.swift 2434 | 2435 | 3 2436 | 2437 | name 2438 | punctuation.definition.identifier.swift 2439 | 2440 | 4 2441 | 2442 | name 2443 | variable.parameter.function.swift 2444 | 2445 | 5 2446 | 2447 | name 2448 | punctuation.definition.identifier.swift 2449 | 2450 | 6 2451 | 2452 | name 2453 | punctuation.definition.identifier.swift 2454 | 2455 | 2456 | comment 2457 | External parameter labels are considered part of the function name 2458 | match 2459 | ((?<q1>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q1>))\s+((?<q2>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q2>))(?=\s*:) 2460 | 2461 | 2462 | captures 2463 | 2464 | 1 2465 | 2466 | name 2467 | variable.parameter.function.swift 2468 | 2469 | 2 2470 | 2471 | name 2472 | entity.name.function.swift 2473 | 2474 | 3 2475 | 2476 | name 2477 | punctuation.definition.identifier.swift 2478 | 2479 | 4 2480 | 2481 | name 2482 | punctuation.definition.identifier.swift 2483 | 2484 | 2485 | comment 2486 | If no external label is given, the name is both the external label and the internal variable name 2487 | match 2488 | (((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>)))(?=\s*:) 2489 | 2490 | 2491 | begin 2492 | :\s*(?!\s) 2493 | end 2494 | (?=[,)]) 2495 | patterns 2496 | 2497 | 2498 | include 2499 | #available-types 2500 | 2501 | 2502 | match 2503 | : 2504 | name 2505 | invalid.illegal.extra-colon-in-parameter-list.swift 2506 | 2507 | 2508 | begin 2509 | = 2510 | beginCaptures 2511 | 2512 | 0 2513 | 2514 | name 2515 | keyword.operator.assignment.swift 2516 | 2517 | 2518 | comment 2519 | a parameter's default value 2520 | end 2521 | (?=[,)]) 2522 | patterns 2523 | 2524 | 2525 | include 2526 | #expressions 2527 | 2528 | 2529 | 2530 | 2531 | 2532 | 2533 | 2534 | precedencegroup 2535 | 2536 | begin 2537 | \b(precedencegroup)\s+((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>))\s*(?=\{) 2538 | beginCaptures 2539 | 2540 | 1 2541 | 2542 | name 2543 | storage.type.precedencegroup.swift 2544 | 2545 | 2 2546 | 2547 | name 2548 | entity.name.type.precedencegroup.swift 2549 | 2550 | 3 2551 | 2552 | name 2553 | punctuation.definition.identifier.swift 2554 | 2555 | 4 2556 | 2557 | name 2558 | punctuation.definition.identifier.swift 2559 | 2560 | 2561 | end 2562 | (?!\G) 2563 | name 2564 | meta.definition.precedencegroup.swift 2565 | patterns 2566 | 2567 | 2568 | begin 2569 | \{ 2570 | beginCaptures 2571 | 2572 | 0 2573 | 2574 | name 2575 | punctuation.definition.precedencegroup.begin.swift 2576 | 2577 | 2578 | end 2579 | \} 2580 | endCaptures 2581 | 2582 | 0 2583 | 2584 | name 2585 | punctuation.definition.precedencegroup.end.swift 2586 | 2587 | 2588 | patterns 2589 | 2590 | 2591 | include 2592 | #comments 2593 | 2594 | 2595 | captures 2596 | 2597 | 1 2598 | 2599 | name 2600 | storage.modifier.swift 2601 | 2602 | 2 2603 | 2604 | name 2605 | entity.other.inherited-class.swift 2606 | patterns 2607 | 2608 | 2609 | include 2610 | #types-precedencegroup 2611 | 2612 | 2613 | 2614 | 3 2615 | 2616 | name 2617 | punctuation.definition.identifier.swift 2618 | 2619 | 4 2620 | 2621 | name 2622 | punctuation.definition.identifier.swift 2623 | 2624 | 2625 | match 2626 | \b(higherThan|lowerThan)\s*:\s*((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>)) 2627 | 2628 | 2629 | captures 2630 | 2631 | 1 2632 | 2633 | name 2634 | storage.modifier.swift 2635 | 2636 | 2 2637 | 2638 | name 2639 | keyword.other.operator.associativity.swift 2640 | 2641 | 2642 | match 2643 | \b(associativity)\b(?:\s*:\s*(right|left|none)\b)? 2644 | 2645 | 2646 | captures 2647 | 2648 | 1 2649 | 2650 | name 2651 | storage.modifier.swift 2652 | 2653 | 2 2654 | 2655 | name 2656 | constant.language.boolean.swift 2657 | 2658 | 2659 | match 2660 | \b(assignment)\b(?:\s*:\s*(true|false)\b)? 2661 | 2662 | 2663 | 2664 | 2665 | 2666 | protocol 2667 | 2668 | begin 2669 | \b(protocol)\s+((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>)) 2670 | beginCaptures 2671 | 2672 | 1 2673 | 2674 | name 2675 | storage.type.$1.swift 2676 | 2677 | 2 2678 | 2679 | name 2680 | entity.name.type.$1.swift 2681 | 2682 | 3 2683 | 2684 | name 2685 | punctuation.definition.identifier.swift 2686 | 2687 | 4 2688 | 2689 | name 2690 | punctuation.definition.identifier.swift 2691 | 2692 | 2693 | end 2694 | (?<=\}) 2695 | name 2696 | meta.definition.type.protocol.swift 2697 | patterns 2698 | 2699 | 2700 | include 2701 | #comments 2702 | 2703 | 2704 | include 2705 | #inheritance-clause 2706 | 2707 | 2708 | comment 2709 | SE-0142: Permit where clauses to constrain associated types 2710 | include 2711 | #generic-where-clause 2712 | 2713 | 2714 | begin 2715 | \{ 2716 | beginCaptures 2717 | 2718 | 0 2719 | 2720 | name 2721 | punctuation.definition.type.begin.swift 2722 | 2723 | 2724 | end 2725 | \} 2726 | endCaptures 2727 | 2728 | 0 2729 | 2730 | name 2731 | punctuation.definition.type.end.swift 2732 | 2733 | 2734 | name 2735 | meta.definition.type.body.swift 2736 | patterns 2737 | 2738 | 2739 | include 2740 | #protocol-method 2741 | 2742 | 2743 | include 2744 | #protocol-initializer 2745 | 2746 | 2747 | include 2748 | #associated-type 2749 | 2750 | 2751 | include 2752 | $self 2753 | 2754 | 2755 | 2756 | 2757 | repository 2758 | 2759 | associated-type 2760 | 2761 | begin 2762 | \b(associatedtype)\s+((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>))\s* 2763 | beginCaptures 2764 | 2765 | 1 2766 | 2767 | name 2768 | keyword.other.declaration-specifier.swift 2769 | 2770 | 2 2771 | 2772 | name 2773 | variable.language.associatedtype.swift 2774 | 2775 | 3 2776 | 2777 | name 2778 | punctuation.definition.identifier.swift 2779 | 2780 | 4 2781 | 2782 | name 2783 | punctuation.definition.identifier.swift 2784 | 2785 | 2786 | end 2787 | (?!\G)$|(?=[;}]|$) 2788 | name 2789 | meta.definition.associatedtype.swift 2790 | patterns 2791 | 2792 | 2793 | include 2794 | #inheritance-clause 2795 | 2796 | 2797 | comment 2798 | SE-0142: Permit where clauses to constrain associated types 2799 | include 2800 | #generic-where-clause 2801 | 2802 | 2803 | include 2804 | #typealias-assignment 2805 | 2806 | 2807 | 2808 | protocol-initializer 2809 | 2810 | begin 2811 | (?<!\.)\b(init[?!]*(?# only one is valid, but we want the in⇥ snippet to produce something that looks good))\s*(?=\(|<) 2812 | beginCaptures 2813 | 2814 | 1 2815 | 2816 | name 2817 | storage.type.function.swift 2818 | patterns 2819 | 2820 | 2821 | match 2822 | (?<=[?!])[?!]+ 2823 | name 2824 | invalid.illegal.character-not-allowed-here.swift 2825 | 2826 | 2827 | 2828 | 2829 | end 2830 | $|(?=;|//|/\*|\}) 2831 | name 2832 | meta.definition.function.initializer.swift 2833 | patterns 2834 | 2835 | 2836 | include 2837 | #comments 2838 | 2839 | 2840 | include 2841 | #generic-parameter-clause 2842 | 2843 | 2844 | include 2845 | #parameter-clause 2846 | 2847 | 2848 | match 2849 | \b(?:throws|rethrows)\b 2850 | name 2851 | keyword.control.exception.swift 2852 | 2853 | 2854 | comment 2855 | Swift 3: generic constraints after the parameters and return type 2856 | include 2857 | #generic-where-clause 2858 | 2859 | 2860 | begin 2861 | \{ 2862 | beginCaptures 2863 | 2864 | 0 2865 | 2866 | name 2867 | punctuation.section.function.begin.swift 2868 | 2869 | 2870 | end 2871 | \} 2872 | endCaptures 2873 | 2874 | 0 2875 | 2876 | name 2877 | punctuation.section.function.end.swift 2878 | 2879 | 2880 | name 2881 | invalid.illegal.function-body-not-allowed-in-protocol.swift 2882 | patterns 2883 | 2884 | 2885 | include 2886 | $self 2887 | 2888 | 2889 | 2890 | 2891 | 2892 | protocol-method 2893 | 2894 | begin 2895 | (?x) 2896 | \b 2897 | (func) 2898 | \s+ 2899 | ( 2900 | (?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>) 2901 | | (?: 2902 | ( 2903 | (?<oph> # operator-head 2904 | [/=\-+!*%<>&|^~?] 2905 | | [\x{00A1}-\x{00A7}] 2906 | | [\x{00A9}\x{00AB}] 2907 | | [\x{00AC}\x{00AE}] 2908 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 2909 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 2910 | | [\x{2030}-\x{203E}] 2911 | | [\x{2041}-\x{2053}] 2912 | | [\x{2055}-\x{205E}] 2913 | | [\x{2190}-\x{23FF}] 2914 | | [\x{2500}-\x{2775}] 2915 | | [\x{2794}-\x{2BFF}] 2916 | | [\x{2E00}-\x{2E7F}] 2917 | | [\x{3001}-\x{3003}] 2918 | | [\x{3008}-\x{3030}] 2919 | ) 2920 | ( 2921 | \g<oph> 2922 | | (?<opc> # operator-character 2923 | [\x{0300}-\x{036F}] 2924 | | [\x{1DC0}-\x{1DFF}] 2925 | | [\x{20D0}-\x{20FF}] 2926 | | [\x{FE00}-\x{FE0F}] 2927 | | [\x{FE20}-\x{FE2F}] 2928 | | [\x{E0100}-\x{E01EF}] 2929 | ) 2930 | )* 2931 | ) 2932 | | ( \. ( \g<oph> | \g<opc> | \. )+ ) # Dot operators 2933 | ) 2934 | ) 2935 | \s* 2936 | (?=\(|<) 2937 | 2938 | beginCaptures 2939 | 2940 | 1 2941 | 2942 | name 2943 | storage.type.function.swift 2944 | 2945 | 2 2946 | 2947 | name 2948 | entity.name.function.swift 2949 | 2950 | 3 2951 | 2952 | name 2953 | punctuation.definition.identifier.swift 2954 | 2955 | 4 2956 | 2957 | name 2958 | punctuation.definition.identifier.swift 2959 | 2960 | 2961 | end 2962 | $|(?=;|//|/\*|\}) 2963 | name 2964 | meta.definition.function.swift 2965 | patterns 2966 | 2967 | 2968 | include 2969 | #comments 2970 | 2971 | 2972 | include 2973 | #generic-parameter-clause 2974 | 2975 | 2976 | include 2977 | #parameter-clause 2978 | 2979 | 2980 | include 2981 | #function-result 2982 | 2983 | 2984 | match 2985 | \b(?:throws|rethrows)\b 2986 | name 2987 | keyword.control.exception.swift 2988 | 2989 | 2990 | comment 2991 | Swift 3: generic constraints after the parameters and return type 2992 | include 2993 | #generic-where-clause 2994 | 2995 | 2996 | begin 2997 | \{ 2998 | beginCaptures 2999 | 3000 | 0 3001 | 3002 | name 3003 | punctuation.section.function.begin.swift 3004 | 3005 | 3006 | end 3007 | \} 3008 | endCaptures 3009 | 3010 | 0 3011 | 3012 | name 3013 | punctuation.section.function.end.swift 3014 | 3015 | 3016 | name 3017 | invalid.illegal.function-body-not-allowed-in-protocol.swift 3018 | patterns 3019 | 3020 | 3021 | include 3022 | $self 3023 | 3024 | 3025 | 3026 | 3027 | 3028 | 3029 | 3030 | type 3031 | 3032 | patterns 3033 | 3034 | 3035 | begin 3036 | \b(class(?!\s+(?:func|var|let)\b)|struct)\s+((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>)) 3037 | beginCaptures 3038 | 3039 | 1 3040 | 3041 | name 3042 | storage.type.$1.swift 3043 | 3044 | 2 3045 | 3046 | name 3047 | entity.name.type.$1.swift 3048 | 3049 | 3 3050 | 3051 | name 3052 | punctuation.definition.identifier.swift 3053 | 3054 | 4 3055 | 3056 | name 3057 | punctuation.definition.identifier.swift 3058 | 3059 | 3060 | end 3061 | (?<=\}) 3062 | name 3063 | meta.definition.type.$1.swift 3064 | patterns 3065 | 3066 | 3067 | include 3068 | #comments 3069 | 3070 | 3071 | include 3072 | #generic-parameter-clause 3073 | 3074 | 3075 | comment 3076 | Swift 3: generic constraints after the generic param list 3077 | include 3078 | #generic-where-clause 3079 | 3080 | 3081 | include 3082 | #inheritance-clause 3083 | 3084 | 3085 | begin 3086 | \{ 3087 | beginCaptures 3088 | 3089 | 0 3090 | 3091 | name 3092 | punctuation.definition.type.begin.swift 3093 | 3094 | 3095 | end 3096 | \} 3097 | endCaptures 3098 | 3099 | 0 3100 | 3101 | name 3102 | punctuation.definition.type.end.swift 3103 | 3104 | 3105 | name 3106 | meta.definition.type.body.swift 3107 | patterns 3108 | 3109 | 3110 | include 3111 | $self 3112 | 3113 | 3114 | 3115 | 3116 | 3117 | 3118 | include 3119 | #type-enum 3120 | 3121 | 3122 | 3123 | type-enum 3124 | 3125 | begin 3126 | \b(enum)\s+((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>)) 3127 | beginCaptures 3128 | 3129 | 1 3130 | 3131 | name 3132 | storage.type.$1.swift 3133 | 3134 | 2 3135 | 3136 | name 3137 | entity.name.type.$1.swift 3138 | 3139 | 3 3140 | 3141 | name 3142 | punctuation.definition.identifier.swift 3143 | 3144 | 4 3145 | 3146 | name 3147 | punctuation.definition.identifier.swift 3148 | 3149 | 3150 | end 3151 | (?<=\}) 3152 | name 3153 | meta.definition.type.$1.swift 3154 | patterns 3155 | 3156 | 3157 | include 3158 | #comments 3159 | 3160 | 3161 | include 3162 | #generic-parameter-clause 3163 | 3164 | 3165 | comment 3166 | Swift 3: generic constraints after the generic param list 3167 | include 3168 | #generic-where-clause 3169 | 3170 | 3171 | include 3172 | #inheritance-clause 3173 | 3174 | 3175 | begin 3176 | \{ 3177 | beginCaptures 3178 | 3179 | 0 3180 | 3181 | name 3182 | punctuation.definition.type.begin.swift 3183 | 3184 | 3185 | end 3186 | \} 3187 | endCaptures 3188 | 3189 | 0 3190 | 3191 | name 3192 | punctuation.definition.type.end.swift 3193 | 3194 | 3195 | name 3196 | meta.definition.type.body.swift 3197 | patterns 3198 | 3199 | 3200 | include 3201 | #enum-case-clause 3202 | 3203 | 3204 | include 3205 | $self 3206 | 3207 | 3208 | 3209 | 3210 | repository 3211 | 3212 | associated-values 3213 | 3214 | begin 3215 | \G\( 3216 | beginCaptures 3217 | 3218 | 0 3219 | 3220 | name 3221 | punctuation.definition.parameters.begin.swift 3222 | 3223 | 3224 | end 3225 | \) 3226 | endCaptures 3227 | 3228 | 0 3229 | 3230 | name 3231 | punctuation.definition.parameters.end.swift 3232 | 3233 | 3234 | patterns 3235 | 3236 | 3237 | include 3238 | #comments 3239 | 3240 | 3241 | captures 3242 | 3243 | 1 3244 | 3245 | name 3246 | invalid.illegal.distinct-labels-not-allowed.swift 3247 | 3248 | 3 3249 | 3250 | name 3251 | entity.name.function.swift 3252 | 3253 | 4 3254 | 3255 | name 3256 | variable.parameter.function.swift 3257 | 3258 | 6 3259 | 3260 | name 3261 | punctuation.separator.argument-label.swift 3262 | 3263 | 3264 | end 3265 | (?=[,)\]]) 3266 | match 3267 | (?x) 3268 | ((?<q1>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*\k<q1>) 3269 | \s+ 3270 | (((?<q2>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*\k<q2>)) 3271 | \s*(:) 3272 | 3273 | 3274 | begin 3275 | (((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*\k<q>))\s*(:) 3276 | beginCaptures 3277 | 3278 | 1 3279 | 3280 | name 3281 | entity.name.function.swift 3282 | 3283 | 2 3284 | 3285 | name 3286 | variable.parameter.function.swift 3287 | 3288 | 4 3289 | 3290 | name 3291 | punctuation.separator.argument-label.swift 3292 | 3293 | 3294 | end 3295 | (?=[,)\]]) 3296 | patterns 3297 | 3298 | 3299 | include 3300 | #available-types 3301 | 3302 | 3303 | 3304 | 3305 | begin 3306 | (?![,)\]])(?=\S) 3307 | comment 3308 | an element without a label (i.e. anything else) 3309 | end 3310 | (?=[,)\]]) 3311 | patterns 3312 | 3313 | 3314 | include 3315 | #available-types 3316 | 3317 | 3318 | match 3319 | : 3320 | name 3321 | invalid.illegal.extra-colon-in-parameter-list.swift 3322 | 3323 | 3324 | 3325 | 3326 | 3327 | enum-case 3328 | 3329 | begin 3330 | (?x)((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>))\s* 3331 | beginCaptures 3332 | 3333 | 1 3334 | 3335 | name 3336 | constant.other.swift 3337 | 3338 | 3339 | end 3340 | (?<=\))|(?![=(]) 3341 | patterns 3342 | 3343 | 3344 | include 3345 | #comments 3346 | 3347 | 3348 | include 3349 | #associated-values 3350 | 3351 | 3352 | include 3353 | #raw-value-assignment 3354 | 3355 | 3356 | 3357 | enum-case-clause 3358 | 3359 | begin 3360 | \b(case)\b\s* 3361 | beginCaptures 3362 | 3363 | 1 3364 | 3365 | name 3366 | storage.type.enum.case.swift 3367 | 3368 | 3369 | end 3370 | (?=[;}])|(?!\G)(?!//|/\*)(?=[^\s,]) 3371 | patterns 3372 | 3373 | 3374 | include 3375 | #comments 3376 | 3377 | 3378 | include 3379 | #enum-case 3380 | 3381 | 3382 | include 3383 | #more-cases 3384 | 3385 | 3386 | 3387 | more-cases 3388 | 3389 | begin 3390 | ,\s* 3391 | end 3392 | (?!\G)(?!//|/\*)(?=[;}]|[^\s,]) 3393 | name 3394 | meta.enum-case.more-cases 3395 | patterns 3396 | 3397 | 3398 | include 3399 | #comments 3400 | 3401 | 3402 | include 3403 | #enum-case 3404 | 3405 | 3406 | include 3407 | #more-cases 3408 | 3409 | 3410 | 3411 | raw-value-assignment 3412 | 3413 | begin 3414 | (=)\s* 3415 | beginCaptures 3416 | 3417 | 1 3418 | 3419 | name 3420 | keyword.operator.assignment.swift 3421 | 3422 | 3423 | end 3424 | (?!\G) 3425 | patterns 3426 | 3427 | 3428 | include 3429 | #comments 3430 | 3431 | 3432 | include 3433 | #literals 3434 | 3435 | 3436 | 3437 | 3438 | 3439 | type-identifier 3440 | 3441 | begin 3442 | ((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>))\s* 3443 | beginCaptures 3444 | 3445 | 1 3446 | 3447 | name 3448 | meta.type-name.swift 3449 | patterns 3450 | 3451 | 3452 | include 3453 | #builtin-types 3454 | 3455 | 3456 | 3457 | 2 3458 | 3459 | name 3460 | punctuation.definition.identifier.swift 3461 | 3462 | 3 3463 | 3464 | name 3465 | punctuation.definition.identifier.swift 3466 | 3467 | 3468 | end 3469 | (?!<) 3470 | patterns 3471 | 3472 | 3473 | begin 3474 | (?=<) 3475 | end 3476 | (?!\G) 3477 | patterns 3478 | 3479 | 3480 | include 3481 | #generic-argument-clause 3482 | 3483 | 3484 | 3485 | 3486 | 3487 | typealias 3488 | 3489 | begin 3490 | \b(typealias)\s+((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>))\s* 3491 | beginCaptures 3492 | 3493 | 1 3494 | 3495 | name 3496 | keyword.other.declaration-specifier.swift 3497 | 3498 | 2 3499 | 3500 | name 3501 | entity.name.type.typealias.swift 3502 | 3503 | 3 3504 | 3505 | name 3506 | punctuation.definition.identifier.swift 3507 | 3508 | 4 3509 | 3510 | name 3511 | punctuation.definition.identifier.swift 3512 | 3513 | 3514 | end 3515 | (?!\G)$|(?=;|//|/\*|$) 3516 | name 3517 | meta.definition.typealias.swift 3518 | patterns 3519 | 3520 | 3521 | begin 3522 | \G(?=<) 3523 | end 3524 | (?!\G) 3525 | patterns 3526 | 3527 | 3528 | include 3529 | #generic-parameter-clause 3530 | 3531 | 3532 | 3533 | 3534 | include 3535 | #typealias-assignment 3536 | 3537 | 3538 | 3539 | typealias-assignment 3540 | 3541 | begin 3542 | (=)\s* 3543 | beginCaptures 3544 | 3545 | 1 3546 | 3547 | name 3548 | keyword.operator.assignment.swift 3549 | 3550 | 3551 | end 3552 | (?!\G)$|(?=;|//|/\*|$) 3553 | patterns 3554 | 3555 | 3556 | include 3557 | #available-types 3558 | 3559 | 3560 | 3561 | types-precedencegroup 3562 | 3563 | patterns 3564 | 3565 | 3566 | comment 3567 | Precedence groups in the standard library 3568 | match 3569 | \b(?:BitwiseShift|Assignment|RangeFormation|Casting|Addition|NilCoalescing|Comparison|LogicalConjunction|LogicalDisjunction|Default|Ternary|Multiplication|FunctionArrow)Precedence\b 3570 | name 3571 | support.type.swift 3572 | 3573 | 3574 | 3575 | 3576 | 3577 | expressions 3578 | 3579 | patterns 3580 | 3581 | 3582 | include 3583 | #comments 3584 | 3585 | 3586 | include 3587 | #code-block 3588 | 3589 | 3590 | include 3591 | #attributes 3592 | 3593 | 3594 | include 3595 | #closure-parameter 3596 | 3597 | 3598 | include 3599 | #literals 3600 | 3601 | 3602 | include 3603 | #operators 3604 | 3605 | 3606 | include 3607 | #builtin-types 3608 | 3609 | 3610 | include 3611 | #builtin-functions 3612 | 3613 | 3614 | include 3615 | #builtin-global-functions 3616 | 3617 | 3618 | include 3619 | #builtin-properties 3620 | 3621 | 3622 | include 3623 | #compound-name 3624 | 3625 | 3626 | include 3627 | #keywords 3628 | 3629 | 3630 | include 3631 | #function-call-expression 3632 | 3633 | 3634 | include 3635 | #subscript-expression 3636 | 3637 | 3638 | include 3639 | #parenthesized-expression 3640 | 3641 | 3642 | include 3643 | #member-reference 3644 | 3645 | 3646 | include 3647 | #availability-condition 3648 | 3649 | 3650 | match 3651 | \b_\b 3652 | name 3653 | support.variable.discard-value.swift 3654 | 3655 | 3656 | repository 3657 | 3658 | availability-condition 3659 | 3660 | begin 3661 | \B(#available)(\() 3662 | beginCaptures 3663 | 3664 | 1 3665 | 3666 | name 3667 | support.function.availability-condition.swift 3668 | 3669 | 2 3670 | 3671 | name 3672 | punctuation.definition.arguments.begin.swift 3673 | 3674 | 3675 | end 3676 | \) 3677 | endCaptures 3678 | 3679 | 0 3680 | 3681 | name 3682 | punctuation.definition.arguments.end.swift 3683 | 3684 | 3685 | patterns 3686 | 3687 | 3688 | captures 3689 | 3690 | 1 3691 | 3692 | name 3693 | keyword.other.platform.os.swift 3694 | 3695 | 2 3696 | 3697 | name 3698 | constant.numeric.swift 3699 | 3700 | 3701 | match 3702 | \s*\b((?:iOS|macOS|OSX|watchOS|tvOS)(?:ApplicationExtension)?)\b(?:\s+([0-9]+(?:\.[0-9]+)*\b)) 3703 | 3704 | 3705 | captures 3706 | 3707 | 1 3708 | 3709 | name 3710 | keyword.other.platform.all.swift 3711 | 3712 | 2 3713 | 3714 | name 3715 | invalid.illegal.character-not-allowed-here.swift 3716 | 3717 | 3718 | match 3719 | (\*)\s*(.*?)(?=[,)]) 3720 | 3721 | 3722 | match 3723 | [^\s,)]+ 3724 | name 3725 | invalid.illegal.character-not-allowed-here.swift 3726 | 3727 | 3728 | 3729 | closure-parameter 3730 | 3731 | match 3732 | \$[0-9]+ 3733 | name 3734 | variable.language.closure-parameter.swift 3735 | 3736 | compound-name 3737 | 3738 | captures 3739 | 3740 | 1 3741 | 3742 | name 3743 | entity.name.function.compound-name.swift 3744 | 3745 | 2 3746 | 3747 | name 3748 | punctuation.definition.entity.swift 3749 | 3750 | 3 3751 | 3752 | name 3753 | punctuation.definition.entity.swift 3754 | 3755 | 4 3756 | 3757 | patterns 3758 | 3759 | 3760 | captures 3761 | 3762 | 1 3763 | 3764 | name 3765 | punctuation.definition.entity.swift 3766 | 3767 | 2 3768 | 3769 | name 3770 | punctuation.definition.entity.swift 3771 | 3772 | 3773 | match 3774 | (?<q>`?)(?!_:)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>): 3775 | name 3776 | entity.name.function.compound-name.swift 3777 | 3778 | 3779 | 3780 | 3781 | comment 3782 | a reference to a function with disambiguating argument labels, such as foo(_:), foo(bar:), etc. 3783 | match 3784 | (?x) 3785 | ((?<q1>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q1>)) # function name 3786 | \( 3787 | ( 3788 | ( 3789 | ((?<q2>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q2>)) # argument label 3790 | : # colon 3791 | )+ 3792 | ) 3793 | \) 3794 | 3795 | 3796 | expression-element-list 3797 | 3798 | patterns 3799 | 3800 | 3801 | include 3802 | #comments 3803 | 3804 | 3805 | begin 3806 | ((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>))\s*(:) 3807 | beginCaptures 3808 | 3809 | 1 3810 | 3811 | name 3812 | support.function.any-method.swift 3813 | 3814 | 2 3815 | 3816 | name 3817 | punctuation.definition.identifier.swift 3818 | 3819 | 3 3820 | 3821 | name 3822 | punctuation.definition.identifier.swift 3823 | 3824 | 4 3825 | 3826 | name 3827 | punctuation.separator.argument-label.swift 3828 | 3829 | 3830 | comment 3831 | an element with a label 3832 | end 3833 | (?=[,)\]]) 3834 | patterns 3835 | 3836 | 3837 | include 3838 | #expressions 3839 | 3840 | 3841 | 3842 | 3843 | begin 3844 | (?![,)\]])(?=\S) 3845 | comment 3846 | an element without a label (i.e. anything else) 3847 | end 3848 | (?=[,)\]]) 3849 | patterns 3850 | 3851 | 3852 | include 3853 | #expressions 3854 | 3855 | 3856 | 3857 | 3858 | 3859 | function-call-expression 3860 | 3861 | patterns 3862 | 3863 | 3864 | begin 3865 | ((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>))\s*(\() 3866 | beginCaptures 3867 | 3868 | 1 3869 | 3870 | name 3871 | support.function.any-method.swift 3872 | 3873 | 2 3874 | 3875 | name 3876 | punctuation.definition.identifier.swift 3877 | 3878 | 3 3879 | 3880 | name 3881 | punctuation.definition.identifier.swift 3882 | 3883 | 4 3884 | 3885 | name 3886 | punctuation.definition.arguments.begin.swift 3887 | 3888 | 3889 | comment 3890 | foo(args) -- a call whose callee is a highlightable name 3891 | end 3892 | \) 3893 | endCaptures 3894 | 3895 | 0 3896 | 3897 | name 3898 | punctuation.definition.arguments.end.swift 3899 | 3900 | 3901 | name 3902 | meta.function-call.swift 3903 | patterns 3904 | 3905 | 3906 | include 3907 | #expression-element-list 3908 | 3909 | 3910 | 3911 | 3912 | begin 3913 | (?<=[`\])}>\p{L}_\p{N}\p{M}])\s*(\() 3914 | beginCaptures 3915 | 3916 | 1 3917 | 3918 | name 3919 | punctuation.definition.arguments.begin.swift 3920 | 3921 | 3922 | comment 3923 | [Int](args) -- a call whose callee is a more complicated expression 3924 | end 3925 | \) 3926 | endCaptures 3927 | 3928 | 0 3929 | 3930 | name 3931 | punctuation.definition.arguments.end.swift 3932 | 3933 | 3934 | name 3935 | meta.function-call.swift 3936 | patterns 3937 | 3938 | 3939 | include 3940 | #expression-element-list 3941 | 3942 | 3943 | 3944 | 3945 | 3946 | member-reference 3947 | 3948 | patterns 3949 | 3950 | 3951 | captures 3952 | 3953 | 1 3954 | 3955 | name 3956 | variable.other.swift 3957 | 3958 | 2 3959 | 3960 | name 3961 | punctuation.definition.identifier.swift 3962 | 3963 | 3 3964 | 3965 | name 3966 | punctuation.definition.identifier.swift 3967 | 3968 | 3969 | match 3970 | (?<=\.)((?<q>`?)[\p{L}_][\p{L}_\p{N}\p{M}]*(\k<q>)) 3971 | 3972 | 3973 | 3974 | parenthesized-expression 3975 | 3976 | begin 3977 | \( 3978 | beginCaptures 3979 | 3980 | 0 3981 | 3982 | name 3983 | punctuation.section.tuple.begin.swift 3984 | 3985 | 3986 | end 3987 | \) 3988 | endCaptures 3989 | 3990 | 0 3991 | 3992 | name 3993 | punctuation.section.tuple.end.swift 3994 | 3995 | 3996 | patterns 3997 | 3998 | 3999 | include 4000 | #expression-element-list 4001 | 4002 | 4003 | 4004 | subscript-expression 4005 | 4006 | begin 4007 | (?<=[`\p{L}_\p{N}\p{M}])\s*(\[) 4008 | beginCaptures 4009 | 4010 | 1 4011 | 4012 | name 4013 | punctuation.definition.arguments.begin.swift 4014 | 4015 | 4016 | end 4017 | \] 4018 | endCaptures 4019 | 4020 | 0 4021 | 4022 | name 4023 | punctuation.definition.arguments.end.swift 4024 | 4025 | 4026 | name 4027 | meta.subscript-expression.swift 4028 | patterns 4029 | 4030 | 4031 | include 4032 | #expression-element-list 4033 | 4034 | 4035 | 4036 | 4037 | 4038 | keywords 4039 | 4040 | patterns 4041 | 4042 | 4043 | match 4044 | (?<!\.)\b(?:if|else|guard|where|switch|case|default|fallthrough)\b 4045 | name 4046 | keyword.control.branch.swift 4047 | 4048 | 4049 | match 4050 | (?<!\.)\b(?:continue|break|fallthrough|return)\b 4051 | name 4052 | keyword.control.transfer.swift 4053 | 4054 | 4055 | match 4056 | (?<!\.)\b(?:while|for|in)\b 4057 | name 4058 | keyword.control.loop.swift 4059 | 4060 | 4061 | captures 4062 | 4063 | 1 4064 | 4065 | name 4066 | keyword.control.loop.swift 4067 | 4068 | 2 4069 | 4070 | name 4071 | punctuation.whitespace.trailing.repeat.swift 4072 | 4073 | 4074 | comment 4075 | extra scopes for repeat-while snippet 4076 | match 4077 | (?<!\.)\b(repeat)\b(\s*) 4078 | 4079 | 4080 | match 4081 | (?<!\.)\bdefer\b 4082 | name 4083 | keyword.control.defer.swift 4084 | 4085 | 4086 | match 4087 | (?<!\.)\b(?:catch|throws?|rethrows|try)\b|\btry[?!]\B 4088 | name 4089 | keyword.control.exception.swift 4090 | 4091 | 4092 | captures 4093 | 4094 | 1 4095 | 4096 | name 4097 | keyword.control.exception.swift 4098 | 4099 | 2 4100 | 4101 | name 4102 | punctuation.whitespace.trailing.do.swift 4103 | 4104 | 4105 | comment 4106 | extra scopes for do-catch snippet 4107 | match 4108 | (?<!\.)\b(do)\b(\s*) 4109 | 4110 | 4111 | match 4112 | (?<!\.)\b(?:associatedtype|let|operator|typealias|var)\b 4113 | name 4114 | keyword.other.declaration-specifier.swift 4115 | 4116 | 4117 | match 4118 | (?<!\.)\b(class|enum|extension|precedencegroup|protocol|struct)\b 4119 | name 4120 | storage.type.$1.swift 4121 | 4122 | 4123 | match 4124 | (?<!\.)\b(?:inout|static|final|lazy|mutating|nonmutating|optional|indirect|required|override|dynamic|convenience|infix|prefix|postfix)\b 4125 | name 4126 | storage.modifier.swift 4127 | 4128 | 4129 | match 4130 | \binit[?!]|\binit\b|(?<!\.)\b(?:func|deinit|subscript|didSet|get|set|willSet)\b 4131 | name 4132 | storage.type.function.swift 4133 | 4134 | 4135 | match 4136 | (?<!\.)\b(?:fileprivate|private|internal|public|open)\b 4137 | name 4138 | keyword.other.declaration-specifier.accessibility.swift 4139 | 4140 | 4141 | comment 4142 | matches weak, unowned, unowned(safe), unowned(unsafe) 4143 | match 4144 | (?<!\.)\b(?:weak|unowned)\b|\bunowned\((?:safe|unsafe)\) 4145 | name 4146 | keyword.other.capture-specifier.swift 4147 | 4148 | 4149 | captures 4150 | 4151 | 1 4152 | 4153 | name 4154 | keyword.operator.type.swift 4155 | 4156 | 2 4157 | 4158 | name 4159 | keyword.operator.type.metatype.swift 4160 | 4161 | 4162 | match 4163 | (?<=\.)(?:(dynamicType|self)|(Protocol|Type))\b 4164 | 4165 | 4166 | match 4167 | (?<!\.)\b(?:super|self|Self)\b 4168 | name 4169 | variable.language.swift 4170 | 4171 | 4172 | match 4173 | \B(?:#file|#line|#column|#function|#dsohandle)\b|\b(?:__FILE__|__LINE__|__COLUMN__|__FUNCTION__|__DSO_HANDLE__)\b 4174 | name 4175 | support.variable.swift 4176 | 4177 | 4178 | match 4179 | (?<!\.)\bimport\b 4180 | name 4181 | keyword.control.import.swift 4182 | 4183 | 4184 | 4185 | literals 4186 | 4187 | patterns 4188 | 4189 | 4190 | include 4191 | #boolean 4192 | 4193 | 4194 | include 4195 | #numeric 4196 | 4197 | 4198 | include 4199 | #string 4200 | 4201 | 4202 | match 4203 | \bnil\b 4204 | name 4205 | constant.language.nil.swift 4206 | 4207 | 4208 | comment 4209 | object "literals" used in playgrounds 4210 | match 4211 | \B#(colorLiteral|imageLiteral|fileLiteral)\b 4212 | name 4213 | support.function.object-literal.swift 4214 | 4215 | 4216 | match 4217 | \B#keyPath\b 4218 | name 4219 | support.function.key-path.swift 4220 | 4221 | 4222 | begin 4223 | \B(#selector)(\()(?:\s*(getter|setter)\s*(:))? 4224 | beginCaptures 4225 | 4226 | 1 4227 | 4228 | name 4229 | support.function.selector-reference.swift 4230 | 4231 | 2 4232 | 4233 | name 4234 | punctuation.definition.arguments.begin.swift 4235 | 4236 | 3 4237 | 4238 | name 4239 | support.variable.parameter.swift 4240 | 4241 | 4 4242 | 4243 | name 4244 | punctuation.separator.argument-label.swift 4245 | 4246 | 4247 | end 4248 | \) 4249 | endCaptures 4250 | 4251 | 0 4252 | 4253 | name 4254 | punctuation.definition.arguments.end.swift 4255 | 4256 | 4257 | patterns 4258 | 4259 | 4260 | include 4261 | #expressions 4262 | 4263 | 4264 | 4265 | 4266 | repository 4267 | 4268 | boolean 4269 | 4270 | match 4271 | \b(true|false)\b 4272 | name 4273 | constant.language.boolean.swift 4274 | 4275 | numeric 4276 | 4277 | patterns 4278 | 4279 | 4280 | comment 4281 | 0.1, -4_2.5, 6.022e23, 10E-5 4282 | match 4283 | (\B\-|\b)(?<![\[\](){}\p{L}_\p{N}\p{M}]\.)[0-9][0-9_]*(?=\.[0-9]|[eE])(?:\.[0-9][0-9_]*)?(?:[eE][-+]?[0-9][0-9_]*)?\b(?!\.[0-9]) 4284 | name 4285 | constant.numeric.float.decimal.swift 4286 | 4287 | 4288 | comment 4289 | -0x1.ap2_3, 0x31p-4 4290 | match 4291 | (\B\-|\b)(?<![\[\](){}\p{L}_\p{N}\p{M}]\.)(0x[0-9a-fA-F][0-9a-fA-F_]*)(?:\.[0-9a-fA-F][0-9a-fA-F_]*)?[pP][-+]?[0-9][0-9_]*\b(?!\.[0-9]) 4292 | name 4293 | constant.numeric.float.hexadecimal.swift 4294 | 4295 | 4296 | comment 4297 | 0x1p, 0x1p_2, 0x1.5pa, 0x1.1p+1f, 0x1pz 4298 | match 4299 | (\B\-|\b)(?<![\[\](){}\p{L}_\p{N}\p{M}]\.)(0x[0-9a-fA-F][0-9a-fA-F_]*)(?:\.[0-9a-fA-F][0-9a-fA-F_]*)?(?:[pP][-+]?\w*)\b(?!\.[0-9]) 4300 | name 4301 | invalid.illegal.numeric.float.invalid-exponent.swift 4302 | 4303 | 4304 | comment 4305 | 0x1.5w (note that 0x1.f may be a valid expression) 4306 | match 4307 | (\B\-|\b)(?<![\[\](){}\p{L}_\p{N}\p{M}]\.)(0x[0-9a-fA-F][0-9a-fA-F_]*)\.[0-9][\w.]* 4308 | name 4309 | invalid.illegal.numeric.float.missing-exponent.swift 4310 | 4311 | 4312 | comment 4313 | -.5, .2f (note that 1.-.5 may be a valid expression) 4314 | match 4315 | (?<=\s|^)\-?\.[0-9][\w.]* 4316 | name 4317 | invalid.illegal.numeric.float.missing-leading-zero.swift 4318 | 4319 | 4320 | comment 4321 | 0b_0_1, 0x_1p+3q 4322 | match 4323 | (\B\-|\b)0[box]_[0-9a-fA-F_]*(?:[pPeE][+-]?\w+)?[\w.]+ 4324 | name 4325 | invalid.illegal.numeric.leading-underscore.swift 4326 | 4327 | 4328 | comment 4329 | tuple positional member: not really a numeric literal, but not invalid 4330 | match 4331 | (?<=[\[\](){}\p{L}_\p{N}\p{M}]\.)[0-9]+\b 4332 | 4333 | 4334 | comment 4335 | 0b010, 0b1_0 4336 | match 4337 | (\B\-|\b)(?<![\[\](){}\p{L}_\p{N}\p{M}]\.)0b[01][01_]*\b(?!\.[0-9]) 4338 | name 4339 | constant.numeric.integer.binary.swift 4340 | 4341 | 4342 | comment 4343 | 0o1, 0o7_3 4344 | match 4345 | (\B\-|\b)(?<![\[\](){}\p{L}_\p{N}\p{M}]\.)0o[0-7][0-7_]*\b(?!\.[0-9]) 4346 | name 4347 | constant.numeric.integer.octal.swift 4348 | 4349 | 4350 | comment 4351 | 02, 3_456 4352 | match 4353 | (\B\-|\b)(?<![\[\](){}\p{L}_\p{N}\p{M}]\.)[0-9][0-9_]*\b(?!\.[0-9]) 4354 | name 4355 | constant.numeric.integer.decimal.swift 4356 | 4357 | 4358 | comment 4359 | 0x4, 0xF_7 4360 | match 4361 | (\B\-|\b)(?<![\[\](){}\p{L}_\p{N}\p{M}]\.)0x[0-9a-fA-F][0-9a-fA-F_]*\b(?!\.[0-9]) 4362 | name 4363 | constant.numeric.integer.hexadecimal.swift 4364 | 4365 | 4366 | match 4367 | (\B\-|\b)[0-9][\w.]* 4368 | name 4369 | invalid.illegal.numeric.other.swift 4370 | 4371 | 4372 | 4373 | string 4374 | 4375 | patterns 4376 | 4377 | 4378 | begin 4379 | " 4380 | beginCaptures 4381 | 4382 | 0 4383 | 4384 | name 4385 | punctuation.definition.string.begin.swift 4386 | 4387 | 4388 | end 4389 | " 4390 | endCaptures 4391 | 4392 | 0 4393 | 4394 | name 4395 | punctuation.definition.string.end.swift 4396 | 4397 | 4398 | name 4399 | string.quoted.double.swift 4400 | patterns 4401 | 4402 | 4403 | match 4404 | \r|\n 4405 | name 4406 | invalid.illegal.returns-not-allowed.swift 4407 | 4408 | 4409 | match 4410 | \\[0\\tnr"'] 4411 | name 4412 | constant.character.escape.swift 4413 | 4414 | 4415 | match 4416 | \\u\{[0-9a-fA-F]{1,8}\} 4417 | name 4418 | constant.character.escape.unicode.swift 4419 | 4420 | 4421 | begin 4422 | \\\( 4423 | beginCaptures 4424 | 4425 | 0 4426 | 4427 | name 4428 | punctuation.section.embedded.begin.swift 4429 | 4430 | 4431 | contentName 4432 | source.swift 4433 | end 4434 | (\)) 4435 | endCaptures 4436 | 4437 | 0 4438 | 4439 | name 4440 | punctuation.section.embedded.end.swift 4441 | 4442 | 1 4443 | 4444 | name 4445 | source.swift 4446 | 4447 | 4448 | name 4449 | meta.embedded.line.swift 4450 | patterns 4451 | 4452 | 4453 | include 4454 | $self 4455 | 4456 | 4457 | begin 4458 | \( 4459 | comment 4460 | Nested parens 4461 | end 4462 | \) 4463 | 4464 | 4465 | 4466 | 4467 | match 4468 | \\. 4469 | name 4470 | invalid.illegal.escape-not-recognized 4471 | 4472 | 4473 | 4474 | 4475 | 4476 | 4477 | 4478 | operators 4479 | 4480 | patterns 4481 | 4482 | 4483 | comment 4484 | Type casting 4485 | match 4486 | \b(is\b|as([!?]\B|\b)) 4487 | name 4488 | keyword.operator.type-casting.swift 4489 | 4490 | 4491 | begin 4492 | (?x) 4493 | (?= 4494 | (?<oph> # operator-head 4495 | [/=\-+!*%<>&|^~?] 4496 | | [\x{00A1}-\x{00A7}] 4497 | | [\x{00A9}\x{00AB}] 4498 | | [\x{00AC}\x{00AE}] 4499 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 4500 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 4501 | | [\x{2030}-\x{203E}] 4502 | | [\x{2041}-\x{2053}] 4503 | | [\x{2055}-\x{205E}] 4504 | | [\x{2190}-\x{23FF}] 4505 | | [\x{2500}-\x{2775}] 4506 | | [\x{2794}-\x{2BFF}] 4507 | | [\x{2E00}-\x{2E7F}] 4508 | | [\x{3001}-\x{3003}] 4509 | | [\x{3008}-\x{3030}] 4510 | ) 4511 | | \. 4512 | ( 4513 | \g<oph> # operator-head 4514 | | \. 4515 | | [\x{0300}-\x{036F}] # operator-character 4516 | | [\x{1DC0}-\x{1DFF}] 4517 | | [\x{20D0}-\x{20FF}] 4518 | | [\x{FE00}-\x{FE0F}] 4519 | | [\x{FE20}-\x{FE2F}] 4520 | | [\x{E0100}-\x{E01EF}] 4521 | ) 4522 | ) 4523 | 4524 | comment 4525 | This rule helps us speed up the matching. 4526 | end 4527 | (?!\G) 4528 | patterns 4529 | 4530 | 4531 | captures 4532 | 4533 | 0 4534 | 4535 | patterns 4536 | 4537 | 4538 | match 4539 | \G(\+\+|\-\-)$ 4540 | name 4541 | keyword.operator.increment-or-decrement.swift 4542 | 4543 | 4544 | match 4545 | \G(\+|\-)$ 4546 | name 4547 | keyword.operator.arithmetic.unary.swift 4548 | 4549 | 4550 | match 4551 | \G!$ 4552 | name 4553 | keyword.operator.logical.not.swift 4554 | 4555 | 4556 | match 4557 | \G~$ 4558 | name 4559 | keyword.operator.bitwise.not.swift 4560 | 4561 | 4562 | match 4563 | .+ 4564 | name 4565 | keyword.operator.custom.prefix.swift 4566 | 4567 | 4568 | 4569 | 4570 | comment 4571 | Prefix unary operator 4572 | match 4573 | (?x) 4574 | \G # Matching from the beginning ensures 4575 | # that we start with operator-head 4576 | (?<=^|[\s(\[{,;:]) 4577 | ( 4578 | (?!(//|/\*|\*/)) 4579 | ( 4580 | [/=\-+!*%<>&|^~?] # operator-head 4581 | | [\x{00A1}-\x{00A7}] 4582 | | [\x{00A9}\x{00AB}] 4583 | | [\x{00AC}\x{00AE}] 4584 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 4585 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 4586 | | [\x{2030}-\x{203E}] 4587 | | [\x{2041}-\x{2053}] 4588 | | [\x{2055}-\x{205E}] 4589 | | [\x{2190}-\x{23FF}] 4590 | | [\x{2500}-\x{2775}] 4591 | | [\x{2794}-\x{2BFF}] 4592 | | [\x{2E00}-\x{2E7F}] 4593 | | [\x{3001}-\x{3003}] 4594 | | [\x{3008}-\x{3030}] 4595 | 4596 | | [\x{0300}-\x{036F}] # operator-character 4597 | | [\x{1DC0}-\x{1DFF}] 4598 | | [\x{20D0}-\x{20FF}] 4599 | | [\x{FE00}-\x{FE0F}] 4600 | | [\x{FE20}-\x{FE2F}] 4601 | | [\x{E0100}-\x{E01EF}] 4602 | ) 4603 | )++ 4604 | (?![\s)\]},;:]|\z) 4605 | 4606 | 4607 | 4608 | captures 4609 | 4610 | 0 4611 | 4612 | patterns 4613 | 4614 | 4615 | match 4616 | \G(\+\+|\-\-)$ 4617 | name 4618 | keyword.operator.increment-or-decrement.swift 4619 | 4620 | 4621 | match 4622 | \G!$ 4623 | name 4624 | keyword.operator.increment-or-decrement.swift 4625 | 4626 | 4627 | match 4628 | .+ 4629 | name 4630 | keyword.operator.custom.postfix.swift 4631 | 4632 | 4633 | 4634 | 4635 | comment 4636 | Postfix unary operator 4637 | match 4638 | (?x) 4639 | \G # Matching from the beginning ensures 4640 | # that we start with operator-head 4641 | (?<!^|[\s(\[{,;:]) 4642 | ( 4643 | (?!(//|/\*|\*/)) 4644 | ( 4645 | [/=\-+!*%<>&|^~?] # operator-head 4646 | | [\x{00A1}-\x{00A7}] 4647 | | [\x{00A9}\x{00AB}] 4648 | | [\x{00AC}\x{00AE}] 4649 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 4650 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 4651 | | [\x{2030}-\x{203E}] 4652 | | [\x{2041}-\x{2053}] 4653 | | [\x{2055}-\x{205E}] 4654 | | [\x{2190}-\x{23FF}] 4655 | | [\x{2500}-\x{2775}] 4656 | | [\x{2794}-\x{2BFF}] 4657 | | [\x{2E00}-\x{2E7F}] 4658 | | [\x{3001}-\x{3003}] 4659 | | [\x{3008}-\x{3030}] 4660 | 4661 | | [\x{0300}-\x{036F}] # operator-character 4662 | | [\x{1DC0}-\x{1DFF}] 4663 | | [\x{20D0}-\x{20FF}] 4664 | | [\x{FE00}-\x{FE0F}] 4665 | | [\x{FE20}-\x{FE2F}] 4666 | | [\x{E0100}-\x{E01EF}] 4667 | ) 4668 | )++ 4669 | (?=[\s)\]},;:]|\z) 4670 | 4671 | 4672 | 4673 | captures 4674 | 4675 | 0 4676 | 4677 | patterns 4678 | 4679 | 4680 | match 4681 | \G=$ 4682 | name 4683 | keyword.operator.assignment.swift 4684 | 4685 | 4686 | match 4687 | \G(\+|\-|\*|/|%|<<|>>|&|\^|\||&&|\|\|)=$ 4688 | name 4689 | keyword.operator.assignment.compound.swift 4690 | 4691 | 4692 | match 4693 | \G(\+|\-|\*|/)$ 4694 | name 4695 | keyword.operator.arithmetic.swift 4696 | 4697 | 4698 | match 4699 | \G&(\+|\-|\*)$ 4700 | name 4701 | keyword.operator.arithmetic.overflow.swift 4702 | 4703 | 4704 | match 4705 | \G%$ 4706 | name 4707 | keyword.operator.arithmetic.remainder.swift 4708 | 4709 | 4710 | match 4711 | \G(==|!=|>|<|>=|<=|~=)$ 4712 | name 4713 | keyword.operator.comparison.swift 4714 | 4715 | 4716 | match 4717 | \G\?\?$ 4718 | name 4719 | keyword.operator.coalescing.swift 4720 | 4721 | 4722 | match 4723 | \G(&&|\|\|)$ 4724 | name 4725 | keyword.operator.logical.swift 4726 | 4727 | 4728 | match 4729 | \G(&|\||\^|<<|>>)$ 4730 | name 4731 | keyword.operator.bitwise.swift 4732 | 4733 | 4734 | match 4735 | \G(===|!==)$ 4736 | name 4737 | keyword.operator.bitwise.swift 4738 | 4739 | 4740 | match 4741 | \G\?$ 4742 | name 4743 | keyword.operator.ternary.swift 4744 | 4745 | 4746 | match 4747 | .+ 4748 | name 4749 | keyword.operator.custom.infix.swift 4750 | 4751 | 4752 | 4753 | 4754 | comment 4755 | Infix operator 4756 | match 4757 | (?x) 4758 | \G # Matching from the beginning ensures 4759 | # that we start with operator-head 4760 | ( 4761 | (?!(//|/\*|\*/)) 4762 | ( 4763 | [/=\-+!*%<>&|^~?] # operator-head 4764 | | [\x{00A1}-\x{00A7}] 4765 | | [\x{00A9}\x{00AB}] 4766 | | [\x{00AC}\x{00AE}] 4767 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 4768 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 4769 | | [\x{2030}-\x{203E}] 4770 | | [\x{2041}-\x{2053}] 4771 | | [\x{2055}-\x{205E}] 4772 | | [\x{2190}-\x{23FF}] 4773 | | [\x{2500}-\x{2775}] 4774 | | [\x{2794}-\x{2BFF}] 4775 | | [\x{2E00}-\x{2E7F}] 4776 | | [\x{3001}-\x{3003}] 4777 | | [\x{3008}-\x{3030}] 4778 | 4779 | | [\x{0300}-\x{036F}] # operator-character 4780 | | [\x{1DC0}-\x{1DFF}] 4781 | | [\x{20D0}-\x{20FF}] 4782 | | [\x{FE00}-\x{FE0F}] 4783 | | [\x{FE20}-\x{FE2F}] 4784 | | [\x{E0100}-\x{E01EF}] 4785 | ) 4786 | )++ 4787 | 4788 | 4789 | 4790 | captures 4791 | 4792 | 0 4793 | 4794 | patterns 4795 | 4796 | 4797 | match 4798 | .+ 4799 | name 4800 | keyword.operator.custom.prefix.dot.swift 4801 | 4802 | 4803 | 4804 | 4805 | comment 4806 | Dot prefix unary operator 4807 | match 4808 | (?x) 4809 | \G # Matching from the beginning ensures 4810 | # that we start with operator-head 4811 | (?<=^|[\s(\[{,;:]) 4812 | \. # dot 4813 | ( 4814 | (?!(//|/\*|\*/)) 4815 | ( 4816 | \. # dot 4817 | | [/=\-+!*%<>&|^~?] # operator-head 4818 | | [\x{00A1}-\x{00A7}] 4819 | | [\x{00A9}\x{00AB}] 4820 | | [\x{00AC}\x{00AE}] 4821 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 4822 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 4823 | | [\x{2030}-\x{203E}] 4824 | | [\x{2041}-\x{2053}] 4825 | | [\x{2055}-\x{205E}] 4826 | | [\x{2190}-\x{23FF}] 4827 | | [\x{2500}-\x{2775}] 4828 | | [\x{2794}-\x{2BFF}] 4829 | | [\x{2E00}-\x{2E7F}] 4830 | | [\x{3001}-\x{3003}] 4831 | | [\x{3008}-\x{3030}] 4832 | 4833 | | [\x{0300}-\x{036F}] # operator-character 4834 | | [\x{1DC0}-\x{1DFF}] 4835 | | [\x{20D0}-\x{20FF}] 4836 | | [\x{FE00}-\x{FE0F}] 4837 | | [\x{FE20}-\x{FE2F}] 4838 | | [\x{E0100}-\x{E01EF}] 4839 | ) 4840 | )++ 4841 | (?![\s)\]},;:]|\z) 4842 | 4843 | 4844 | 4845 | captures 4846 | 4847 | 0 4848 | 4849 | patterns 4850 | 4851 | 4852 | match 4853 | .+ 4854 | name 4855 | keyword.operator.custom.postfix.dot.swift 4856 | 4857 | 4858 | 4859 | 4860 | comment 4861 | Dot postfix unary operator 4862 | match 4863 | (?x) 4864 | \G # Matching from the beginning ensures 4865 | # that we start with operator-head 4866 | (?<!^|[\s(\[{,;:]) 4867 | \. # dot 4868 | ( 4869 | (?!(//|/\*|\*/)) 4870 | ( 4871 | \. # dot 4872 | | [/=\-+!*%<>&|^~?] # operator-head 4873 | | [\x{00A1}-\x{00A7}] 4874 | | [\x{00A9}\x{00AB}] 4875 | | [\x{00AC}\x{00AE}] 4876 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 4877 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 4878 | | [\x{2030}-\x{203E}] 4879 | | [\x{2041}-\x{2053}] 4880 | | [\x{2055}-\x{205E}] 4881 | | [\x{2190}-\x{23FF}] 4882 | | [\x{2500}-\x{2775}] 4883 | | [\x{2794}-\x{2BFF}] 4884 | | [\x{2E00}-\x{2E7F}] 4885 | | [\x{3001}-\x{3003}] 4886 | | [\x{3008}-\x{3030}] 4887 | 4888 | | [\x{0300}-\x{036F}] # operator-character 4889 | | [\x{1DC0}-\x{1DFF}] 4890 | | [\x{20D0}-\x{20FF}] 4891 | | [\x{FE00}-\x{FE0F}] 4892 | | [\x{FE20}-\x{FE2F}] 4893 | | [\x{E0100}-\x{E01EF}] 4894 | ) 4895 | )++ 4896 | (?=[\s)\]},;:]|\z) 4897 | 4898 | 4899 | 4900 | captures 4901 | 4902 | 0 4903 | 4904 | patterns 4905 | 4906 | 4907 | match 4908 | \G\.\.[.<]$ 4909 | name 4910 | keyword.operator.range.swift 4911 | 4912 | 4913 | match 4914 | .+ 4915 | name 4916 | keyword.operator.custom.infix.dot.swift 4917 | 4918 | 4919 | 4920 | 4921 | comment 4922 | Dot infix operator 4923 | match 4924 | (?x) 4925 | \G # Matching from the beginning ensures 4926 | # that we start with operator-head 4927 | \. # dot 4928 | ( 4929 | (?!(//|/\*|\*/)) 4930 | ( 4931 | \. # dot 4932 | | [/=\-+!*%<>&|^~?] # operator-head 4933 | | [\x{00A1}-\x{00A7}] 4934 | | [\x{00A9}\x{00AB}] 4935 | | [\x{00AC}\x{00AE}] 4936 | | [\x{00B0}-\x{00B1}\x{00B6}\x{00BB}\x{00BF}\x{00D7}\x{00F7}] 4937 | | [\x{2016}-\x{2017}\x{2020}-\x{2027}] 4938 | | [\x{2030}-\x{203E}] 4939 | | [\x{2041}-\x{2053}] 4940 | | [\x{2055}-\x{205E}] 4941 | | [\x{2190}-\x{23FF}] 4942 | | [\x{2500}-\x{2775}] 4943 | | [\x{2794}-\x{2BFF}] 4944 | | [\x{2E00}-\x{2E7F}] 4945 | | [\x{3001}-\x{3003}] 4946 | | [\x{3008}-\x{3030}] 4947 | 4948 | | [\x{0300}-\x{036F}] # operator-character 4949 | | [\x{1DC0}-\x{1DFF}] 4950 | | [\x{20D0}-\x{20FF}] 4951 | | [\x{FE00}-\x{FE0F}] 4952 | | [\x{FE20}-\x{FE2F}] 4953 | | [\x{E0100}-\x{E01EF}] 4954 | ) 4955 | )++ 4956 | 4957 | 4958 | 4959 | 4960 | 4961 | match 4962 | : 4963 | name 4964 | keyword.operator.ternary.swift 4965 | 4966 | 4967 | 4968 | root 4969 | 4970 | patterns 4971 | 4972 | 4973 | include 4974 | #compiler-control 4975 | 4976 | 4977 | include 4978 | #declarations 4979 | 4980 | 4981 | include 4982 | #expressions 4983 | 4984 | 4985 | 4986 | 4987 | scopeName 4988 | source.swift 4989 | uuid 4990 | 8C743E89-9C8D-4833-8149-6500D82AA463 4991 | 4992 | 4993 | -------------------------------------------------------------------------------- /test/extension.test.ts: -------------------------------------------------------------------------------- 1 | // 2 | // Note: This example test is leveraging the Mocha test framework. 3 | // Please refer to their documentation on https://mochajs.org/ for help. 4 | // 5 | 6 | // The module 'assert' provides assertion methods from node 7 | import * as assert from 'assert'; 8 | 9 | // You can import and use all API from the 'vscode' module 10 | // as well as import your extension to test it 11 | import * as vscode from 'vscode'; 12 | import * as myExtension from '../src/extension'; 13 | 14 | // Defines a Mocha test suite to group tests of similar kind together 15 | suite("Extension Tests", () => { 16 | 17 | // Defines a Mocha unit test 18 | test("Something 1", () => { 19 | assert.equal(-1, [1, 2, 3].indexOf(5)); 20 | assert.equal(-1, [1, 2, 3].indexOf(0)); 21 | }); 22 | }); -------------------------------------------------------------------------------- /test/index.ts: -------------------------------------------------------------------------------- 1 | // 2 | // PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING 3 | // 4 | // This file is providing the test runner to use when running extension tests. 5 | // By default the test runner in use is Mocha based. 6 | // 7 | // You can provide your own test runner if you want to override it by exporting 8 | // a function run(testRoot: string, clb: (error:Error) => void) that the extension 9 | // host can call to run the tests. The test runner is expected to use console.log 10 | // to report the results back to the caller. When the tests are finished, return 11 | // a possible error to the callback or null if none. 12 | 13 | var testRunner = require('vscode/lib/testrunner'); 14 | 15 | // You can directly control Mocha options by uncommenting the following lines 16 | // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info 17 | testRunner.configure({ 18 | ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) 19 | useColors: true // colored output from test results 20 | }); 21 | 22 | module.exports = testRunner; -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "moduleResolution": "node", 6 | "outDir": "out", 7 | "lib": [ "es2016" ], 8 | "sourceMap": true 9 | }, 10 | "exclude": [ 11 | "node_modules", 12 | "server" 13 | ] 14 | } --------------------------------------------------------------------------------