Skip to content

Commit

Permalink
Make it compilable again
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed Dec 21, 2014
1 parent 921293f commit aba97e2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Chromatism/Chromatism/JLKeywordScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class JLKeywordScope: JLRegexScope {
init(keywords: [String], prefix: String, suffix: String, tokenType: JLTokenType) {
let pattern = prefix + Branch(character: "", array: keywords).description + suffix
let expression = NSRegularExpression(pattern: pattern, options: nil, error: nil)
super.init(regularExpression: expression, tokenTypes: [tokenType])
super.init(regularExpression: expression!, tokenTypes: [tokenType])
}

/// Create a JLKeywordScope with prefix and suffix of word boundaries (\\b)
Expand Down
2 changes: 1 addition & 1 deletion Chromatism/Chromatism/JLLanguage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class JLLanguage {
var strings = JLRegexScope(pattern: "(\"|@\")[^\"\\n]*(@\"|\")", tokenTypes: .String)
var angularImports = JLRegexScope(pattern: "<.*?>", tokenTypes: .String)
var numbers = JLRegexScope(pattern: "(?<=\\s)\\d+", tokenTypes: .Number)
var functions = JLRegexScope(pattern: "\\w+\\s*(?>\\(.*\\)", tokenTypes: .OtherMethodNames)
var functions = JLRegexScope(pattern: "\\w+\\s*(?>\\(.*\\))", tokenTypes: .OtherMethodNames)

var keywords = JLKeywordScope(keywords: "true false YES NO TRUE FALSE bool BOOL nil id void self NULL if else strong weak nonatomic atomic assign copy typedef enum auto break case const char continue do default double extern float for goto int long register return short signed sizeof static struct switch typedef union unsigned volatile while nonatomic atomic nonatomic readonly super", tokenType: .Keyword)

Expand Down
12 changes: 3 additions & 9 deletions Chromatism/Chromatism/JLRegexScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,9 @@ public class JLRegexScope: JLScope {
super.init()
}

convenience init(pattern: String, options: NSRegularExpressionOptions, tokenTypes: JLTokenType...) {
convenience init(pattern: String, options: NSRegularExpressionOptions = .AnchorsMatchLines, tokenTypes: JLTokenType...) {
let expression = NSRegularExpression(pattern: pattern, options: options, error: nil)
self.init(regularExpression: expression, tokenTypes: tokenTypes)
}

/// Creates a JLRegexScope with .AnchorsMatchLines options
convenience init(pattern: String, tokenTypes: JLTokenType...) {
let expression = NSRegularExpression(pattern: pattern, options: .AnchorsMatchLines, error: nil)
self.init(regularExpression: expression, tokenTypes: tokenTypes)
self.init(regularExpression: expression!, tokenTypes: tokenTypes)
}

override func perform(parentIndexSet: NSIndexSet) {
Expand All @@ -56,6 +50,6 @@ public class JLRegexScope: JLScope {
}

override public var description: String {
return "JLToken"
return "JLToken"
}
}
2 changes: 1 addition & 1 deletion Chromatism/Chromatism/JLTokenizingScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class JLTokenizingScope: JLScope {

init(pattern: String, delta: Int) {
self.delta = delta
self.expression = NSRegularExpression(pattern: pattern, options: nil, error: nil)
self.expression = NSRegularExpression(pattern: pattern, options: nil, error: nil)!
}
}

Expand Down
2 changes: 1 addition & 1 deletion SwiftChromatismDemo/SwiftChromatismDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let url = NSBundle.mainBundle().URLForResource("objc", withExtension: "txt");
let string = NSString(contentsOfURL: url!, encoding: NSUTF8StringEncoding, error: nil)

let viewController = JLTextViewController(text: string, language: .ObjectiveC, theme: .Default)
let viewController = JLTextViewController(text: string!, language: .ObjectiveC, theme: .Default)

viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Resign", style: .Plain, target: viewController.textView, action:"resignFirstResponder")

Expand Down

0 comments on commit aba97e2

Please sign in to comment.