annotate runtime/syntax/swift.vim @ 21233:7f90d64e0982

Added tag v8.2.1167 for changeset 3f14e0d4a4dd08d91b5ca9e0410d8a1ed8b30ee2
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 Jul 2020 21:30:04 +0200
parents 8edf0aeb71b9
children fab58304f77d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " This source file is part of the Swift.org open source project
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 "
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Licensed under Apache License v2.0 with Runtime Library Exception
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 "
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " See https://swift.org/LICENSE.txt for license information
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 "
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 " Vim syntax file
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 " Language: swift
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 " Maintainer: Joe Groff <jgroff@apple.com>
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 " Last Change: 2018 Jan 21
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 "
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 " Vim maintainer: Emir SARI <bitigchi@me.com>
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 if exists("b:current_syntax")
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 finish
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 endif
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 let s:keepcpo = &cpo
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 set cpo&vim
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 syn keyword swiftKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 \ associatedtype
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 \ break
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 \ catch
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 \ continue
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 \ defer
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 \ do
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 \ else
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 \ fallthrough
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 \ for
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 \ guard
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 \ if
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 \ in
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 \ repeat
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 \ return
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 \ switch
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 \ throw
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 \ try
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 \ where
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 \ while
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 syn match swiftMultiwordKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 \ "indirect case"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 syn keyword swiftImport skipwhite skipempty nextgroup=swiftImportModule
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 \ import
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 syn keyword swiftDefinitionModifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 \ convenience
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 \ dynamic
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 \ fileprivate
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 \ final
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 \ internal
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 \ lazy
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 \ nonmutating
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 \ open
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 \ override
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 \ prefix
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 \ private
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 \ public
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 \ required
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 \ rethrows
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 \ static
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 \ throws
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 \ weak
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 syn keyword swiftInOutKeyword skipwhite skipempty nextgroup=swiftTypeName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 \ inout
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 syn keyword swiftIdentifierKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 \ Self
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 \ metatype
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 \ self
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 \ super
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 syn keyword swiftFuncKeywordGeneral skipwhite skipempty nextgroup=swiftTypeParameters
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 \ init
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 syn keyword swiftFuncKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 \ deinit
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 \ subscript
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 syn keyword swiftScope
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 \ autoreleasepool
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 syn keyword swiftMutating skipwhite skipempty nextgroup=swiftFuncDefinition
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 \ mutating
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 syn keyword swiftFuncDefinition skipwhite skipempty nextgroup=swiftTypeName,swiftOperator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 \ func
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 syn keyword swiftTypeDefinition skipwhite skipempty nextgroup=swiftTypeName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 \ class
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 \ enum
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 \ extension
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 \ protocol
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 \ struct
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 syn keyword swiftTypeAliasDefinition skipwhite skipempty nextgroup=swiftTypeAliasName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 \ typealias
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 syn match swiftMultiwordTypeDefinition skipwhite skipempty nextgroup=swiftTypeName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 \ "indirect enum"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 syn keyword swiftVarDefinition skipwhite skipempty nextgroup=swiftVarName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 \ let
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 \ var
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 syn keyword swiftLabel
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 \ get
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 \ set
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 \ didSet
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 \ willSet
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 syn keyword swiftBoolean
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 \ false
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 \ true
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 syn keyword swiftNil
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 \ nil
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 syn match swiftImportModule contained nextgroup=swiftImportComponent
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 \ /\<[A-Za-z_][A-Za-z_0-9]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 syn match swiftImportComponent contained nextgroup=swiftImportComponent
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 \ /\.\<[A-Za-z_][A-Za-z_0-9]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 syn match swiftTypeAliasName contained skipwhite skipempty nextgroup=swiftTypeAliasValue
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 \ /\<[A-Za-z_][A-Za-z_0-9]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 syn match swiftTypeName contained skipwhite skipempty nextgroup=swiftTypeParameters
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 syn match swiftVarName contained skipwhite skipempty nextgroup=swiftTypeDeclaration
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 \ /\<[A-Za-z_][A-Za-z_0-9]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 syn match swiftImplicitVarName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 \ /\$\<[A-Za-z_0-9]\+\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 " TypeName[Optionality]?
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 syn match swiftType contained skipwhite skipempty nextgroup=swiftTypeParameters
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 " [Type:Type] (dictionary) or [Type] (array)
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 syn region swiftType contained contains=swiftTypePair,swiftType
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 \ matchgroup=Delimiter start=/\[/ end=/\]/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 syn match swiftTypePair contained skipwhite skipempty nextgroup=swiftTypeParameters,swiftTypeDeclaration
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 " (Type[, Type]) (tuple)
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 " FIXME: we should be able to use skip="," and drop swiftParamDelim
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 syn region swiftType contained contains=swiftType,swiftParamDelim
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 \ matchgroup=Delimiter start="[^@]\?(" end=")" matchgroup=NONE skip=","
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 syn match swiftParamDelim contained
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 \ /,/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 " <Generic Clause> (generics)
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 syn region swiftTypeParameters contained contains=swiftVarName,swiftConstraint
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 \ matchgroup=Delimiter start="<" end=">" matchgroup=NONE skip=","
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 syn keyword swiftConstraint contained
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 \ where
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 syn match swiftTypeAliasValue skipwhite skipempty nextgroup=swiftType
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 \ /=/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType,swiftInOutKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 \ /:/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 \ /->/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 syn match swiftKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 \ /\<case\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 syn region swiftCaseLabelRegion
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 \ matchgroup=swiftKeyword start=/\<case\>/ matchgroup=Delimiter end=/:/ oneline contains=TOP
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 syn region swiftDefaultLabelRegion
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 \ matchgroup=swiftKeyword start=/\<default\>/ matchgroup=Delimiter end=/:/ oneline
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 syn region swiftParenthesisRegion contains=TOP
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 \ matchgroup=NONE start=/(/ end=/)/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 syn region swiftString contains=swiftInterpolationRegion
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 \ start=/"/ skip=/\\\\\|\\"/ end=/"/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 syn region swiftInterpolationRegion contained contains=TOP
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 \ matchgroup=swiftInterpolation start=/\\(/ end=/)/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 syn region swiftComment contains=swiftComment,swiftLineComment,swiftTodo
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 \ start="/\*" end="\*/"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 syn region swiftLineComment contains=swiftComment,swiftTodo
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 \ start="//" end="$"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 syn match swiftDecimal
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 \ /[+\-]\?\<\([0-9][0-9_]*\)\([.][0-9_]*\)\?\([eE][+\-]\?[0-9][0-9_]*\)\?\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 syn match swiftHex
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 \ /[+\-]\?\<0x[0-9A-Fa-f][0-9A-Fa-f_]*\(\([.][0-9A-Fa-f_]*\)\?[pP][+\-]\?[0-9][0-9_]*\)\?\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 syn match swiftOct
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 \ /[+\-]\?\<0o[0-7][0-7_]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 syn match swiftBin
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 \ /[+\-]\?\<0b[01][01_]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 syn match swiftOperator skipwhite skipempty nextgroup=swiftTypeParameters
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 \ "\.\@<!\.\.\.\@!\|[/=\-+*%<>!&|^~]\@<!\(/[/*]\@![/=\-+*%<>!&|^~]*\|*/\@![/=\-+*%<>!&|^~]*\|->\@![/=\-+*%<>!&|^~]*\|[=+%<>!&|^~][/=\-+*%<>!&|^~]*\)"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 syn match swiftOperator skipwhite skipempty nextgroup=swiftTypeParameters
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 \ "\.\.[<.]"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 syn match swiftChar
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 \ /'\([^'\\]\|\\\(["'tnr0\\]\|x[0-9a-fA-F]\{2}\|u[0-9a-fA-F]\{4}\|U[0-9a-fA-F]\{8}\)\)'/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 syn match swiftTupleIndexNumber contains=swiftDecimal
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 \ /\.[0-9]\+/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 syn match swiftDecimal contained
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 \ /[0-9]\+/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 syn match swiftPreproc
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 \ /#\(\<file\>\|\<line\>\|\<function\>\)/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 syn match swiftPreproc
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 \ /^\s*#\(\<if\>\|\<else\>\|\<elseif\>\|\<endif\>\|\<error\>\|\<warning\>\)/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 syn region swiftPreprocFalse
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 \ start="^\s*#\<if\>\s\+\<false\>" end="^\s*#\(\<else\>\|\<elseif\>\|\<endif\>\)"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 syn match swiftAttribute
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 \ /@\<\w\+\>/ skipwhite skipempty nextgroup=swiftType,swiftTypeDefinition
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 syn keyword swiftTodo MARK TODO FIXME contained
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 syn match swiftCastOp skipwhite skipempty nextgroup=swiftType
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 \ "\<is\>"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 syn match swiftCastOp skipwhite skipempty nextgroup=swiftType
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 \ "\<as\>[!?]\?"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 syn match swiftNilOps
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 \ "??"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 syn region swiftReservedIdentifier oneline
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 \ start=/`/ end=/`/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 hi def link swiftImport Include
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 hi def link swiftImportModule Title
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 hi def link swiftImportComponent Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 hi def link swiftKeyword Statement
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 hi def link swiftMultiwordKeyword Statement
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 hi def link swiftTypeDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 hi def link swiftMultiwordTypeDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 hi def link swiftType Type
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 hi def link swiftTypePair Type
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 hi def link swiftTypeAliasName Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 hi def link swiftTypeName Function
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 hi def link swiftConstraint Special
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 hi def link swiftFuncDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 hi def link swiftDefinitionModifier Operator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 hi def link swiftInOutKeyword Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 hi def link swiftFuncKeyword Function
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 hi def link swiftFuncKeywordGeneral Function
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 hi def link swiftTypeAliasDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 hi def link swiftVarDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 hi def link swiftVarName Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 hi def link swiftImplicitVarName Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 hi def link swiftIdentifierKeyword Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 hi def link swiftTypeAliasValue Delimiter
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 hi def link swiftTypeDeclaration Delimiter
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 hi def link swiftTypeParameters Delimiter
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 hi def link swiftBoolean Boolean
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 hi def link swiftString String
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 hi def link swiftInterpolation Special
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 hi def link swiftComment Comment
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 hi def link swiftLineComment Comment
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 hi def link swiftDecimal Number
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 hi def link swiftHex Number
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 hi def link swiftOct Number
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 hi def link swiftBin Number
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 hi def link swiftOperator Function
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 hi def link swiftChar Character
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 hi def link swiftLabel Operator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 hi def link swiftMutating Statement
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 hi def link swiftPreproc PreCondit
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 hi def link swiftPreprocFalse Comment
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 hi def link swiftAttribute Type
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 hi def link swiftTodo Todo
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 hi def link swiftNil Constant
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 hi def link swiftCastOp Operator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 hi def link swiftNilOps Operator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 hi def link swiftScope PreProc
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 let b:current_syntax = "swift"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 let &cpo = s:keepcpo
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 unlet s:keepcpo