11d9215b9SBram Moolenaar" This source file is part of the Swift.org open source project 21d9215b9SBram Moolenaar" 31d9215b9SBram Moolenaar" Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors 41d9215b9SBram Moolenaar" Licensed under Apache License v2.0 with Runtime Library Exception 51d9215b9SBram Moolenaar" 61d9215b9SBram Moolenaar" See https://swift.org/LICENSE.txt for license information 71d9215b9SBram Moolenaar" See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 81d9215b9SBram Moolenaar" 91d9215b9SBram Moolenaar" Vim syntax file 101d9215b9SBram Moolenaar" Language: sil 111d9215b9SBram Moolenaar" 121d9215b9SBram Moolenaar" Vim maintainer: Emir SARI <[email protected]> 131d9215b9SBram Moolenaar 141d9215b9SBram Moolenaarif exists("b:current_syntax") 151d9215b9SBram Moolenaar finish 161d9215b9SBram Moolenaarendif 171d9215b9SBram Moolenaar 181d9215b9SBram Moolenaarlet s:keepcpo = &cpo 191d9215b9SBram Moolenaarset cpo&vim 201d9215b9SBram Moolenaar 211d9215b9SBram Moolenaarsyn keyword silStage skipwhite nextgroup=silStages 221d9215b9SBram Moolenaar \ sil_stage 231d9215b9SBram Moolenaarsyn keyword silStages 241d9215b9SBram Moolenaar \ canonical 251d9215b9SBram Moolenaar \ raw 261d9215b9SBram Moolenaar 271d9215b9SBram Moolenaarsyn match silIdentifier skipwhite 281d9215b9SBram Moolenaar \ /@\<[A-Za-z_0-9]\+\>/ 291d9215b9SBram Moolenaar 301d9215b9SBram Moolenaarsyn match silConvention skipwhite 311d9215b9SBram Moolenaar \ /$\?@convention/ 321d9215b9SBram Moolenaarsyn region silConvention contained contains=silConventions 331d9215b9SBram Moolenaar \ start="@convention(" end=")" 341d9215b9SBram Moolenaarsyn keyword silConventions 351d9215b9SBram Moolenaar \ block 361d9215b9SBram Moolenaar \ c 371d9215b9SBram Moolenaar \ method 381d9215b9SBram Moolenaar \ objc_method 39*4072ba57SBram Moolenaar \ sil_differentiability_witness 401d9215b9SBram Moolenaar \ thick 411d9215b9SBram Moolenaar \ thin 421d9215b9SBram Moolenaar \ witness_method 431d9215b9SBram Moolenaar 441d9215b9SBram Moolenaarsyn match silFunctionType skipwhite 451d9215b9SBram Moolenaar \ /@\(\<autoreleased\>\|\<callee_guaranteed\>\|\<callee_owned\>\|\<error\>\|\<guaranteed\>\|\<in\>\|\<in_constant\>\|\<in_guaranteed\>\|\<inout\>\|\<inout_aliasable\>\|\<noescape\>\|\<out\>\|\<owned\>\)/ 461d9215b9SBram Moolenaarsyn match silMetatypeType skipwhite 471d9215b9SBram Moolenaar \ /@\(\<thick\>\|\<thin\>\|\<objc\>\)/ 481d9215b9SBram Moolenaar 491d9215b9SBram Moolenaar" TODO: handle [tail_elems sil-type * sil-operand] 501d9215b9SBram Moolenaarsyn region silAttribute contains=silAttributes 511d9215b9SBram Moolenaar \ start="\[" end="\]" 521d9215b9SBram Moolenaarsyn keyword silAttributes contained containedin=silAttribute 531d9215b9SBram Moolenaar \ abort 541d9215b9SBram Moolenaar \ deinit 551d9215b9SBram Moolenaar \ delegatingself 561d9215b9SBram Moolenaar \ derivedself 571d9215b9SBram Moolenaar \ derivedselfonly 581d9215b9SBram Moolenaar \ dynamic 591d9215b9SBram Moolenaar \ exact 601d9215b9SBram Moolenaar \ init 611d9215b9SBram Moolenaar \ modify 621d9215b9SBram Moolenaar \ mutating 631d9215b9SBram Moolenaar \ objc 641d9215b9SBram Moolenaar \ open 651d9215b9SBram Moolenaar \ read 661d9215b9SBram Moolenaar \ rootself 671d9215b9SBram Moolenaar \ stack 681d9215b9SBram Moolenaar \ static 691d9215b9SBram Moolenaar \ strict 701d9215b9SBram Moolenaar \ unknown 711d9215b9SBram Moolenaar \ unsafe 721d9215b9SBram Moolenaar \ var 731d9215b9SBram Moolenaar 741d9215b9SBram Moolenaarsyn keyword swiftImport import skipwhite nextgroup=swiftImportModule 751d9215b9SBram Moolenaarsyn match swiftImportModule /\<[A-Za-z_][A-Za-z_0-9]*\>/ contained nextgroup=swiftImportComponent 761d9215b9SBram Moolenaarsyn match swiftImportComponent /\.\<[A-Za-z_][A-Za-z_0-9]*\>/ contained nextgroup=swiftImportComponent 771d9215b9SBram Moolenaar 781d9215b9SBram Moolenaarsyn region swiftComment start="/\*" end="\*/" contains=swiftComment,swiftTodo 791d9215b9SBram Moolenaarsyn region swiftLineComment start="//" end="$" contains=swiftTodo 801d9215b9SBram Moolenaar 811d9215b9SBram Moolenaarsyn match swiftLineComment /^#!.*/ 821d9215b9SBram Moolenaarsyn match swiftTypeName /\<[A-Z][a-zA-Z_0-9]*\>/ 831d9215b9SBram Moolenaarsyn match swiftDecimal /\<[-]\?[0-9]\+\>/ 841d9215b9SBram Moolenaarsyn match swiftDecimal /\<[-+]\?[0-9]\+\>/ 851d9215b9SBram Moolenaar 861d9215b9SBram Moolenaarsyn match swiftTypeName /\$\*\<\?[A-Z][a-zA-Z0-9_]*\>/ 871d9215b9SBram Moolenaarsyn match swiftVarName /%\<[A-z[a-z_0-9]\+\(#[0-9]\+\)\?\>/ 881d9215b9SBram Moolenaar 891d9215b9SBram Moolenaarsyn keyword swiftKeyword break case continue default do else for if in static switch repeat return where while skipwhite 901d9215b9SBram Moolenaar 911d9215b9SBram Moolenaarsyn keyword swiftKeyword sil internal thunk skipwhite 921d9215b9SBram Moolenaarsyn keyword swiftKeyword public hidden private shared public_external hidden_external skipwhite 931d9215b9SBram Moolenaarsyn keyword swiftKeyword getter setter allocator initializer enumelt destroyer globalaccessor objc skipwhite 941d9215b9SBram Moolenaarsyn 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 951d9215b9SBram Moolenaarsyn keyword swiftKeyword debug_value debug_value_addr skipwhite 961d9215b9SBram Moolenaarsyn 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 971d9215b9SBram Moolenaarsyn 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 981d9215b9SBram Moolenaarsyn keyword swiftKeyword function_ref integer_literal float_literal string_literal global_addr skipwhite 991d9215b9SBram Moolenaarsyn keyword swiftKeyword class_method super_method witness_method objc_method objc_super_method skipwhite 1001d9215b9SBram Moolenaarsyn keyword swiftKeyword partial_apply builtin skipwhite 1011d9215b9SBram Moolenaarsyn keyword swiftApplyKeyword apply try_apply skipwhite 1021d9215b9SBram Moolenaarsyn keyword swiftKeyword metatype value_metatype existential_metatype skipwhite 1031d9215b9SBram Moolenaarsyn 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 1041d9215b9SBram Moolenaarsyn keyword swiftKeyword init_enum_data_addr unchecked_enum_data unchecked_take_enum_data_addr inject_enum_addr skipwhite 1051d9215b9SBram Moolenaarsyn 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 1061d9215b9SBram Moolenaarsyn 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 1071d9215b9SBram Moolenaarsyn 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 1081d9215b9SBram Moolenaarsyn keyword swiftKeyword objc_existential_metatype_to_object objc_metatype_to_object objc_protocol skipwhite 1091d9215b9SBram Moolenaarsyn keyword swiftKeyword unconditional_checked_cast unconditional_checked_cast_addr unconditional_checked_cast_value skipwhite 1101d9215b9SBram Moolenaarsyn keyword swiftKeyword cond_fail skipwhite 1111d9215b9SBram Moolenaarsyn 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 1121d9215b9SBram Moolenaarsyn keyword swiftKeyword project_box project_existential_box project_value_buffer project_block_storage init_block_storage_header copy_block mark_dependence skipwhite 1131d9215b9SBram Moolenaar 1141d9215b9SBram Moolenaarsyn keyword swiftTypeDefinition class extension protocol struct typealias enum skipwhite nextgroup=swiftTypeName 1151d9215b9SBram Moolenaarsyn region swiftTypeAttributes start="\[" end="\]" skipwhite contained nextgroup=swiftTypeName 1161d9215b9SBram Moolenaarsyn match swiftTypeName /\<[A-Za-z_][A-Za-z_0-9\.]*\>/ contained nextgroup=swiftTypeParameters 1171d9215b9SBram Moolenaar 1181d9215b9SBram Moolenaarsyn region swiftTypeParameters start="<" end=">" skipwhite contained 1191d9215b9SBram Moolenaar 1201d9215b9SBram Moolenaarsyn keyword swiftFuncDefinition func skipwhite nextgroup=swiftFuncAttributes,swiftFuncName,swiftOperator 1211d9215b9SBram Moolenaarsyn region swiftFuncAttributes start="\[" end="\]" skipwhite contained nextgroup=swiftFuncName,swiftOperator 1221d9215b9SBram Moolenaarsyn match swiftFuncName /\<[A-Za-z_][A-Za-z_0-9]*\>/ skipwhite contained nextgroup=swiftTypeParameters 1231d9215b9SBram Moolenaarsyn keyword swiftFuncKeyword subscript init destructor nextgroup=swiftTypeParameters 1241d9215b9SBram Moolenaar 1251d9215b9SBram Moolenaarsyn keyword swiftVarDefinition var skipwhite nextgroup=swiftVarName 1261d9215b9SBram Moolenaarsyn keyword swiftVarDefinition let skipwhite nextgroup=swiftVarName 1271d9215b9SBram Moolenaarsyn match swiftVarName /\<[A-Za-z_][A-Za-z_0-9]*\>/ skipwhite contained 1281d9215b9SBram Moolenaar 1291d9215b9SBram Moolenaarsyn keyword swiftDefinitionModifier static 1301d9215b9SBram Moolenaar 1311d9215b9SBram Moolenaarsyn match swiftImplicitVarName /\$\<[A-Za-z_0-9]\+\>/ 1321d9215b9SBram Moolenaar 1331d9215b9SBram Moolenaarhi def link swiftImport Include 1341d9215b9SBram Moolenaarhi def link swiftImportModule Title 1351d9215b9SBram Moolenaarhi def link swiftImportComponent Identifier 1361d9215b9SBram Moolenaarhi def link swiftApplyKeyword Statement 1371d9215b9SBram Moolenaarhi def link swiftKeyword Statement 1381d9215b9SBram Moolenaarhi def link swiftTypeDefinition Define 1391d9215b9SBram Moolenaarhi def link swiftTypeName Type 1401d9215b9SBram Moolenaarhi def link swiftTypeParameters Special 1411d9215b9SBram Moolenaarhi def link swiftTypeAttributes PreProc 1421d9215b9SBram Moolenaarhi def link swiftFuncDefinition Define 1431d9215b9SBram Moolenaarhi def link swiftDefinitionModifier Define 1441d9215b9SBram Moolenaarhi def link swiftFuncName Function 1451d9215b9SBram Moolenaarhi def link swiftFuncAttributes PreProc 1461d9215b9SBram Moolenaarhi def link swiftFuncKeyword Function 1471d9215b9SBram Moolenaarhi def link swiftVarDefinition Define 1481d9215b9SBram Moolenaarhi def link swiftVarName Identifier 1491d9215b9SBram Moolenaarhi def link swiftImplicitVarName Identifier 1501d9215b9SBram Moolenaarhi def link swiftIdentifierKeyword Identifier 1511d9215b9SBram Moolenaarhi def link swiftTypeDeclaration Delimiter 1521d9215b9SBram Moolenaarhi def link swiftBoolean Boolean 1531d9215b9SBram Moolenaarhi def link swiftString String 1541d9215b9SBram Moolenaarhi def link swiftInterpolation Special 1551d9215b9SBram Moolenaarhi def link swiftComment Comment 1561d9215b9SBram Moolenaarhi def link swiftLineComment Comment 1571d9215b9SBram Moolenaarhi def link swiftDecimal Number 1581d9215b9SBram Moolenaarhi def link swiftHex Number 1591d9215b9SBram Moolenaarhi def link swiftOct Number 1601d9215b9SBram Moolenaarhi def link swiftBin Number 1611d9215b9SBram Moolenaarhi def link swiftOperator Function 1621d9215b9SBram Moolenaarhi def link swiftChar Character 1631d9215b9SBram Moolenaarhi def link swiftLabel Label 1641d9215b9SBram Moolenaarhi def link swiftNew Operator 1651d9215b9SBram Moolenaar 1661d9215b9SBram Moolenaarhi def link silStage Special 1671d9215b9SBram Moolenaarhi def link silStages Type 1681d9215b9SBram Moolenaarhi def link silConvention Special 1691d9215b9SBram Moolenaarhi def link silConventionParameter Special 1701d9215b9SBram Moolenaarhi def link silConventions Type 1711d9215b9SBram Moolenaarhi def link silIdentifier Identifier 1721d9215b9SBram Moolenaarhi def link silFunctionType Special 1731d9215b9SBram Moolenaarhi def link silMetatypeType Special 1741d9215b9SBram Moolenaarhi def link silAttribute PreProc 1751d9215b9SBram Moolenaar 1761d9215b9SBram Moolenaarlet b:current_syntax = "sil" 1771d9215b9SBram Moolenaar 1781d9215b9SBram Moolenaarlet &cpo = s:keepcpo 1791d9215b9SBram Moolenaarunlet s:keepcpo 180