1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 4 This file is part of GtkSourceView 5 6 Author: Adam Dingle 7 Copyright (C) 2017 Adam Dingle <adam@medovina.org> 8 9 GtkSourceView is free software; you can redistribute it and/or 10 modify it under the terms of the GNU Lesser General Public 11 License as published by the Free Software Foundation; either 12 version 2.1 of the License, or (at your option) any later version. 13 14 GtkSourceView is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public License 20 along with this library; if not, see <http://www.gnu.org/licenses/>. 21 22--> 23 24<language id="swift" name="Swift" version="2.0" _section="Source"> 25 26 <metadata> 27 <property name="mimetypes">text/x-swift</property> 28 <property name="globs">*.swift</property> 29 <property name="line-comment-start">//</property> 30 <property name="block-comment-start">/*</property> 31 <property name="block-comment-end">*/</property> 32 </metadata> 33 34 <styles> 35 <style id="builtin" name="Builtin Value" map-to="def:builtin"/> 36 <style id="comment" name="Comment" map-to="def:comment"/> 37 <style id="compiler-control" name="Compiler Control" map-to="def:preprocessor"/> 38 <style id="declaration" name="Declaration" map-to="def:type"/> 39 <style id="escaped-character" name="Escaped Character" map-to="def:special-char"/> 40 <style id="external" name="External" map-to="def:preprocessor"/> 41 <style id="interpolated" name="Interpolated Expression" map-to="def:identifier"/> 42 <style id="keyword" name="Keyword" map-to="def:keyword"/> 43 <style id="modifier" name="Modifier" map-to="def:type"/> 44 <style id="number" name="Number" map-to="def:decimal"/> 45 <style id="operator" name="Operator" map-to="def:operator"/> 46 <style id="special" name="Special Constant" map-to="def:special-constant"/> 47 <style id="string" name="String" map-to="def:string"/> 48 <style id="type" name="Data Type" map-to="def:identifier"/> 49 </styles> 50 51 <definitions> 52 53 <context id="attribute" style-ref="special"> 54 <match>@[a-zA-Z_][a-zA-Z0-9_]*</match> 55 </context> 56 57 <context id="block-comment" style-ref="comment"> 58 <start>/\*</start> 59 <end>\*/</end> 60 <include> 61 <context ref="def:in-comment"/> 62 <context ref="block-comment"/> 63 </include> 64 </context> 65 66 <context id="builtin" style-ref="builtin"> 67 <keyword>Protocol</keyword> 68 <keyword>self</keyword> 69 <keyword>super</keyword> 70 <keyword>Type</keyword> 71 </context> 72 73 <context id="cast" style-ref="operator"> 74 <keyword>as</keyword> 75 <keyword>is</keyword> 76 </context> 77 78 <context id="compiler-control" style-ref="compiler-control"> 79 <match extended="true"> 80 \#(available|colorLiteral|column|else|elseif|endif|file|fileLiteral|function|if 81 |imageLiteral|keyPath|line|selector|sourceLocation) 82 </match> 83 </context> 84 85 <context id="declaration" style-ref="declaration"> 86 <keyword>associatedtype</keyword> 87 <keyword>case</keyword> 88 <keyword>class</keyword> 89 <keyword>didSet</keyword> 90 <keyword>enum</keyword> 91 <keyword>extension</keyword> 92 <keyword>func</keyword> 93 <keyword>get</keyword> 94 <keyword>init</keyword> 95 <keyword>let</keyword> 96 <keyword>precedencegroup</keyword> 97 <keyword>protocol</keyword> 98 <keyword>set</keyword> 99 <keyword>struct</keyword> 100 <keyword>subscript</keyword> 101 <keyword>typealias</keyword> 102 <keyword>var</keyword> 103 <keyword>willSet</keyword> 104 </context> 105 106 <context id="external" style-ref="external"> 107 <keyword>import</keyword> 108 </context> 109 110 <context id="implicit-param" style-ref="builtin"> 111 <match>\$[0-9]+</match> 112 </context> 113 114 <context id="library-type" style-ref="type"> 115 <keyword>AnyBidirectionalCollection</keyword> 116 <keyword>AnyCollection</keyword> 117 <keyword>AnyHashable</keyword> 118 <keyword>AnyIndex</keyword> 119 <keyword>AnyIterator</keyword> 120 <keyword>AnyRandomAccessCollection</keyword> 121 <keyword>AnySequence</keyword> 122 <keyword>ArithmeticOverflow</keyword> 123 <keyword>Array</keyword> 124 <keyword>ArraySlice</keyword> 125 <keyword>AutoreleasingUnsafeMutablePointer</keyword> 126 <keyword>BidirectionalSlice</keyword> 127 <keyword>Bool</keyword> 128 <keyword>CVaListPointer</keyword> 129 <keyword>Character</keyword> 130 <keyword>ClosedRange</keyword> 131 <keyword>ClosedRangeIndex</keyword> 132 <keyword>ClosedRangeIterator</keyword> 133 <keyword>CollectionOfOne</keyword> 134 <keyword>CommandLine</keyword> 135 <keyword>ContiguousArray</keyword> 136 <keyword>CountableClosedRange</keyword> 137 <keyword>CountableRange</keyword> 138 <keyword>DefaultBidirectionalIndices</keyword> 139 <keyword>DefaultIndices</keyword> 140 <keyword>DefaultRandomAccessIndices</keyword> 141 <keyword>Dictionary</keyword> 142 <keyword>DictionaryIterator</keyword> 143 <keyword>DictionaryLiteral</keyword> 144 <keyword>Double</keyword> 145 <keyword>EmptyCollection</keyword> 146 <keyword>EmptyIterator</keyword> 147 <keyword>EnumeratedIterator</keyword> 148 <keyword>EnumeratedSequence</keyword> 149 <keyword>FlattenBidirectionalCollection</keyword> 150 <keyword>FlattenBidirectionalCollectionIndex</keyword> 151 <keyword>FlattenCollection</keyword> 152 <keyword>FlattenCollectionIndex</keyword> 153 <keyword>FlattenIterator</keyword> 154 <keyword>FlattenSequence</keyword> 155 <keyword>Float</keyword> 156 <keyword>Float80</keyword> 157 <keyword>FloatingPointClassification</keyword> 158 <keyword>FloatingPointRoundingRule</keyword> 159 <keyword>FloatingPointSign</keyword> 160 <keyword>ImplicitlyUnwrappedOptional</keyword> 161 <keyword>IndexingIterator</keyword> 162 <keyword>Int</keyword> 163 <keyword>Int16</keyword> 164 <keyword>Int32</keyword> 165 <keyword>Int64</keyword> 166 <keyword>Int8</keyword> 167 <keyword>IteratorOverOne</keyword> 168 <keyword>IteratorSequence</keyword> 169 <keyword>JoinedIterator</keyword> 170 <keyword>JoinedSequence</keyword> 171 <keyword>LazyBidirectionalCollection</keyword> 172 <keyword>LazyCollection</keyword> 173 <keyword>LazyDropWhileBidirectionalCollection</keyword> 174 <keyword>LazyDropWhileCollection</keyword> 175 <keyword>LazyDropWhileIndex</keyword> 176 <keyword>LazyDropWhileIterator</keyword> 177 <keyword>LazyDropWhileSequence</keyword> 178 <keyword>LazyFilterBidirectionalCollection</keyword> 179 <keyword>LazyFilterCollection</keyword> 180 <keyword>LazyFilterIndex</keyword> 181 <keyword>LazyFilterIterator</keyword> 182 <keyword>LazyFilterSequence</keyword> 183 <keyword>LazyMapBidirectionalCollection</keyword> 184 <keyword>LazyMapCollection</keyword> 185 <keyword>LazyMapIterator</keyword> 186 <keyword>LazyMapRandomAccessCollection</keyword> 187 <keyword>LazyMapSequence</keyword> 188 <keyword>LazyPrefixWhileBidirectionalCollection</keyword> 189 <keyword>LazyPrefixWhileCollection</keyword> 190 <keyword>LazyPrefixWhileIndex</keyword> 191 <keyword>LazyPrefixWhileIterator</keyword> 192 <keyword>LazyPrefixWhileSequence</keyword> 193 <keyword>LazyRandomAccessCollection</keyword> 194 <keyword>LazySequence</keyword> 195 <keyword>ManagedBuffer</keyword> 196 <keyword>ManagedBufferPointer</keyword> 197 <keyword>MemoryLayout</keyword> 198 <keyword>Mirror</keyword> 199 <keyword>MutableBidirectionalSlice</keyword> 200 <keyword>MutableRandomAccessSlice</keyword> 201 <keyword>MutableRangeReplaceableBidirectionalSlice</keyword> 202 <keyword>MutableRangeReplaceableRandomAccessSlice</keyword> 203 <keyword>MutableRangeReplaceableSlice</keyword> 204 <keyword>MutableSlice</keyword> 205 <keyword>Never</keyword> 206 <keyword>ObjectIdentifier</keyword> 207 <keyword>OpaquePointer</keyword> 208 <keyword>Optional</keyword> 209 <keyword>PlaygroundQuickLook</keyword> 210 <keyword>RandomAccessSlice</keyword> 211 <keyword>Range</keyword> 212 <keyword>RangeReplaceableBidirectionalSlice</keyword> 213 <keyword>RangeReplaceableRandomAccessSlice</keyword> 214 <keyword>RangeReplaceableSlice</keyword> 215 <keyword>Repeated</keyword> 216 <keyword>ReversedCollection</keyword> 217 <keyword>ReversedIndex</keyword> 218 <keyword>ReversedRandomAccessCollection</keyword> 219 <keyword>ReversedRandomAccessIndex</keyword> 220 <keyword>Set</keyword> 221 <keyword>SetIterator</keyword> 222 <keyword>Slice</keyword> 223 <keyword>StaticString</keyword> 224 <keyword>StrideThrough</keyword> 225 <keyword>StrideThroughIterator</keyword> 226 <keyword>StrideTo</keyword> 227 <keyword>StrideToIterator</keyword> 228 <keyword>String</keyword> 229 <keyword>UInt</keyword> 230 <keyword>UInt16</keyword> 231 <keyword>UInt32</keyword> 232 <keyword>UInt64</keyword> 233 <keyword>UInt8</keyword> 234 <keyword>UTF16</keyword> 235 <keyword>UTF32</keyword> 236 <keyword>UTF8</keyword> 237 <keyword>UnfoldSequence</keyword> 238 <keyword>UnicodeDecodingResult</keyword> 239 <keyword>UnicodeScalar</keyword> 240 <keyword>Unmanaged</keyword> 241 <keyword>UnsafeBufferPointer</keyword> 242 <keyword>UnsafeBufferPointerIterator</keyword> 243 <keyword>UnsafeMutableBufferPointer</keyword> 244 <keyword>UnsafeMutablePointer</keyword> 245 <keyword>UnsafeMutableRawBufferPointer</keyword> 246 <keyword>UnsafeMutableRawPointer</keyword> 247 <keyword>UnsafePointer</keyword> 248 <keyword>UnsafeRawBufferPointer</keyword> 249 <keyword>UnsafeRawPointer</keyword> 250 <keyword>Zip2Iterator</keyword> 251 <keyword>Zip2Sequence</keyword> 252 253 <keyword>AbsoluteValuable</keyword> 254 <keyword>AnyObject</keyword> 255 <keyword>Arithmetic</keyword> 256 <keyword>BidirectionalCollection</keyword> 257 <keyword>BinaryFloatingPoint</keyword> 258 <keyword>BinaryInteger</keyword> 259 <keyword>BitwiseOperations</keyword> 260 <keyword>CVarArg</keyword> 261 <keyword>Collection</keyword> 262 <keyword>Comparable</keyword> 263 <keyword>CustomDebugStringConvertible</keyword> 264 <keyword>CustomLeafReflectable</keyword> 265 <keyword>CustomPlaygroundQuickLookable</keyword> 266 <keyword>CustomReflectable</keyword> 267 <keyword>CustomStringConvertible</keyword> 268 <keyword>Equatable</keyword> 269 <keyword>Error</keyword> 270 <keyword>ExpressibleByArrayLiteral</keyword> 271 <keyword>ExpressibleByBooleanLiteral</keyword> 272 <keyword>ExpressibleByDictionaryLiteral</keyword> 273 <keyword>ExpressibleByExtendedGraphemeClusterLiteral</keyword> 274 <keyword>ExpressibleByFloatLiteral</keyword> 275 <keyword>ExpressibleByIntegerLiteral</keyword> 276 <keyword>ExpressibleByNilLiteral</keyword> 277 <keyword>ExpressibleByStringLiteral</keyword> 278 <keyword>ExpressibleByUnicodeScalarLiteral</keyword> 279 <keyword>FixedWidthInteger</keyword> 280 <keyword>FloatingPoint</keyword> 281 <keyword>Hashable</keyword> 282 <keyword>Integer</keyword> 283 <keyword>IntegerArithmetic</keyword> 284 <keyword>IteratorProtocol</keyword> 285 <keyword>LazyCollectionProtocol</keyword> 286 <keyword>LazySequenceProtocol</keyword> 287 <keyword>LosslessStringConvertible</keyword> 288 <keyword>MirrorPath</keyword> 289 <keyword>MutableCollection</keyword> 290 <keyword>OptionSet</keyword> 291 <keyword>RandomAccessCollection</keyword> 292 <keyword>RangeReplaceableCollection</keyword> 293 <keyword>RawRepresentable</keyword> 294 <keyword>Sequence</keyword> 295 <keyword>SetAlgebra</keyword> 296 <keyword>SignedArithmetic</keyword> 297 <keyword>SignedInteger</keyword> 298 <keyword>SignedNumber</keyword> 299 <keyword>Strideable</keyword> 300 <keyword>TextOutputStream</keyword> 301 <keyword>TextOutputStreamable</keyword> 302 <keyword>UnicodeCodec</keyword> 303 <keyword>UnsignedInteger</keyword> 304 </context> 305 306 <context id="modifier" style-ref="modifier"> 307 <keyword>convenience</keyword> 308 <keyword>dynamic</keyword> 309 <keyword>fileprivate</keyword> 310 <keyword>final</keyword> 311 <keyword>indirect</keyword> 312 <keyword>infix</keyword> 313 <keyword>internal</keyword> 314 <keyword>inout</keyword> 315 <keyword>lazy</keyword> 316 <keyword>mutating</keyword> 317 <keyword>nonmutating</keyword> 318 <keyword>open</keyword> 319 <keyword>optional</keyword> 320 <keyword>override</keyword> 321 <keyword>postfix</keyword> 322 <keyword>prefix</keyword> 323 <keyword>private</keyword> 324 <keyword>public</keyword> 325 <keyword>required</keyword> 326 <keyword>safe</keyword> 327 <keyword>static</keyword> 328 <keyword>rethrows</keyword> 329 <keyword>throws</keyword> 330 <keyword>unowned</keyword> 331 <keyword>unsafe</keyword> 332 <keyword>weak</keyword> 333 </context> 334 335 <define-regex id="decimal" extended="true"> 336 [0-9][0-9_]* 337 </define-regex> 338 339 <define-regex id="hex" extended="true"> 340 [0-9a-fA-F][0-9a-fA-F_]* 341 </define-regex> 342 343 <context id="numeric" style-ref="number"> 344 <match extended="true"> 345 \b( 0b [01] [01_]* # boolean literal 346 | 0o [0-7][0-7_]* # octal literal 347 | 0x \%{hex} ( (\.\%{hex})? [pP][+-]?\%{hex} )? # hex literal 348 | \%{decimal} (\.\%{decimal})? ([eE][+-]?\%{decimal})? # decimal literal 349 ) 350 </match> 351 </context> 352 353 <context id="operator" style-ref="operator"> 354 <match extended="true"> 355 ( 356 [-/=+!*%<>&|^~?:\[\]] 357 | \b_\b # wildcard underscore 358 | \.\.\. # range constructor 359 | \.\.< # range constructor 360 ) 361 </match> 362 </context> 363 364 <context id="special" style-ref="special"> 365 <keyword>false</keyword> 366 <keyword>true</keyword> 367 <keyword>nil</keyword> 368 </context> 369 370 <context id="statement" style-ref="keyword"> 371 <keyword>break</keyword> 372 <keyword>catch</keyword> 373 <keyword>continue</keyword> 374 <keyword>default</keyword> 375 <keyword>defer</keyword> 376 <keyword>do</keyword> 377 <keyword>else</keyword> 378 <keyword>fallthrough</keyword> 379 <keyword>for</keyword> 380 <keyword>guard</keyword> 381 <keyword>if</keyword> 382 <keyword>in</keyword> 383 <keyword>repeat</keyword> 384 <keyword>return</keyword> 385 <keyword>switch</keyword> 386 <keyword>throw</keyword> 387 <keyword>try</keyword> 388 <keyword>where</keyword> 389 <keyword>while</keyword> 390 </context> 391 392 <context id="string" style-ref="string" end-at-line-end="true" 393 class="string" class-disabled="no-spell-check"> 394 <start>"</start> 395 <end>"</end> 396 <include> 397 <context id="escaped-character" style-ref="escaped-character"> 398 <match extended="true"> 399 \\( # leading backslash 400 [0\\tnr"'] # \n, \r and friends 401 | u\{[0-9a-fA-F]{1,8}\} # unicode scalar 402 ) 403 </match> 404 </context> 405 406 <context id="interpolated-expression" style-ref="interpolated"> 407 <start>\\\(</start> 408 <end>\)</end> 409 <include> 410 <context ref="swift"/> 411 </include> 412 </context> 413 </include> 414 </context> 415 416 <context id="swift" class="no-spell-check"> 417 <include> 418 <context ref="def:c-like-comment"/> 419 <context ref="def:c-like-close-comment-outside-comment"/> 420 <context ref="attribute"/> 421 <context ref="block-comment"/> 422 <context ref="builtin"/> 423 <context ref="cast"/> 424 <context ref="compiler-control"/> 425 <context ref="declaration"/> 426 <context ref="external"/> 427 <context ref="implicit-param"/> 428 <context ref="library-type"/> 429 <context ref="modifier"/> 430 <context ref="numeric"/> 431 <context ref="operator"/> 432 <context ref="special"/> 433 <context ref="statement"/> 434 <context ref="string"/> 435 </include> 436 </context> 437 438 </definitions> 439 440</language> 441