# -*- coding: utf-8 -*- #moduleRougemoduleLexersclassSwift<RegexLexertag'swift'filenames'*.swift'desc'Multi paradigm, compiled programming language developed by Apple for iOS and OS X development. (developer.apple.com/swift)'id_head=/_|(?!\p{Mc})\p{Alpha}|[^\u0000-\uFFFF]/id_rest=/[\p{Alnum}_]|[^\u0000-\uFFFF]/id=/#{id_head}#{id_rest}*/keywords=Set.new%w(
break case continue default do else fallthrough if in for return switch where while
as dynamicType is new super self Self Type __COLUMN__ __FILE__ __FUNCTION__ __LINE__
associativity didSet get infix inout left mutating none nonmutating operator override postfix precedence prefix right set unowned weak willSet
)declarations=Set.new%w(
class deinit enum extension final func import init internal lazy let optional private protocol public required static struct subscript typealias var dynamic
)attributes=Set.new%w(
autoclosure IBAction IBDesignable IBInspectable IBOutlet noreturn NSCopying NSManaged objc UIApplicationMain NSApplicationMain
)constants=Set.new%w(
true false nil
)state:whitespacedorule/\s+/m,Textrule%r(\/\/.*?\n),Comment::Singlerule%r((?<re>\/\*(?:(?>[^\/\*\*\/]+)|\g<re>)*\*\/))m,Comment::Multilineendstate:rootdomixin:whitespacerule/\$(([1-9]\d*)?\d)/,Name::Variablerule%r{[()\[\]{}:;,?]},Punctuationrule%r([-/=+*%<>!&|^.~]+),Operatorrule/@?"/,Str,:dqrule/'(\\.|.)'/,Str::Charrule/(\d+\*|\d*\.\d+)(e[+-]?[0-9]+)?/i,Num::Floatrule/\d+e[+-]?[0-9]+/i,Num::Floatrule/0_?[0-7]+(?:_[0-7]+)*/,Num::Octrule/0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*/,Num::Hexrule/0b[01]+(?:_[01]+)*/,Num::Binrule%r{[\d]+(?:_\d+)*},Num::Integerrule/@availability[(][^)]+[)]/,Keyword::Declarationrule/(@objc[(])([^)]+)([)])/dogroupsKeyword::Declaration,Name::Class,Keyword::Declarationendrule/@(#{id})/do|m|ifattributes.include?m[1]tokenKeywordelsetokenErrorendendrule/(private|internal)(\([ ]*)(\w+)([ ]*\))/do|m|ifm[3]=='set'tokenKeyword::DeclarationelsegroupsKeyword::Declaration,Keyword::Declaration,Error,Keyword::Declarationendendrule/(unowned\([ ]*)(\w+)([ ]*\))/do|m|ifm[2]=='safe'||m[2]=='unsafe'tokenKeyword::DeclarationelsegroupsKeyword::Declaration,Error,Keyword::Declarationendendrule/(let|var)\b(\s*)(#{id})/dogroupsKeyword,Text,Name::Variableendrule/(?!\b(if|while|for|private|internal|unowned|switch|case)\b)\b#{id}(?=(\?|!)?\s*[(])/do|m|ifm[0]=~/^[[:upper:]]/tokenKeyword::TypeelsetokenName::Functionendendrule/(#?(?!default)(?![[:upper:]])#{id})(\s*)(:)/dogroupsName::Variable,Text,Punctuationendruleiddo|m|ifkeywords.include?m[0]tokenKeywordelsifdeclarations.include?m[0]tokenKeyword::Declarationelsifconstants.include?m[0]tokenKeyword::Constantelsifm[0]=~/^[[:upper:]]/tokenKeyword::TypeelsetokenNameendendendstate:dqdorule/\\[\\0tnr'"]/,Str::Escaperule/\\[(]/,Str::Escape,:interprule/\\u\{\h{1,8}\}/,Str::Escaperule/[^\\"]+/,Strrule/"/,Str,:pop!endstate:interpdorule/[(]/,Punctuation,:interp_innerrule/[)]/,Str::Escape,:pop!mixin:rootendstate:interp_innerdorule/[(]/,Punctuation,:pushrule/[)]/,Punctuation,:pop!mixin:rootendendendend