OLD | NEW |
1 // issues: nested multiline comments, highlighting inside string interpolations | 1 // issues: nested multiline comments |
2 Prism.languages.swift = Prism.languages.extend('clike', { | 2 Prism.languages.swift = Prism.languages.extend('clike', { |
3 » 'keyword': /\b(as|associativity|break|case|catch|class|continue|convenie
nce|default|defer|deinit|didSet|do|dynamic|dynamicType|else|enum|extension|fallt
hrough|final|for|func|get|guard|if|import|in|infix|init|inout|internal|is|lazy|l
eft|let|mutating|new|none|nonmutating|operator|optional|override|postfix|precede
nce|prefix|private|Protocol|public|repeat|required|rethrows|return|right|safe|se
lf|Self|set|static|struct|subscript|super|switch|throws?|try|Type|typealias|unow
ned|unsafe|var|weak|where|while|willSet|__COLUMN__|__FILE__|__FUNCTION__|__LINE_
_)\b/, | 3 » 'string': { |
| 4 » » pattern: /("|')(\\(?:\((?:[^()]|\([^)]+\))+\)|\r\n|[\s\S])|(?!\1
)[^\\\r\n])*\1/, |
| 5 » » inside: { |
| 6 » » » 'interpolation': { |
| 7 » » » » pattern: /\\\((?:[^()]|\([^)]+\))+\)/, |
| 8 » » » » inside: { |
| 9 » » » » » delimiter: { |
| 10 » » » » » » pattern: /^\\\(|\)$/, |
| 11 » » » » » » alias: 'variable' |
| 12 » » » » » } |
| 13 » » » » » // See rest below |
| 14 » » » » } |
| 15 » » » } |
| 16 » » } |
| 17 » }, |
| 18 » 'keyword': /\b(as|associativity|break|case|catch|class|continue|convenie
nce|default|defer|deinit|didSet|do|dynamic(?:Type)?|else|enum|extension|fallthro
ugh|final|for|func|get|guard|if|import|in|infix|init|inout|internal|is|lazy|left
|let|mutating|new|none|nonmutating|operator|optional|override|postfix|precedence
|prefix|private|Protocol|public|repeat|required|rethrows|return|right|safe|self|
Self|set|static|struct|subscript|super|switch|throws?|try|Type|typealias|unowned
|unsafe|var|weak|where|while|willSet|__(?:COLUMN__|FILE__|FUNCTION__|LINE__))\b/
, |
4 'number': /\b([\d_]+(\.[\de_]+)?|0x[a-f0-9_]+(\.[a-f0-9p_]+)?|0b[01_]+|0
o[0-7_]+)\b/i, | 19 'number': /\b([\d_]+(\.[\de_]+)?|0x[a-f0-9_]+(\.[a-f0-9p_]+)?|0b[01_]+|0
o[0-7_]+)\b/i, |
5 'constant': /\b(nil|[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/, | 20 'constant': /\b(nil|[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/, |
6 » 'atrule': /@\b(IBOutlet|IBDesignable|IBAction|IBInspectable|class_protoc
ol|exported|noreturn|NSCopying|NSManaged|objc|UIApplicationMain|auto_closure)\b/
, | 21 » 'atrule': /@\b(IB(?:Outlet|Designable|Action|Inspectable)|class_protocol
|exported|noreturn|NS(?:Copying|Managed)|objc|UIApplicationMain|auto_closure)\b/
, |
7 » 'builtin': /\b([A-Z]\S+|abs|advance|alignof|alignofValue|assert|contains
|count|countElements|debugPrint|debugPrintln|distance|dropFirst|dropLast|dump|en
umerate|equal|filter|find|first|getVaList|indices|isEmpty|join|last|lazy|lexicog
raphicalCompare|map|max|maxElement|min|minElement|numericCast|overlaps|partition
|prefix|print|println|reduce|reflect|reverse|sizeof|sizeofValue|sort|sorted|spli
t|startsWith|stride|strideof|strideofValue|suffix|swap|toDebugString|toString|tr
anscode|underestimateCount|unsafeBitCast|withExtendedLifetime|withUnsafeMutableP
ointer|withUnsafeMutablePointers|withUnsafePointer|withUnsafePointers|withVaList
)\b/ | 22 » 'builtin': /\b([A-Z]\S+|abs|advance|alignof(?:Value)?|assert|contains|co
unt(?:Elements)?|debugPrint(?:ln)?|distance|drop(?:First|Last)|dump|enumerate|eq
ual|filter|find|first|getVaList|indices|isEmpty|join|last|lexicographicalCompare
|map|max(?:Element)?|min(?:Element)?|numericCast|overlaps|partition|print(?:ln)?
|reduce|reflect|reverse|sizeof(?:Value)?|sort(?:ed)?|split|startsWith|stride(?:o
f(?:Value)?)?|suffix|swap|toDebugString|toString|transcode|underestimateCount|un
safeBitCast|with(?:ExtendedLifetime|Unsafe(?:MutablePointers?|Pointers?)|VaList)
)\b/ |
8 }); | 23 }); |
| 24 Prism.languages.swift['string'].inside['interpolation'].inside.rest = Prism.util
.clone(Prism.languages.swift); |
OLD | NEW |