Skip to content
Snippets Groups Projects
Commit f9db92aa authored by radex's avatar radex
Browse files

Swift: Just support all @attributes

parent dbdd4e7d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -25,10 +25,6 @@ module Rouge
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 noescape
)
constants = Set.new %w(
true false nil
)
Loading
Loading
@@ -70,21 +66,7 @@ module Rouge
rule /0b[01]+(?:_[01]+)*/, Num::Bin
rule %r{[\d]+(?:_\d+)*}, Num::Integer
 
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
token Error
end
end
rule /@#{id}(\([^)]+\))?/, Keyword::Declaration
 
rule /(private|internal)(\([ ]*)(\w+)([ ]*\))/ do |m|
if m[3] == 'set'
Loading
Loading
import Foundation
@testable import MyModule
 
func sayHello(person:String) -> String {
return "Hello, \(capitalize(word:person)). \"How're are you doin\'?\""
Loading
Loading
@@ -23,6 +24,12 @@ func halfOpenRangeLength(start:Int, end:Int) -> Int {
 
halfOpenRangeLength(3, 8)
 
if let var = option {
if more && complex, let optional = binding, example = here where option.foo == example.foo {
// things
}
}
func count(string:String) -> (vowels:Int, consonants:Int, others:Int) {
var vowels = 0, consonants = 0, emoji = 0, whitespace = 0, others = 0
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment