annotate runtime/syntax/swift.vim @ 25786:ec62e0764ffa v8.2.3428

patch 8.2.3428: using freed memory when replacing Commit: https://github.com/vim/vim/commit/35a9a00afcb20897d462a766793ff45534810dc3 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 11 21:14:20 2021 +0200 patch 8.2.3428: using freed memory when replacing Problem: Using freed memory when replacing. (Dhiraj Mishra) Solution: Get the line pointer after calling ins_copychar().
author Bram Moolenaar <Bram@vim.org>
date Sat, 11 Sep 2021 21:15:03 +0200
parents fab58304f77d
children
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 \ break
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
25 \ case
19180
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
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
28 \ default
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 \ defer
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 \ do
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 \ else
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 \ fallthrough
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 \ for
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 \ guard
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 \ if
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 \ in
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 \ repeat
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 \ return
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 \ switch
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 \ throw
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 \ try
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 \ where
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 \ while
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 syn match swiftMultiwordKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 \ "indirect case"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
47 syn keyword swiftCoreTypes
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
48 \ Any
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
49 \ AnyObject
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
50
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 syn keyword swiftImport skipwhite skipempty nextgroup=swiftImportModule
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 \ import
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 syn keyword swiftDefinitionModifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 \ convenience
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 \ dynamic
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 \ fileprivate
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 \ final
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 \ internal
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 \ lazy
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 \ nonmutating
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 \ open
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 \ override
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 \ prefix
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 \ private
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 \ public
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 \ required
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 \ rethrows
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 \ static
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 \ throws
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 \ weak
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 syn keyword swiftInOutKeyword skipwhite skipempty nextgroup=swiftTypeName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 \ inout
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 syn keyword swiftIdentifierKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 \ Self
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 \ metatype
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 \ self
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 \ super
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 syn keyword swiftFuncKeywordGeneral skipwhite skipempty nextgroup=swiftTypeParameters
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 \ init
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 syn keyword swiftFuncKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 \ deinit
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 \ subscript
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 syn keyword swiftScope
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 \ autoreleasepool
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 swiftMutating skipwhite skipempty nextgroup=swiftFuncDefinition
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 \ mutating
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 syn keyword swiftFuncDefinition skipwhite skipempty nextgroup=swiftTypeName,swiftOperator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 \ func
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 syn keyword swiftTypeDefinition skipwhite skipempty nextgroup=swiftTypeName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 \ class
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 \ enum
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 \ extension
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
101 \ operator
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
102 \ precedencegroup
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 \ protocol
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 \ struct
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 syn keyword swiftTypeAliasDefinition skipwhite skipempty nextgroup=swiftTypeAliasName
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
107 \ associatedtype
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 \ typealias
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 syn match swiftMultiwordTypeDefinition skipwhite skipempty nextgroup=swiftTypeName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 \ "indirect enum"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 syn keyword swiftVarDefinition skipwhite skipempty nextgroup=swiftVarName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 \ let
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 \ var
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 syn keyword swiftLabel
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 \ get
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 \ set
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 \ didSet
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 \ willSet
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 syn keyword swiftBoolean
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 \ false
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 \ true
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 keyword swiftNil
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 \ nil
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 syn match swiftImportModule contained nextgroup=swiftImportComponent
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 \ /\<[A-Za-z_][A-Za-z_0-9]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 syn match swiftImportComponent contained nextgroup=swiftImportComponent
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 \ /\.\<[A-Za-z_][A-Za-z_0-9]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 syn match swiftTypeAliasName contained skipwhite skipempty nextgroup=swiftTypeAliasValue
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 \ /\<[A-Za-z_][A-Za-z_0-9]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 syn match swiftTypeName 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 syn match swiftVarName contained skipwhite skipempty nextgroup=swiftTypeDeclaration
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 \ /\<[A-Za-z_][A-Za-z_0-9]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 syn match swiftImplicitVarName
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 \ /\$\<[A-Za-z_0-9]\+\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 " TypeName[Optionality]?
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 syn match swiftType contained skipwhite skipempty nextgroup=swiftTypeParameters
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 " [Type:Type] (dictionary) or [Type] (array)
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 syn region swiftType contained contains=swiftTypePair,swiftType
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 \ matchgroup=Delimiter start=/\[/ end=/\]/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 syn match swiftTypePair contained skipwhite skipempty nextgroup=swiftTypeParameters,swiftTypeDeclaration
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 " (Type[, Type]) (tuple)
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 " FIXME: we should be able to use skip="," and drop swiftParamDelim
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 syn region swiftType contained contains=swiftType,swiftParamDelim
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 \ matchgroup=Delimiter start="[^@]\?(" end=")" matchgroup=NONE skip=","
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 syn match swiftParamDelim contained
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 " <Generic Clause> (generics)
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 syn region swiftTypeParameters contained contains=swiftVarName,swiftConstraint
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 \ matchgroup=Delimiter start="<" end=">" matchgroup=NONE skip=","
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 syn keyword swiftConstraint contained
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 \ where
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 syn match swiftTypeAliasValue skipwhite skipempty nextgroup=swiftType
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 \ /=/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType,swiftInOutKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 \ /:/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType
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
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 syn match swiftKeyword
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 \ /\<case\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 syn region swiftCaseLabelRegion
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 \ matchgroup=swiftKeyword start=/\<case\>/ matchgroup=Delimiter end=/:/ oneline contains=TOP
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 syn region swiftDefaultLabelRegion
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 \ matchgroup=swiftKeyword start=/\<default\>/ matchgroup=Delimiter end=/:/ oneline
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 syn region swiftParenthesisRegion contains=TOP
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 \ matchgroup=NONE start=/(/ end=/)/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 syn region swiftString contains=swiftInterpolationRegion
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 \ start=/"/ skip=/\\\\\|\\"/ end=/"/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 syn region swiftInterpolationRegion contained contains=TOP
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 \ matchgroup=swiftInterpolation start=/\\(/ end=/)/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 syn region swiftComment contains=swiftComment,swiftLineComment,swiftTodo
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 \ start="/\*" end="\*/"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 syn region swiftLineComment contains=swiftComment,swiftTodo
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 \ start="//" end="$"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 syn match swiftDecimal
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 \ /[+\-]\?\<\([0-9][0-9_]*\)\([.][0-9_]*\)\?\([eE][+\-]\?[0-9][0-9_]*\)\?\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 syn match swiftHex
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 \ /[+\-]\?\<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
194 syn match swiftOct
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 \ /[+\-]\?\<0o[0-7][0-7_]*\>/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 syn match swiftBin
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 \ /[+\-]\?\<0b[01][01_]*\>/
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 swiftOperator skipwhite skipempty nextgroup=swiftTypeParameters
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 \ "\.\@<!\.\.\.\@!\|[/=\-+*%<>!&|^~]\@<!\(/[/*]\@![/=\-+*%<>!&|^~]*\|*/\@![/=\-+*%<>!&|^~]*\|->\@![/=\-+*%<>!&|^~]*\|[=+%<>!&|^~][/=\-+*%<>!&|^~]*\)"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 syn match swiftOperator skipwhite skipempty nextgroup=swiftTypeParameters
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 \ "\.\.[<.]"
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 swiftChar
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 \ /'\([^'\\]\|\\\(["'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
206
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 syn match swiftTupleIndexNumber contains=swiftDecimal
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 \ /\.[0-9]\+/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 syn match swiftDecimal contained
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 \ /[0-9]\+/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 syn match swiftPreproc
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
213 \ /#\(\<column\>\|\<dsohandle\>\|\<file\>\|\<line\>\|\<function\>\)/
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 syn match swiftPreproc
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 \ /^\s*#\(\<if\>\|\<else\>\|\<elseif\>\|\<endif\>\|\<error\>\|\<warning\>\)/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 syn region swiftPreprocFalse
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 \ start="^\s*#\<if\>\s\+\<false\>" end="^\s*#\(\<else\>\|\<elseif\>\|\<endif\>\)"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 syn match swiftAttribute
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 \ /@\<\w\+\>/ skipwhite skipempty nextgroup=swiftType,swiftTypeDefinition
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 syn keyword swiftTodo MARK TODO FIXME contained
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
224 syn match swiftCastOp skipwhite skipempty nextgroup=swiftType,swiftCoreTypes
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 \ "\<is\>"
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
226 syn match swiftCastOp skipwhite skipempty nextgroup=swiftType,swiftCoreTypes
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 \ "\<as\>[!?]\?"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 syn match swiftNilOps
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 \ "??"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 syn region swiftReservedIdentifier oneline
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 \ start=/`/ end=/`/
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 hi def link swiftImport Include
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 hi def link swiftImportModule Title
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 hi def link swiftImportComponent Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 hi def link swiftKeyword Statement
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
239 hi def link swiftCoreTypes Type
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 hi def link swiftMultiwordKeyword Statement
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 hi def link swiftTypeDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 hi def link swiftMultiwordTypeDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 hi def link swiftType Type
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 hi def link swiftTypePair Type
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 hi def link swiftTypeAliasName Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 hi def link swiftTypeName Function
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 hi def link swiftConstraint Special
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 hi def link swiftFuncDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 hi def link swiftDefinitionModifier Operator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 hi def link swiftInOutKeyword Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 hi def link swiftFuncKeyword Function
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 hi def link swiftFuncKeywordGeneral Function
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 hi def link swiftTypeAliasDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 hi def link swiftVarDefinition Define
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 hi def link swiftVarName Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 hi def link swiftImplicitVarName Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 hi def link swiftIdentifierKeyword Identifier
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 hi def link swiftTypeAliasValue Delimiter
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 hi def link swiftTypeDeclaration Delimiter
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 hi def link swiftTypeParameters Delimiter
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 hi def link swiftBoolean Boolean
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 hi def link swiftString String
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 hi def link swiftInterpolation Special
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 hi def link swiftComment Comment
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 hi def link swiftLineComment Comment
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 hi def link swiftDecimal Number
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 hi def link swiftHex Number
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 hi def link swiftOct Number
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 hi def link swiftBin Number
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 hi def link swiftOperator Function
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 hi def link swiftChar Character
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 hi def link swiftLabel Operator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 hi def link swiftMutating Statement
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 hi def link swiftPreproc PreCondit
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275 hi def link swiftPreprocFalse Comment
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 hi def link swiftAttribute Type
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 hi def link swiftTodo Todo
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 hi def link swiftNil Constant
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279 hi def link swiftCastOp Operator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 hi def link swiftNilOps Operator
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
281 hi def link swiftScope PreProc
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
282
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 let b:current_syntax = "swift"
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 let &cpo = s:keepcpo
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 unlet s:keepcpo