2016-03-07 22:32:57 +01:00
|
|
|
##############################################################################
|
2016-05-05 11:21:18 +02:00
|
|
|
# Swift syntax highlighting for Nano. v.1.1
|
2016-03-07 22:32:57 +01:00
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
syntax "Swift" "\.swift$"
|
|
|
|
|
|
|
|
# Default
|
|
|
|
color white ".+"
|
|
|
|
|
|
|
|
# Operators
|
|
|
|
color yellow "[.:;,+*|=!?\%]" "<" ">" "/" "-" "&"
|
2016-04-29 21:21:21 +02:00
|
|
|
color brightyellow "[!]"
|
2016-03-07 22:32:57 +01:00
|
|
|
|
|
|
|
# Statements
|
2016-05-05 11:21:18 +02:00
|
|
|
color magenta "\<(class|import|let|var|struct|enum|func|if|else|switch|case|default|for|in|static|private|public|throws)\>"
|
|
|
|
color magenta "\<(lazy|get|set|self|willSet|didSet|override|super|convenience|weak|strong|mutating|return|guard)\>"
|
|
|
|
color magenta "\<(protocol|typealias|prefix|postfix|operator|extension|internal|external|unowned)\>"
|
2016-03-07 22:32:57 +01:00
|
|
|
|
|
|
|
# Keywords
|
2016-05-03 13:06:39 +02:00
|
|
|
color cyan "\<(print)\>"
|
|
|
|
color magenta "\<(init)\>"
|
2016-03-07 22:32:57 +01:00
|
|
|
|
2016-05-05 11:21:18 +02:00
|
|
|
# Attribute
|
|
|
|
color red "(@+[a-zA-Z]+)"
|
|
|
|
|
2016-05-05 12:07:14 +02:00
|
|
|
# Numbers / Decimal Literal
|
2016-05-03 13:06:39 +02:00
|
|
|
color blue "\<([0-9]+)\>"
|
2016-05-05 12:07:14 +02:00
|
|
|
# Unicode Literal "U+"
|
|
|
|
color blue "\<(U\++[0-9A-Z]+)\>"
|
|
|
|
# Binary Literal "0b"
|
|
|
|
color blue "\<(0b+[0-1]+)\>"
|
|
|
|
# Octal Literal "0o"
|
|
|
|
color blue "\<(0o+[0-7]+)\>"
|
|
|
|
# Hexadecimal Literal "0x"
|
|
|
|
color blue "\<(0x+[0-9A-Fa-f]+)\>"
|
2016-03-07 22:32:57 +01:00
|
|
|
|
|
|
|
# Standard Types
|
2016-05-03 13:06:39 +02:00
|
|
|
color brightmagenta "\<((U)?Int(8|16|32|64))\>"
|
|
|
|
color brightmagenta "\<(true|false|nil)\>"
|
2016-05-05 11:21:18 +02:00
|
|
|
color brightmagenta "\<(UInt|Int|Double|String|Float|Bool|Dictionary|Array|Character|Range|Set|Bit|RawByte|Slice)\>"
|
|
|
|
color brightmagenta "\<(UnicodeScalar|UnsafePointer|UnsafeMutablePointer)\>"
|
2016-05-03 13:06:39 +02:00
|
|
|
color magenta "\<(AnyObject)\>"
|
2016-04-29 21:21:21 +02:00
|
|
|
|
|
|
|
# Standard Type Aliases and Protocols
|
2016-05-05 11:21:18 +02:00
|
|
|
color magenta "\<(AnyObject|AnyClass|GeneratorType|AnyGenerator|Element|Optional|Mirror)\>"
|
|
|
|
color magenta "\<(UnicodeScalarType|IntMax|UIntMax|Void|Any|Comparable|Equatable|Hashable|SequenceType)\>"
|
2016-04-29 21:21:21 +02:00
|
|
|
|
|
|
|
# Standard Libraries
|
2016-05-03 13:06:39 +02:00
|
|
|
color cyan "\<(Foundation|Glibc|Darwin|XCTest)\>"
|
2016-03-07 22:32:57 +01:00
|
|
|
|
|
|
|
# Text
|
|
|
|
color red ""[^"]*""
|
|
|
|
|
2016-04-29 21:21:21 +02:00
|
|
|
# Variable in Text
|
|
|
|
color white start="\\\(" end="\)"
|
|
|
|
|
2016-03-07 22:32:57 +01:00
|
|
|
# Comments
|
|
|
|
color green "//.*"
|
|
|
|
color brightgreen "///.*"
|
|
|
|
color green start="/\*\*" end="\*/"
|
|
|
|
color green "[/**]"
|
|
|
|
|
|
|
|
# Trailing whitespace
|
|
|
|
color ,green "[[:space:]]+$"
|