1 ##############################################################################
2 # Swift syntax highlighting for Nano. v.1.1
3 ##############################################################################
5 syntax "Swift" "\.swift$"
11 color yellow "[.:;,+*|=!?\%]" "<" ">" "/" "-" "&"
12 color brightyellow "[!]"
15 color magenta "\<(class|import|let|var|struct|enum|func|if|else|switch|case|default|for|in|static|private|public|throws)\>"
16 color magenta "\<(lazy|get|set|self|willSet|didSet|override|super|convenience|weak|strong|mutating|return|guard)\>"
17 color magenta "\<(protocol|typealias|prefix|postfix|operator|extension|internal|external|unowned)\>"
20 color cyan "\<(print)\>"
21 color magenta "\<(init)\>"
24 color red "(@+[a-zA-Z]+)"
26 # Numbers / Decimal Literal
27 color blue "\<([0-9]+)\>"
28 # Unicode Literal "U+"
29 color blue "\<(U\++[0-9A-Z]+)\>"
31 color blue "\<(0b+[0-1]+)\>"
33 color blue "\<(0o+[0-7]+)\>"
34 # Hexadecimal Literal "0x"
35 color blue "\<(0x+[0-9A-Fa-f]+)\>"
38 color brightmagenta "\<((U)?Int(8|16|32|64))\>"
39 color brightmagenta "\<(true|false|nil)\>"
40 color brightmagenta "\<(UInt|Int|Double|String|Float|Bool|Dictionary|Array|Character|Range|Set|Bit|RawByte|Slice)\>"
41 color brightmagenta "\<(UnicodeScalar|UnsafePointer|UnsafeMutablePointer)\>"
42 color magenta "\<(AnyObject)\>"
44 # Standard Type Aliases and Protocols
45 color magenta "\<(AnyObject|AnyClass|GeneratorType|AnyGenerator|Element|Optional|Mirror)\>"
46 color magenta "\<(UnicodeScalarType|IntMax|UIntMax|Void|Any|Comparable|Equatable|Hashable|SequenceType)\>"
49 color cyan "\<(Foundation|Glibc|Darwin|XCTest)\>"
55 color white start="\\\(" end="\)"
58 color green "^\s*//.*"
59 color brightgreen "^\s*///.*"
60 color green start="/\*\*" end="\*/"
64 color ,green "[[:space:]]+$"