├── ftplugin ├── cgyb.vim ├── swiftgyb.vim └── swift.vim ├── ftdetect ├── sil.vim ├── swift.vim ├── swiftgyb.vim └── cgyb.vim ├── syntax ├── cgyb.vim ├── swiftgyb.vim ├── swift.vim └── sil.vim ├── README.md ├── swift-format.py └── LICENSE.txt /ftplugin/cgyb.vim: -------------------------------------------------------------------------------- 1 | runtime! ftplugin/swift.vim 2 | -------------------------------------------------------------------------------- /ftplugin/swiftgyb.vim: -------------------------------------------------------------------------------- 1 | runtime! ftplugin/swift.vim 2 | -------------------------------------------------------------------------------- /ftdetect/sil.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.sil set ft=sil 2 | -------------------------------------------------------------------------------- /ftdetect/swift.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.swift set ft=swift 2 | -------------------------------------------------------------------------------- /ftdetect/swiftgyb.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.swift.gyb set ft=swiftgyb 2 | 3 | -------------------------------------------------------------------------------- /ftplugin/swift.vim: -------------------------------------------------------------------------------- 1 | setlocal comments=s1:/*,mb:*,ex:*/,:///,:// 2 | setlocal expandtab 3 | setlocal ts=2 4 | setlocal sw=2 5 | setlocal smartindent 6 | -------------------------------------------------------------------------------- /ftdetect/cgyb.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.c.gyb set ft=cgyb 2 | au BufNewFile,BufRead *.h.gyb set ft=cgyb 3 | au BufNewFile,BufRead *.cpp.gyb set ft=cgyb 4 | au BufNewFile,BufRead *.hpp.gyb set ft=cgyb 5 | 6 | -------------------------------------------------------------------------------- /syntax/cgyb.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: gyb on C 3 | 4 | runtime! syntax/c.vim 5 | unlet b:current_syntax 6 | 7 | syn include @C syntax/c.vim 8 | syn region cCode matchgroup=gybCCode start=+^ *%+ end=+$+ contains=@C keepend 9 | syn region cCode matchgroup=gybCCode start=+%{+ end=+}%+ contains=@C keepend 10 | syn match gybCCode /\${[^}]*}/ 11 | hi def link gybCCode CursorLineNr 12 | 13 | let b:current_syntax = "cgyb" 14 | 15 | -------------------------------------------------------------------------------- /syntax/swiftgyb.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: gyb on swift 3 | 4 | runtime! syntax/swift.vim 5 | unlet b:current_syntax 6 | 7 | syn include @Python syntax/python.vim 8 | syn region pythonCode matchgroup=gybPythonCode start=+^ *%+ end=+$+ contains=@Python keepend 9 | syn region pythonCode matchgroup=gybPythonCode start=+%{+ end=+}%+ contains=@Python keepend 10 | syn match gybPythonCode /\${[^}]*}/ 11 | hi def link gybPythonCode CursorLineNr 12 | 13 | let b:current_syntax = "swiftgyb" 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Apple's Swift plugin for Vim 2 | 3 | This is a copy of [Apple's Swift tools for Vim](https://github.com/apple/swift/tree/master/utils/vim) from their Swift repo. I've put it in a separate repo so that you can easily install it with your prefered plugin installer. (I use [Vundle](https://github.com/VundleVim/Vundle.vim), so I just add `Plugin 'jph00/swift-apple'` to my `.vimrc` and run `:PluginInstall`.) 4 | 5 | It provides syntax highlighting for [gyb](https://github.com/jph00/gyb), SIL, and Swift files, and sets defaults for tab stops etc. 6 | 7 | I've also added syntax highlighting for gyb templates for C and header files. 8 | -------------------------------------------------------------------------------- /swift-format.py: -------------------------------------------------------------------------------- 1 | # This file is a minimal swift-format vim-integration. To install: 2 | # - Change 'binary' if swift-format is not on the path (see below). 3 | # - Add to your .vimrc: 4 | # 5 | # map :pyf /swift-format.py 6 | # imap :pyf /swift-format.py 7 | # 8 | # The first line enables swift-format for NORMAL and VISUAL mode, the second 9 | # line adds support for INSERT mode. Change "C-I" to another binding if you 10 | # need swift-format on a different key (C-I stands for Ctrl+i). 11 | # 12 | # With this integration you can press the bound key and swift-format will 13 | # format the current line in NORMAL and INSERT mode or the selected region in 14 | # VISUAL mode. The line or region is extended to the next bigger syntactic 15 | # entity. 16 | # 17 | # You can also pass in the variable "l:lines" to choose the range for 18 | # formatting. This variable can either contain ": or 19 | # "all" to format the full file. So, to format the full file, write a function 20 | # like: 21 | # 22 | # :function FormatFile() 23 | # : let l:lines="all" 24 | # : pyf /swift-format.py 25 | # :endfunction 26 | # 27 | # It operates on the current, potentially unsaved buffer and does not create or 28 | # save any files. To revert a formatting, just undo. 29 | 30 | from __future__ import print_function 31 | 32 | import difflib 33 | import platform 34 | import subprocess 35 | import sys 36 | 37 | import vim 38 | 39 | binary = 'swift-format' 40 | if vim.eval('exists("g:swift_format_path")') == "1": 41 | binary = vim.eval('g:swift_format_path') 42 | 43 | 44 | def get_buffer(encoding): 45 | if platform.python_version_tuple()[0] == "3": 46 | return vim.current.buffer 47 | return [line.decode(encoding) for line in vim.current.buffer] 48 | 49 | 50 | def main(argc, argv): 51 | encoding = vim.eval("&encoding") 52 | buf = get_buffer(encoding) 53 | 54 | if vim.eval('exists("l:lines")') == '1': 55 | lines = vim.eval('l:lines') 56 | else: 57 | lines = '%s:%s' % (vim.current.range.start + 1, 58 | vim.current.range.end + 1) 59 | 60 | cursor = int(vim.eval('line2byte(line(".")) + col(".")')) - 2 61 | if cursor < 0: 62 | print("Couldn't determine cursor position. Is your file empty?") 63 | return 64 | 65 | # avoid the cmd prompt on windows 66 | SI = None 67 | if sys.platform.startswith('win32'): 68 | SI = subprocess.STARTUPINFO() 69 | SI.dwFlags |= subprocess.STARTF_USESHOWWINDOW 70 | SI.wShowWindow = subprocess.SW_HIDE 71 | 72 | command = [binary] 73 | if lines != 'all': 74 | command.extend(['-line-range', lines]) 75 | 76 | p = subprocess.Popen(command, 77 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, 78 | stdin=subprocess.PIPE, startupinfo=SI) 79 | stdout, stderr = p.communicate(input='\n'.join(buf).encode(encoding)) 80 | 81 | if stderr: 82 | print(stderr) 83 | 84 | if not stdout: 85 | print('No output from swift-format (crashed?).') 86 | return 87 | 88 | lines = stdout.decode(encoding).split('\n') 89 | sequence = difflib.SequenceMatcher(None, buf, lines) 90 | for op in reversed(sequence.get_opcodes()): 91 | if op[0] is not 'equal': 92 | vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]] 93 | 94 | 95 | if __name__ == '__main__': 96 | main(len(sys.argv), sys.argv) 97 | -------------------------------------------------------------------------------- /syntax/swift.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: swift 3 | " Maintainer: Joe Groff 4 | " Last Change: 2018 Jan 21 5 | 6 | if exists("b:current_syntax") 7 | finish 8 | endif 9 | 10 | syn keyword swiftKeyword 11 | \ associatedtype 12 | \ break 13 | \ catch 14 | \ continue 15 | \ defer 16 | \ do 17 | \ else 18 | \ fallthrough 19 | \ for 20 | \ guard 21 | \ if 22 | \ in 23 | \ repeat 24 | \ return 25 | \ switch 26 | \ throw 27 | \ try 28 | \ where 29 | \ while 30 | syn match swiftMultiwordKeyword 31 | \ "indirect case" 32 | 33 | syn keyword swiftImport skipwhite skipempty nextgroup=swiftImportModule 34 | \ import 35 | 36 | syn keyword swiftDefinitionModifier 37 | \ convenience 38 | \ dynamic 39 | \ fileprivate 40 | \ final 41 | \ internal 42 | \ nonmutating 43 | \ open 44 | \ override 45 | \ private 46 | \ public 47 | \ required 48 | \ rethrows 49 | \ static 50 | \ throws 51 | \ weak 52 | 53 | syn keyword swiftInOutKeyword skipwhite skipempty nextgroup=swiftTypeName 54 | \ inout 55 | 56 | syn keyword swiftIdentifierKeyword 57 | \ Self 58 | \ metatype 59 | \ self 60 | \ super 61 | 62 | syn keyword swiftFuncKeywordGeneral skipwhite skipempty nextgroup=swiftTypeParameters 63 | \ init 64 | 65 | syn keyword swiftFuncKeyword 66 | \ deinit 67 | \ subscript 68 | 69 | syn keyword swiftScope 70 | \ autoreleasepool 71 | 72 | syn keyword swiftMutating skipwhite skipempty nextgroup=swiftFuncDefinition 73 | \ mutating 74 | syn keyword swiftFuncDefinition skipwhite skipempty nextgroup=swiftTypeName,swiftOperator 75 | \ func 76 | 77 | syn keyword swiftTypeDefinition skipwhite skipempty nextgroup=swiftTypeName 78 | \ class 79 | \ enum 80 | \ extension 81 | \ protocol 82 | \ struct 83 | \ typealias 84 | 85 | syn match swiftMultiwordTypeDefinition skipwhite skipempty nextgroup=swiftTypeName 86 | \ "indirect enum" 87 | 88 | syn keyword swiftVarDefinition skipwhite skipempty nextgroup=swiftVarName 89 | \ let 90 | \ var 91 | 92 | syn keyword swiftLabel 93 | \ get 94 | \ set 95 | \ didSet 96 | \ willSet 97 | 98 | syn keyword swiftBoolean 99 | \ false 100 | \ true 101 | 102 | syn keyword swiftNil 103 | \ nil 104 | 105 | syn match swiftImportModule contained nextgroup=swiftImportComponent 106 | \ /\<[A-Za-z_][A-Za-z_0-9]*\>/ 107 | syn match swiftImportComponent contained nextgroup=swiftImportComponent 108 | \ /\.\<[A-Za-z_][A-Za-z_0-9]*\>/ 109 | 110 | syn match swiftTypeName contained skipwhite skipempty nextgroup=swiftTypeParameters 111 | \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>/ 112 | syn match swiftVarName contained skipwhite skipempty nextgroup=swiftTypeDeclaration 113 | \ /\<[A-Za-z_][A-Za-z_0-9]*\>/ 114 | syn match swiftImplicitVarName 115 | \ /\$\<[A-Za-z_0-9]\+\>/ 116 | 117 | " TypeName[Optionality]? 118 | syn match swiftType contained skipwhite skipempty nextgroup=swiftTypeParameters 119 | \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/ 120 | " [Type:Type] (dictionary) or [Type] (array) 121 | syn region swiftType contained contains=swiftTypePair,swiftType 122 | \ matchgroup=Delimiter start=/\[/ end=/\]/ 123 | syn match swiftTypePair contained skipwhite skipempty nextgroup=swiftTypeParameters,swiftTypeDeclaration 124 | \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/ 125 | " (Type[, Type]) (tuple) 126 | " FIXME: we should be able to use skip="," and drop swiftParamDelim 127 | syn region swiftType contained contains=swiftType,swiftParamDelim 128 | \ matchgroup=Delimiter start="[^@]\?(" end=")" matchgroup=NONE skip="," 129 | syn match swiftParamDelim contained 130 | \ /,/ 131 | " (generics) 132 | syn region swiftTypeParameters contained contains=swiftVarName,swiftConstraint 133 | \ matchgroup=Delimiter start="<" end=">" matchgroup=NONE skip="," 134 | syn keyword swiftConstraint contained 135 | \ where 136 | 137 | syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType,swiftInOutKeyword 138 | \ /:/ 139 | syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType 140 | \ /->/ 141 | 142 | syn match swiftKeyword 143 | \ /\/ 144 | syn region swiftCaseLabelRegion 145 | \ matchgroup=swiftKeyword start=/\/ matchgroup=Delimiter end=/:/ oneline contains=TOP 146 | syn region swiftDefaultLabelRegion 147 | \ matchgroup=swiftKeyword start=/\/ matchgroup=Delimiter end=/:/ 148 | 149 | syn region swiftParenthesisRegion matchgroup=NONE start=/(/ end=/)/ contains=TOP 150 | 151 | syn region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolationRegion 152 | syn region swiftInterpolationRegion matchgroup=swiftInterpolation start=/\\(/ end=/)/ contained contains=TOP 153 | syn region swiftComment start="/\*" end="\*/" contains=swiftComment,swiftLineComment,swiftTodo 154 | syn region swiftLineComment start="//" end="$" contains=swiftComment,swiftTodo 155 | 156 | syn match swiftDecimal /[+\-]\?\<\([0-9][0-9_]*\)\([.][0-9_]*\)\?\([eE][+\-]\?[0-9][0-9_]*\)\?\>/ 157 | syn match swiftHex /[+\-]\?\<0x[0-9A-Fa-f][0-9A-Fa-f_]*\(\([.][0-9A-Fa-f_]*\)\?[pP][+\-]\?[0-9][0-9_]*\)\?\>/ 158 | syn match swiftOct /[+\-]\?\<0o[0-7][0-7_]*\>/ 159 | syn match swiftBin /[+\-]\?\<0b[01][01_]*\>/ 160 | 161 | syn match swiftOperator +\.\@!&|^~]\@!&|^~]*\|*/\@![/=\-+*%<>!&|^~]*\|->\@![/=\-+*%<>!&|^~]*\|[=+%<>!&|^~][/=\-+*%<>!&|^~]*\)+ skipwhite skipempty nextgroup=swiftTypeParameters 162 | syn match swiftOperator "\.\.[<.]" skipwhite skipempty nextgroup=swiftTypeParameters 163 | 164 | syn match swiftChar /'\([^'\\]\|\\\(["'tnr0\\]\|x[0-9a-fA-F]\{2}\|u[0-9a-fA-F]\{4}\|U[0-9a-fA-F]\{8}\)\)'/ 165 | 166 | syn match swiftTupleIndexNumber contains=swiftDecimal 167 | \ /\.[0-9]\+/ 168 | syn match swiftDecimal contained 169 | \ /[0-9]\+/ 170 | 171 | syn match swiftPreproc /#\(\\|\\|\\)/ 172 | syn match swiftPreproc /^\s*#\(\\|\\|\\|\\|\\|\\)/ 173 | syn region swiftPreprocFalse start="^\s*#\\s\+\" end="^\s*#\(\\|\\|\\)" 174 | 175 | syn match swiftAttribute /@\<\w\+\>/ skipwhite skipempty nextgroup=swiftType 176 | 177 | syn keyword swiftTodo MARK TODO FIXME contained 178 | 179 | syn match swiftCastOp "\" skipwhite skipempty nextgroup=swiftType 180 | syn match swiftCastOp "\[!?]\?" skipwhite skipempty nextgroup=swiftType 181 | 182 | syn match swiftNilOps "??" 183 | 184 | syn region swiftReservedIdentifier oneline 185 | \ start=/`/ end=/`/ 186 | 187 | hi def link swiftImport Include 188 | hi def link swiftImportModule Title 189 | hi def link swiftImportComponent Identifier 190 | hi def link swiftKeyword Statement 191 | hi def link swiftMultiwordKeyword Statement 192 | hi def link swiftTypeDefinition Define 193 | hi def link swiftMultiwordTypeDefinition Define 194 | hi def link swiftType Type 195 | hi def link swiftTypePair Type 196 | hi def link swiftTypeName Function 197 | hi def link swiftConstraint Special 198 | hi def link swiftFuncDefinition Define 199 | hi def link swiftDefinitionModifier Define 200 | hi def link swiftInOutKeyword Define 201 | hi def link swiftFuncKeyword Function 202 | hi def link swiftFuncKeywordGeneral Function 203 | hi def link swiftVarDefinition Define 204 | hi def link swiftVarName Identifier 205 | hi def link swiftImplicitVarName Identifier 206 | hi def link swiftIdentifierKeyword Identifier 207 | hi def link swiftTypeDeclaration Delimiter 208 | hi def link swiftTypeParameters Delimiter 209 | hi def link swiftBoolean Boolean 210 | hi def link swiftString String 211 | hi def link swiftInterpolation Special 212 | hi def link swiftComment Comment 213 | hi def link swiftLineComment Comment 214 | hi def link swiftDecimal Number 215 | hi def link swiftHex Number 216 | hi def link swiftOct Number 217 | hi def link swiftBin Number 218 | hi def link swiftOperator Function 219 | hi def link swiftChar Character 220 | hi def link swiftLabel Operator 221 | hi def link swiftMutating Statement 222 | hi def link swiftPreproc PreCondit 223 | hi def link swiftPreprocFalse Comment 224 | hi def link swiftAttribute Type 225 | hi def link swiftTodo Todo 226 | hi def link swiftNil Constant 227 | hi def link swiftCastOp Operator 228 | hi def link swiftNilOps Operator 229 | hi def link swiftScope PreProc 230 | 231 | let b:current_syntax = "swift" 232 | -------------------------------------------------------------------------------- /syntax/sil.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: sil 3 | 4 | if exists("b:current_syntax") 5 | finish 6 | endif 7 | 8 | syn keyword silStage skipwhite nextgroup=silStages 9 | \ sil_stage 10 | syn keyword silStages 11 | \ canonical 12 | \ raw 13 | 14 | syn match silIdentifier skipwhite 15 | \ /@\<[A-Za-z_0-9]\+\>/ 16 | 17 | syn match silConvention skipwhite 18 | \ /$\?@convention/ 19 | syn region silConvention contained contains=silConventions 20 | \ start="@convention(" end=")" 21 | syn keyword silConventions 22 | \ block 23 | \ c 24 | \ method 25 | \ objc_method 26 | \ thick 27 | \ thin 28 | \ witness_method 29 | 30 | syn match silFunctionType skipwhite 31 | \ /@\(\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\\)/ 32 | syn match silMetatypeType skipwhite 33 | \ /@\(\\|\\|\\)/ 34 | 35 | " TODO: handle [tail_elems sil-type * sil-operand] 36 | syn region silAttribute contains=silAttributes 37 | \ start="\[" end="\]" 38 | syn keyword silAttributes contained containedin=silAttribute 39 | \ abort 40 | \ deinit 41 | \ delegatingself 42 | \ derivedself 43 | \ derivedselfonly 44 | \ dynamic 45 | \ exact 46 | \ init 47 | \ modify 48 | \ objc 49 | \ read 50 | \ rootself 51 | \ stack 52 | \ static 53 | \ strict 54 | \ unknown 55 | \ unsafe 56 | \ var 57 | 58 | syn keyword swiftImport import skipwhite nextgroup=swiftImportModule 59 | syn match swiftImportModule /\<[A-Za-z_][A-Za-z_0-9]*\>/ contained nextgroup=swiftImportComponent 60 | syn match swiftImportComponent /\.\<[A-Za-z_][A-Za-z_0-9]*\>/ contained nextgroup=swiftImportComponent 61 | 62 | syn region swiftComment start="/\*" end="\*/" contains=swiftComment,swiftLineComment,swiftTodo 63 | syn region swiftLineComment start="//" end="$" contains=swiftComment,swiftTodo 64 | 65 | syn match swiftLineComment /^#!.*/ 66 | syn match swiftTypeName /\<[A-Z][a-zA-Z_0-9]*\>/ 67 | syn match swiftDecimal /\<[-]\?[0-9]\+\>/ 68 | syn match swiftDecimal /\<[-+]\?[0-9]\+\>/ 69 | 70 | syn match swiftTypeName /\$\*\<\?[A-Z][a-zA-Z0-9_]*\>/ 71 | syn match swiftVarName /%\<[A-z[a-z_0-9]\+\(#[0-9]\+\)\?\>/ 72 | 73 | syn keyword swiftKeyword break case continue default do else for if in static switch repeat return where while skipwhite 74 | 75 | syn keyword swiftKeyword sil internal thunk skipwhite 76 | syn keyword swiftKeyword public hidden private shared public_external hidden_external skipwhite 77 | syn keyword swiftKeyword getter setter allocator initializer enumelt destroyer globalaccessor objc skipwhite 78 | syn keyword swiftKeyword alloc_global alloc_stack alloc_ref alloc_ref_dynamic alloc_box alloc_existential_box alloc_value_buffer dealloc_stack dealloc_box dealloc_existential_box dealloc_ref dealloc_partial_ref dealloc_value_buffer skipwhite 79 | syn keyword swiftKeyword debug_value debug_value_addr skipwhite 80 | syn keyword swiftKeyword load load_unowned store assign mark_uninitialized mark_function_escape copy_addr destroy_addr index_addr index_raw_pointer bind_memory to skipwhite 81 | syn keyword swiftKeyword strong_retain strong_release strong_retain_unowned ref_to_unowned unowned_to_ref unowned_retain unowned_release load_weak store_unowned store_weak fix_lifetime autorelease_value set_deallocating is_unique is_escaping_closure skipwhite 82 | syn keyword swiftKeyword function_ref integer_literal float_literal string_literal global_addr skipwhite 83 | syn keyword swiftKeyword class_method super_method witness_method objc_method objc_super_method skipwhite 84 | syn keyword swiftKeyword partial_apply builtin skipwhite 85 | syn keyword swiftApplyKeyword apply try_apply skipwhite 86 | syn keyword swiftKeyword metatype value_metatype existential_metatype skipwhite 87 | syn keyword swiftKeyword retain_value release_value retain_value_addr release_value_addr tuple tuple_extract tuple_element_addr struct struct_extract struct_element_addr ref_element_addr skipwhite 88 | syn keyword swiftKeyword init_enum_data_addr unchecked_enum_data unchecked_take_enum_data_addr inject_enum_addr skipwhite 89 | syn keyword swiftKeyword init_existential_addr init_existential_value init_existential_metatype deinit_existential_addr deinit_existential_value open_existential_addr open_existential_box open_existential_box_value open_existential_metatype init_existential_ref open_existential_ref open_existential_value skipwhite 90 | syn keyword swiftKeyword upcast address_to_pointer pointer_to_address pointer_to_thin_function unchecked_addr_cast unchecked_ref_cast unchecked_ref_cast_addr ref_to_raw_pointer ref_to_bridge_object ref_to_unmanaged unmanaged_to_ref raw_pointer_to_ref skipwhite 91 | syn keyword swiftKeyword convert_function thick_to_objc_metatype thin_function_to_pointer objc_to_thick_metatype thin_to_thick_function unchecked_ref_bit_cast unchecked_trivial_bit_cast bridge_object_to_ref bridge_object_to_word unchecked_bitwise_cast skipwhite 92 | syn keyword swiftKeyword objc_existential_metatype_to_object objc_metatype_to_object objc_protocol skipwhite 93 | syn keyword swiftKeyword unconditional_checked_cast unconditional_checked_cast_addr unconditional_checked_cast_value skipwhite 94 | syn keyword swiftKeyword cond_fail skipwhite 95 | syn keyword swiftKeyword unreachable return throw br cond_br switch_value select_enum select_enum_addr select_value switch_enum switch_enum_addr dynamic_method_br checked_cast_br checked_cast_value_br checked_cast_addr_br skipwhite 96 | syn keyword swiftKeyword project_box project_existential_box project_value_buffer project_block_storage init_block_storage_header copy_block mark_dependence skipwhite 97 | 98 | syn keyword swiftTypeDefinition class extension protocol struct typealias enum skipwhite nextgroup=swiftTypeName 99 | syn region swiftTypeAttributes start="\[" end="\]" skipwhite contained nextgroup=swiftTypeName 100 | syn match swiftTypeName /\<[A-Za-z_][A-Za-z_0-9\.]*\>/ contained nextgroup=swiftTypeParameters 101 | 102 | syn region swiftTypeParameters start="<" end=">" skipwhite contained 103 | 104 | syn keyword swiftFuncDefinition func skipwhite nextgroup=swiftFuncAttributes,swiftFuncName,swiftOperator 105 | syn region swiftFuncAttributes start="\[" end="\]" skipwhite contained nextgroup=swiftFuncName,swiftOperator 106 | syn match swiftFuncName /\<[A-Za-z_][A-Za-z_0-9]*\>/ skipwhite contained nextgroup=swiftTypeParameters 107 | syn keyword swiftFuncKeyword subscript init destructor nextgroup=swiftTypeParameters 108 | 109 | syn keyword swiftVarDefinition var skipwhite nextgroup=swiftVarName 110 | syn keyword swiftVarDefinition let skipwhite nextgroup=swiftVarName 111 | syn match swiftVarName /\<[A-Za-z_][A-Za-z_0-9]*\>/ skipwhite contained 112 | 113 | syn keyword swiftDefinitionModifier static 114 | 115 | syn match swiftImplicitVarName /\$\<[A-Za-z_0-9]\+\>/ 116 | 117 | hi def link swiftImport Include 118 | hi def link swiftImportModule Title 119 | hi def link swiftImportComponent Identifier 120 | hi def link swiftApplyKeyword Statement 121 | hi def link swiftKeyword Statement 122 | hi def link swiftTypeDefinition Define 123 | hi def link swiftTypeName Type 124 | hi def link swiftTypeParameters Special 125 | hi def link swiftTypeAttributes PreProc 126 | hi def link swiftFuncDefinition Define 127 | hi def link swiftDefinitionModifier Define 128 | hi def link swiftFuncName Function 129 | hi def link swiftFuncAttributes PreProc 130 | hi def link swiftFuncKeyword Function 131 | hi def link swiftVarDefinition Define 132 | hi def link swiftVarName Identifier 133 | hi def link swiftImplicitVarName Identifier 134 | hi def link swiftIdentifierKeyword Identifier 135 | hi def link swiftTypeDeclaration Delimiter 136 | hi def link swiftBoolean Boolean 137 | hi def link swiftString String 138 | hi def link swiftInterpolation Special 139 | hi def link swiftComment Comment 140 | hi def link swiftLineComment Comment 141 | hi def link swiftDecimal Number 142 | hi def link swiftHex Number 143 | hi def link swiftOct Number 144 | hi def link swiftBin Number 145 | hi def link swiftOperator Function 146 | hi def link swiftChar Character 147 | hi def link swiftLabel Label 148 | hi def link swiftNew Operator 149 | 150 | hi def link silStage Special 151 | hi def link silStages Type 152 | hi def link silConvention Special 153 | hi def link silConventionParameter Special 154 | hi def link silConventions Type 155 | hi def link silIdentifier Identifier 156 | hi def link silFunctionType Special 157 | hi def link silMetatypeType Special 158 | hi def link silAttribute PreProc 159 | 160 | let b:current_syntax = "sil" 161 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | 204 | 205 | ## Runtime Library Exception to the Apache 2.0 License: ## 206 | 207 | 208 | As an exception, if you use this Software to compile your source code and 209 | portions of this Software are embedded into the binary product as a result, 210 | you may redistribute such product without providing attribution as would 211 | otherwise be required by Sections 4(a), 4(b) and 4(d) of the License. 212 | --------------------------------------------------------------------------------