lib/rouge/lexers/swift.rb in rouge-1.8.0 vs lib/rouge/lexers/swift.rb in rouge-1.9.0
- old
+ new
@@ -24,11 +24,11 @@
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 objc_block
+ autoclosure IBAction IBDesignable IBInspectable IBOutlet noreturn NSCopying NSManaged objc UIApplicationMain NSApplicationMain objc_block noescape
)
constants = Set.new %w(
true false nil
)
@@ -73,10 +73,12 @@
rule /@availability[(][^)]+[)]/, Keyword::Declaration
rule /(@objc[(])([^)]+)([)])/ do
groups Keyword::Declaration, Name::Class, Keyword::Declaration
end
+
+ rule /@autoclosure\(escaping\)/, Keyword::Declaration
rule /@(#{id})/ do |m|
if attributes.include? m[1]
token Keyword
else
@@ -109,9 +111,11 @@
token Keyword::Type
else
token Name::Function
end
end
+
+ rule /as[?!]?/, Keyword
rule /(#?(?!default)(?![[:upper:]])#{id})(\s*)(:)/ do
groups Name::Variable, Text, Punctuation
end