2016-05-05 15:33:39 +02:00
|
|
|
hook global BufCreate .*\.(swift) %{
|
2017-11-03 08:34:41 +01:00
|
|
|
set-option buffer filetype swift
|
2016-05-05 15:33:39 +02:00
|
|
|
}
|
|
|
|
|
2019-04-10 05:54:19 +02:00
|
|
|
hook global WinSetOption filetype=swift %{
|
2019-03-13 19:15:59 +01:00
|
|
|
require-module swift
|
|
|
|
}
|
|
|
|
|
2019-04-10 05:54:19 +02:00
|
|
|
hook -group swift-highlight global WinSetOption filetype=swift %{
|
|
|
|
add-highlighter window/swift ref swift
|
|
|
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/swift }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-13 19:15:59 +01:00
|
|
|
provide-module swift %{
|
|
|
|
|
2018-07-01 11:53:35 +02:00
|
|
|
add-highlighter shared/swift regions
|
|
|
|
add-highlighter shared/swift/code default-region group
|
2021-03-08 03:26:31 +01:00
|
|
|
add-highlighter shared/swift/string_multiline region %{(?<!')"""} %{(?<!\\)(\\\\)*"""} ref swift/string
|
2018-07-02 12:59:12 +02:00
|
|
|
add-highlighter shared/swift/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
|
|
|
|
add-highlighter shared/swift/comment region /\* \*/ group
|
|
|
|
add-highlighter shared/swift/line_comment region // $ ref swift/comment
|
2016-05-05 15:33:39 +02:00
|
|
|
|
2018-07-01 11:53:35 +02:00
|
|
|
add-highlighter shared/swift/comment/ fill comment
|
2016-05-05 15:33:39 +02:00
|
|
|
|
2018-07-01 11:53:35 +02:00
|
|
|
add-highlighter shared/swift/code/ regex %{\b(true|false|nil)\b|\b-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
|
2021-03-08 03:26:31 +01:00
|
|
|
add-highlighter shared/swift/code/ regex "\b(let|var|while|in|for|if|guard|else|do|switch|case|default|break|continue|return|try|catch|throw|new|delete|and|or|not|operator|explicit|func|import|return|init|deinit|get|set)\b" 0:keyword
|
2018-07-01 11:53:35 +02:00
|
|
|
add-highlighter shared/swift/code/ regex "\bas\b[!?]?" 0:keyword
|
|
|
|
add-highlighter shared/swift/code/ regex "(\$[0-9])\b" 0:keyword
|
2021-05-13 10:49:17 +02:00
|
|
|
add-highlighter shared/swift/code/ regex "\b(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|extension|public|protected|private|fileprivate|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\b" 0:attribute
|
2016-05-05 15:33:39 +02:00
|
|
|
|
2018-07-01 11:53:35 +02:00
|
|
|
add-highlighter shared/swift/code/ regex "\b(self|nil|id|super)\b" 0:value
|
|
|
|
add-highlighter shared/swift/code/ regex "\b(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\b" 0:type
|
|
|
|
add-highlighter shared/swift/code/ regex "\b(IBAction|IBOutlet)\b" 0:attribute
|
|
|
|
add-highlighter shared/swift/code/ regex "@\w+\b" 0:attribute
|
2016-05-05 15:33:39 +02:00
|
|
|
|
2019-03-13 19:15:59 +01:00
|
|
|
}
|