19180
|
1 " This source file is part of the Swift.org open source project
|
|
2 "
|
|
3 " Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
|
|
4 " Licensed under Apache License v2.0 with Runtime Library Exception
|
|
5 "
|
|
6 " See https://swift.org/LICENSE.txt for license information
|
|
7 " See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
8 "
|
|
9 " Vim syntax file
|
|
10 " Language: sil
|
|
11 "
|
|
12 " Vim maintainer: Emir SARI <bitigchi@me.com>
|
|
13
|
|
14 if exists("b:current_syntax")
|
|
15 finish
|
|
16 endif
|
|
17
|
|
18 let s:keepcpo = &cpo
|
|
19 set cpo&vim
|
|
20
|
|
21 syn keyword silStage skipwhite nextgroup=silStages
|
|
22 \ sil_stage
|
|
23 syn keyword silStages
|
|
24 \ canonical
|
|
25 \ raw
|
|
26
|
|
27 syn match silIdentifier skipwhite
|
|
28 \ /@\<[A-Za-z_0-9]\+\>/
|
|
29
|
|
30 syn match silConvention skipwhite
|
|
31 \ /$\?@convention/
|
|
32 syn region silConvention contained contains=silConventions
|
|
33 \ start="@convention(" end=")"
|
|
34 syn keyword silConventions
|
|
35 \ block
|
|
36 \ c
|
|
37 \ method
|
|
38 \ objc_method
|
23305
|
39 \ sil_differentiability_witness
|
19180
|
40 \ thick
|
|
41 \ thin
|
|
42 \ witness_method
|
|
43
|
|
44 syn match silFunctionType skipwhite
|
|
45 \ /@\(\<autoreleased\>\|\<callee_guaranteed\>\|\<callee_owned\>\|\<error\>\|\<guaranteed\>\|\<in\>\|\<in_constant\>\|\<in_guaranteed\>\|\<inout\>\|\<inout_aliasable\>\|\<noescape\>\|\<out\>\|\<owned\>\)/
|
|
46 syn match silMetatypeType skipwhite
|
|
47 \ /@\(\<thick\>\|\<thin\>\|\<objc\>\)/
|
|
48
|
|
49 " TODO: handle [tail_elems sil-type * sil-operand]
|
|
50 syn region silAttribute contains=silAttributes
|
|
51 \ start="\[" end="\]"
|
|
52 syn keyword silAttributes contained containedin=silAttribute
|
|
53 \ abort
|
|
54 \ deinit
|
|
55 \ delegatingself
|
|
56 \ derivedself
|
|
57 \ derivedselfonly
|
|
58 \ dynamic
|
|
59 \ exact
|
|
60 \ init
|
|
61 \ modify
|
|
62 \ mutating
|
|
63 \ objc
|
|
64 \ open
|
|
65 \ read
|
|
66 \ rootself
|
|
67 \ stack
|
|
68 \ static
|
|
69 \ strict
|
|
70 \ unknown
|
|
71 \ unsafe
|
|
72 \ var
|
|
73
|
|
74 syn keyword swiftImport import skipwhite nextgroup=swiftImportModule
|
|
75 syn match swiftImportModule /\<[A-Za-z_][A-Za-z_0-9]*\>/ contained nextgroup=swiftImportComponent
|
|
76 syn match swiftImportComponent /\.\<[A-Za-z_][A-Za-z_0-9]*\>/ contained nextgroup=swiftImportComponent
|
|
77
|
|
78 syn region swiftComment start="/\*" end="\*/" contains=swiftComment,swiftTodo
|
|
79 syn region swiftLineComment start="//" end="$" contains=swiftTodo
|
|
80
|
|
81 syn match swiftLineComment /^#!.*/
|
|
82 syn match swiftTypeName /\<[A-Z][a-zA-Z_0-9]*\>/
|
|
83 syn match swiftDecimal /\<[-]\?[0-9]\+\>/
|
|
84 syn match swiftDecimal /\<[-+]\?[0-9]\+\>/
|
|
85
|
|
86 syn match swiftTypeName /\$\*\<\?[A-Z][a-zA-Z0-9_]*\>/
|
|
87 syn match swiftVarName /%\<[A-z[a-z_0-9]\+\(#[0-9]\+\)\?\>/
|
|
88
|
|
89 syn keyword swiftKeyword break case continue default do else for if in static switch repeat return where while skipwhite
|
|
90
|
|
91 syn keyword swiftKeyword sil internal thunk skipwhite
|
|
92 syn keyword swiftKeyword public hidden private shared public_external hidden_external skipwhite
|
|
93 syn keyword swiftKeyword getter setter allocator initializer enumelt destroyer globalaccessor objc skipwhite
|
|
94 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
|
|
95 syn keyword swiftKeyword debug_value debug_value_addr skipwhite
|
|
96 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
|
|
97 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
|
|
98 syn keyword swiftKeyword function_ref integer_literal float_literal string_literal global_addr skipwhite
|
|
99 syn keyword swiftKeyword class_method super_method witness_method objc_method objc_super_method skipwhite
|
|
100 syn keyword swiftKeyword partial_apply builtin skipwhite
|
|
101 syn keyword swiftApplyKeyword apply try_apply skipwhite
|
|
102 syn keyword swiftKeyword metatype value_metatype existential_metatype skipwhite
|
|
103 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
|
|
104 syn keyword swiftKeyword init_enum_data_addr unchecked_enum_data unchecked_take_enum_data_addr inject_enum_addr skipwhite
|
|
105 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
|
|
106 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
|
|
107 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
|
|
108 syn keyword swiftKeyword objc_existential_metatype_to_object objc_metatype_to_object objc_protocol skipwhite
|
|
109 syn keyword swiftKeyword unconditional_checked_cast unconditional_checked_cast_addr unconditional_checked_cast_value skipwhite
|
|
110 syn keyword swiftKeyword cond_fail skipwhite
|
|
111 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
|
|
112 syn keyword swiftKeyword project_box project_existential_box project_value_buffer project_block_storage init_block_storage_header copy_block mark_dependence skipwhite
|
|
113
|
|
114 syn keyword swiftTypeDefinition class extension protocol struct typealias enum skipwhite nextgroup=swiftTypeName
|
|
115 syn region swiftTypeAttributes start="\[" end="\]" skipwhite contained nextgroup=swiftTypeName
|
|
116 syn match swiftTypeName /\<[A-Za-z_][A-Za-z_0-9\.]*\>/ contained nextgroup=swiftTypeParameters
|
|
117
|
|
118 syn region swiftTypeParameters start="<" end=">" skipwhite contained
|
|
119
|
|
120 syn keyword swiftFuncDefinition func skipwhite nextgroup=swiftFuncAttributes,swiftFuncName,swiftOperator
|
|
121 syn region swiftFuncAttributes start="\[" end="\]" skipwhite contained nextgroup=swiftFuncName,swiftOperator
|
|
122 syn match swiftFuncName /\<[A-Za-z_][A-Za-z_0-9]*\>/ skipwhite contained nextgroup=swiftTypeParameters
|
|
123 syn keyword swiftFuncKeyword subscript init destructor nextgroup=swiftTypeParameters
|
|
124
|
|
125 syn keyword swiftVarDefinition var skipwhite nextgroup=swiftVarName
|
|
126 syn keyword swiftVarDefinition let skipwhite nextgroup=swiftVarName
|
|
127 syn match swiftVarName /\<[A-Za-z_][A-Za-z_0-9]*\>/ skipwhite contained
|
|
128
|
|
129 syn keyword swiftDefinitionModifier static
|
|
130
|
|
131 syn match swiftImplicitVarName /\$\<[A-Za-z_0-9]\+\>/
|
|
132
|
|
133 hi def link swiftImport Include
|
|
134 hi def link swiftImportModule Title
|
|
135 hi def link swiftImportComponent Identifier
|
|
136 hi def link swiftApplyKeyword Statement
|
|
137 hi def link swiftKeyword Statement
|
|
138 hi def link swiftTypeDefinition Define
|
|
139 hi def link swiftTypeName Type
|
|
140 hi def link swiftTypeParameters Special
|
|
141 hi def link swiftTypeAttributes PreProc
|
|
142 hi def link swiftFuncDefinition Define
|
|
143 hi def link swiftDefinitionModifier Define
|
|
144 hi def link swiftFuncName Function
|
|
145 hi def link swiftFuncAttributes PreProc
|
|
146 hi def link swiftFuncKeyword Function
|
|
147 hi def link swiftVarDefinition Define
|
|
148 hi def link swiftVarName Identifier
|
|
149 hi def link swiftImplicitVarName Identifier
|
|
150 hi def link swiftIdentifierKeyword Identifier
|
|
151 hi def link swiftTypeDeclaration Delimiter
|
|
152 hi def link swiftBoolean Boolean
|
|
153 hi def link swiftString String
|
|
154 hi def link swiftInterpolation Special
|
|
155 hi def link swiftComment Comment
|
|
156 hi def link swiftLineComment Comment
|
|
157 hi def link swiftDecimal Number
|
|
158 hi def link swiftHex Number
|
|
159 hi def link swiftOct Number
|
|
160 hi def link swiftBin Number
|
|
161 hi def link swiftOperator Function
|
|
162 hi def link swiftChar Character
|
|
163 hi def link swiftLabel Label
|
|
164 hi def link swiftNew Operator
|
|
165
|
|
166 hi def link silStage Special
|
|
167 hi def link silStages Type
|
|
168 hi def link silConvention Special
|
|
169 hi def link silConventionParameter Special
|
|
170 hi def link silConventions Type
|
|
171 hi def link silIdentifier Identifier
|
|
172 hi def link silFunctionType Special
|
|
173 hi def link silMetatypeType Special
|
|
174 hi def link silAttribute PreProc
|
|
175
|
|
176 let b:current_syntax = "sil"
|
|
177
|
|
178 let &cpo = s:keepcpo
|
|
179 unlet s:keepcpo
|