diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Parsimmon.podspec b/Parsimmon.podspec old mode 100644 new mode 100755 diff --git a/Parsimmon/Analyzer.swift b/Parsimmon/Analyzer.swift old mode 100644 new mode 100755 index 9f5c8fb..589194e --- a/Parsimmon/Analyzer.swift +++ b/Parsimmon/Analyzer.swift @@ -29,7 +29,7 @@ protocol Analyzer { var scheme: String { get } } -internal func analyze(analyzer: Analyzer, text: String, options: NSLinguisticTaggerOptions?) -> [Pair] { +internal func analyze(_ analyzer: Analyzer, text: String, options: NSLinguisticTagger.Options?) -> [Pair] { var pairs: [Pair] = [] let range = NSRange(location: 0, length: text.characters.count) @@ -38,9 +38,9 @@ internal func analyze(analyzer: Analyzer, text: String, options: NSLinguisticTag tagger.string = text tagger.setOrthography(analyzer.seed.orthography, range: range) - tagger.enumerateTagsInRange(range, scheme: analyzer.scheme, options: options) { (tag: String?, tokenRange, range, stop) in + tagger.enumerateTags(in: range, scheme: analyzer.scheme, options: options) { (tag: String?, tokenRange, range, stop) in if let tag = tag { - let token = (text as NSString).substringWithRange(tokenRange) + let token = (text as NSString).substring(with: tokenRange) let pair = (token, tag) pairs.append(pair) } diff --git a/Parsimmon/DecisionTree.swift b/Parsimmon/DecisionTree.swift old mode 100644 new mode 100755 index 7332bf5..e00d892 --- a/Parsimmon/DecisionTree.swift +++ b/Parsimmon/DecisionTree.swift @@ -23,16 +23,16 @@ import Foundation public struct Datum { - public let featureValues: (Bit, Bit) - public let classification: Bit + public let featureValues: (Int, Int) + public let classification: Int - public init(featureValues: (Bit, Bit), classification: Bit) { + public init(featureValues: (Int, Int), classification: Int) { self.featureValues = featureValues self.classification = classification } - public func featureValueAtPosition(position: Bit) -> Bit { - if position.rawValue == 0 { + public func featureValueAtPosition(_ position: Int) -> Int { + if position == 0 { return self.featureValues.0 } else { return self.featureValues.1 @@ -40,22 +40,22 @@ public struct Datum { } } -public class Node { - public var leftChild: Node? - public var rightChild: Node? - public var value: T +open class Node { + open var leftChild: Node? + open var rightChild: Node? + open var value: T init(value: T) { self.value = value } } -public class DecisionTree { - public var root: Node? - public var maxDepth: Int = 5 - private let featureNames: (String, String) - private let classificationNames: (String, String) - private var data = [Datum]() +open class DecisionTree { + open var root: Node? + open var maxDepth: Int = 5 + fileprivate let featureNames: (String, String) + fileprivate let classificationNames: (String, String) + fileprivate var data = [Datum]() public init(featureNames: (String, String), classificationNames: (String, String)) { self.featureNames = featureNames @@ -67,40 +67,40 @@ public class DecisionTree { @param datum A data point */ - public func addSample(datum: Datum) { + open func addSample(_ datum: Datum) { self.data.append(datum) } /** Builds the decision tree based on the data it has. */ - public func build() { - let features = [ Bit.Zero, Bit.One ] + open func build() { + let features = [0, 1] self.root = self.decisionTree(self.data, remainingFeatures: features, maxDepth: self.maxDepth) } - public func classify(sample: [Int]) -> String? { + open func classify(_ sample: [Int]) -> String? { var node = self.root while (node != nil) { let unwrappedNode = node! if let _ = unwrappedNode.leftChild { - let pathToTake = sample[unwrappedNode.value.rawValue] + let pathToTake = sample[unwrappedNode.value] if pathToTake == 0 { node = unwrappedNode.leftChild } else { node = unwrappedNode.rightChild } - } else if unwrappedNode.value.rawValue == 0 { + } else if unwrappedNode.value == 0 { return self.classificationNames.0 - } else if unwrappedNode.value.rawValue == 1 { + } else if unwrappedNode.value == 1 { return self.classificationNames.1 } } return nil } - private func decisionTree(data: [Datum], remainingFeatures: [Bit], maxDepth: Int) -> Node { - let tree = Node(value: Bit.Zero) + fileprivate func decisionTree(_ data: [Datum], remainingFeatures: [Int], maxDepth: Int) -> Node { + let tree = Node(value: 0) if data.first == nil { return tree } @@ -123,17 +123,17 @@ public class DecisionTree { if firstDatumFeatureValues != datumFeatureValues { allSameFeatureValues = false } - count += datumClassification.rawValue + count += datumClassification } if allSameClassification == true { tree.value = firstDatum.classification } else if allSameFeatureValues == true || maxDepth == 0 { - tree.value = count > (data.count / 2) ? Bit.One : Bit.Zero + tree.value = count > (data.count / 2) ? 1 : 0 } else { // Find the best feature to split on and recurse. var maxInformationGain = -Float.infinity - var bestFeature = Bit.Zero + var bestFeature = 0 for feature in remainingFeatures { let informationGain = self.informationGain(feature, data: data) if informationGain >= maxInformationGain { @@ -143,8 +143,8 @@ public class DecisionTree { } let splitData = self.splitData(data, onFeature: bestFeature) var newRemainingFeatures = remainingFeatures - if let bestFeatureIndex = newRemainingFeatures.indexOf(bestFeature) { - newRemainingFeatures.removeAtIndex(bestFeatureIndex) + if let bestFeatureIndex = newRemainingFeatures.index(of: bestFeature) { + newRemainingFeatures.remove(at: bestFeatureIndex) tree.leftChild = self.decisionTree(splitData.0, remainingFeatures: newRemainingFeatures, maxDepth: maxDepth - 1) tree.rightChild = self.decisionTree(splitData.1, remainingFeatures: newRemainingFeatures, maxDepth: maxDepth - 1) tree.value = bestFeature @@ -154,11 +154,11 @@ public class DecisionTree { return tree } - private func splitData(data: [Datum], onFeature: Bit) -> ([Datum], [Datum]) { + fileprivate func splitData(_ data: [Datum], onFeature: Int) -> ([Datum], [Datum]) { var first = [Datum]() var second = [Datum]() for datum in data { - if datum.featureValueAtPosition(onFeature).rawValue == 0 { + if datum.featureValueAtPosition(onFeature) == 0 { first.append(datum) } else { second.append(datum) @@ -169,17 +169,17 @@ public class DecisionTree { // MARK: Entropy - private func informationGain(feature: Bit, data: [Datum]) -> Float { + fileprivate func informationGain(_ feature: Int, data: [Datum]) -> Float { return self.HY(data) - self.HY(data, X: feature) } - private func HY(data: [Datum]) -> Float { + fileprivate func HY(_ data: [Datum]) -> Float { let pY0: Float = self.pY(data, Y: 0) let pY1 = 1.0 - pY0 return -1.0 * (pY0 * log2(pY0) + pY1 * log2(pY1)) } - private func HY(data: [Datum], X: Bit) -> Float { + fileprivate func HY(_ data: [Datum], X: Int) -> Float { var result = Float(0.0) for x in [0, 1] { for y in [0, 1] { @@ -189,35 +189,35 @@ public class DecisionTree { return result } - private func pY(data: [Datum], Y: Int) -> Float { + fileprivate func pY(_ data: [Datum], Y: Int) -> Float { var count = 0 for datum in data { - if datum.classification.rawValue == Y { - count++ + if datum.classification == Y { + count += 1 } } return Float(count) / Float(data.count) } - private func pY(data: [Datum], Y: Int, X: Int, feature: Bit) -> Float { + fileprivate func pY(_ data: [Datum], Y: Int, X: Int, feature: Int) -> Float { var yCount = 0 var xCount = 0 for datum in data { - if datum.featureValueAtPosition(feature).rawValue == X { - xCount++ - if datum.classification.rawValue == Y { - yCount++ + if datum.featureValueAtPosition(feature) == X { + xCount += 1 + if datum.classification == Y { + yCount += 1 } } } return Float(yCount) / Float(xCount) } - private func pX(data: [Datum], X: Int, Y: Int, feature: Bit) -> Float { + fileprivate func pX(_ data: [Datum], X: Int, Y: Int, feature: Int) -> Float { var count = 0 for datum in data { - if datum.classification.rawValue == Y && datum.featureValueAtPosition(feature).rawValue == X { - count++ + if datum.classification == Y && datum.featureValueAtPosition(feature) == X { + count += 1 } } return Float(count) / Float(data.count) diff --git a/Parsimmon/Functions.swift b/Parsimmon/Functions.swift old mode 100644 new mode 100755 index 5214bdd..1ba9ff0 --- a/Parsimmon/Functions.swift +++ b/Parsimmon/Functions.swift @@ -22,7 +22,7 @@ import Foundation -func argmax(elements: [(T, U)]) -> T? { +func argmax(_ elements: [(T, U)]) -> T? { if let start = elements.first { return elements.reduce(start) { $0.1 > $1.1 ? $0 : $1 }.0 } diff --git a/Parsimmon/Lemmatizer.swift b/Parsimmon/Lemmatizer.swift old mode 100644 new mode 100755 index ae90524..3f2c525 --- a/Parsimmon/Lemmatizer.swift +++ b/Parsimmon/Lemmatizer.swift @@ -40,8 +40,8 @@ public struct Lemmatizer: Analyzer { @param options Linguistic tagger options @return The lemmatized tokens */ - public func lemmatizeWordsInText(text: String, options: NSLinguisticTaggerOptions? = nil) -> [String] { - return analyze(self, text: text, options: options).map { (token, lemma) in lemma.lowercaseString }.filter { + public func lemmatizeWordsInText(_ text: String, options: NSLinguisticTagger.Options? = nil) -> [String] { + return analyze(self, text: text, options: options).map { (token, lemma) in lemma.lowercased() }.filter { !$0.isEmpty } } diff --git a/Parsimmon/NaiveBayesClassifier.swift b/Parsimmon/NaiveBayesClassifier.swift old mode 100644 new mode 100755 index a05c956..de50592 --- a/Parsimmon/NaiveBayesClassifier.swift +++ b/Parsimmon/NaiveBayesClassifier.swift @@ -55,18 +55,22 @@ import Foundation private let smoothingParameter = 1.0 -public class NaiveBayesClassifier { +open class NaiveBayesClassifier { public typealias Word = String public typealias Category = String - private let tokenizer: Tokenizer + fileprivate let tokenizer: Tokenizer - private var categoryOccurrences: [Category: Int] = [:] - private var wordOccurrences: [Word: [Category: Int]] = [:] - private var trainingCount = 0 - private var wordCount = 0 + fileprivate var categoryOccurrences: [Category: Int] = [:] + fileprivate var wordOccurrences: [Word: [Category: Int]] = [:] + fileprivate var trainingCount = 0 + fileprivate var wordCount = 0 - public init(tokenizer: Tokenizer = Tokenizer()) { + public init() { + self.tokenizer = Tokenizer() + } + + public init(tokenizer: Tokenizer) { self.tokenizer = tokenizer } @@ -78,7 +82,7 @@ public class NaiveBayesClassifier { @param text The text @param category The category of the text */ - public func trainWithText(text: String, category: Category) { + open func trainWithText(_ text: String, category: Category) { let tokens = tokenizer.tokenize(text) trainWithTokens(tokens, category: category) } @@ -90,13 +94,13 @@ public class NaiveBayesClassifier { @param tokens The tokenized text @param category The category of the text */ - public func trainWithTokens(tokens: [Word], category: Category) { + open func trainWithTokens(_ tokens: [Word], category: Category) { let words = Set(tokens) for word in words { incrementWord(word, category: category) } incrementCategory(category) - trainingCount++ + trainingCount += 1 } // MARK: - Classifying @@ -107,7 +111,7 @@ public class NaiveBayesClassifier { @param text The text to classify @return The category classification */ - public func classify(text: String) -> Category? { + open func classify(_ text: String) -> Category? { let tokens = tokenizer.tokenize(text) return classifyTokens(tokens) } @@ -118,7 +122,7 @@ public class NaiveBayesClassifier { @param text The tokenized text to classify @return The category classification if one was found, or nil if one wasn’t */ - public func classifyTokens(tokens: [Word]) -> Category? { + open func classifyTokens(_ tokens: [Word]) -> Category? { // Compute argmax_cat [log(P(C=cat)) + sum_token(log(P(W=token|C=cat)))] return argmax(categoryOccurrences.map { (category, count) -> (Category, Double) in let pCategory = self.P(category) @@ -131,7 +135,7 @@ public class NaiveBayesClassifier { // MARK: - Probabilites - private func P(category: Category, _ word: Word) -> Double { + fileprivate func P(_ category: Category, _ word: Word) -> Double { if let occurrences = wordOccurrences[word] { let count = occurrences[category] ?? 0 return Double(count) / Double(trainingCount) @@ -139,15 +143,15 @@ public class NaiveBayesClassifier { return 0.0 } - private func P(category: Category) -> Double { + fileprivate func P(_ category: Category) -> Double { return Double(totalOccurrencesOfCategory(category)) / Double(trainingCount) } // MARK: - Counting - private func incrementWord(word: Word, category: Category) { + fileprivate func incrementWord(_ word: Word, category: Category) { if wordOccurrences[word] == nil { - wordCount++ + wordCount += 1 wordOccurrences[word] = [:] } @@ -155,18 +159,18 @@ public class NaiveBayesClassifier { wordOccurrences[word]?[category] = count + 1 } - private func incrementCategory(category: Category) { + fileprivate func incrementCategory(_ category: Category) { categoryOccurrences[category] = totalOccurrencesOfCategory(category) + 1 } - private func totalOccurrencesOfWord(word: Word) -> Int { + fileprivate func totalOccurrencesOfWord(_ word: Word) -> Int { if let occurrences = wordOccurrences[word] { - return Array(occurrences.values).reduce(0, combine: +) + return Array(occurrences.values).reduce(0, +) } return 0 } - private func totalOccurrencesOfCategory(category: Category) -> Int { + fileprivate func totalOccurrencesOfCategory(_ category: Category) -> Int { return categoryOccurrences[category] ?? 0 } } diff --git a/Parsimmon/Seed.swift b/Parsimmon/Seed.swift old mode 100644 new mode 100755 index 14d9e80..f4dd709 --- a/Parsimmon/Seed.swift +++ b/Parsimmon/Seed.swift @@ -25,12 +25,12 @@ import Foundation public struct Seed { typealias Language = String - private let language: Language = "en" - let linguisticTaggerOptions: NSLinguisticTaggerOptions = [.OmitWhitespace, .OmitPunctuation, .OmitOther] + fileprivate let language: Language = "en" + let linguisticTaggerOptions: NSLinguisticTagger.Options = [.omitWhitespace, .omitPunctuation, .omitOther] let orthography = NSOrthography(dominantScript: "Latn", languageMap: ["Latn" : ["en"]]) - func linguisticTaggerWithOptions(options: NSLinguisticTaggerOptions) -> NSLinguisticTagger { - let tagSchemes = NSLinguisticTagger.availableTagSchemesForLanguage(self.language) + func linguisticTaggerWithOptions(_ options: NSLinguisticTagger.Options) -> NSLinguisticTagger { + let tagSchemes = NSLinguisticTagger.availableTagSchemes(forLanguage: self.language) return NSLinguisticTagger(tagSchemes: tagSchemes, options: Int(options.rawValue)) } } diff --git a/Parsimmon/TaggedToken.swift b/Parsimmon/TaggedToken.swift old mode 100644 new mode 100755 diff --git a/Parsimmon/Tagger.swift b/Parsimmon/Tagger.swift old mode 100644 new mode 100755 index 0128498..f14946a --- a/Parsimmon/Tagger.swift +++ b/Parsimmon/Tagger.swift @@ -29,7 +29,11 @@ public struct Tagger: Analyzer { return NSLinguisticTagSchemeNameTypeOrLexicalClass } - public init(seed: Seed = Seed()) { + public init() { + self.seed = Seed() + } + + public init(seed: Seed) { self.seed = seed } @@ -40,7 +44,7 @@ public struct Tagger: Analyzer { @param options Linguistic tagger options @return The tagged tokens */ - public func tagWordsInText(text: String, options: NSLinguisticTaggerOptions? = nil) -> [TaggedToken] { + public func tagWordsInText(_ text: String, options: NSLinguisticTagger.Options? = nil) -> [TaggedToken] { return analyze(self, text: text, options: options).map { (token, tag) in TaggedToken(token: token, tag: tag) } diff --git a/Parsimmon/Tokenizer.swift b/Parsimmon/Tokenizer.swift old mode 100644 new mode 100755 index 0427eb0..cf9ff71 --- a/Parsimmon/Tokenizer.swift +++ b/Parsimmon/Tokenizer.swift @@ -40,7 +40,7 @@ public struct Tokenizer: Analyzer { @return The tokens */ - public func tokenize(text: String, options: NSLinguisticTaggerOptions? = nil) -> [String] { + public func tokenize(_ text: String, options: NSLinguisticTagger.Options? = nil) -> [String] { return analyze(self, text: text, options: options).map { (token, tag) in token } } } diff --git a/ParsimmonSample.xcodeproj/project.pbxproj b/ParsimmonSample.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 5d92eb0..1f666b6 --- a/ParsimmonSample.xcodeproj/project.pbxproj +++ b/ParsimmonSample.xcodeproj/project.pbxproj @@ -7,8 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 0D47ED5DE340DDD01EBB99E1 /* Pods_ParsimmonSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 890ECA8C11825D41385B73DB /* Pods_ParsimmonSample.framework */; }; - DFE6B5C127F2F4B301DE3D61 /* Pods_ParsimmonTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC471E95CCAF79111B1F28DC /* Pods_ParsimmonTests.framework */; }; + 139B018D1ED492D0F248E5E4 /* Pods_ParsimmonSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAAA3B6E41B553AD9A31E6C1 /* Pods_ParsimmonSample.framework */; }; + 38E16204A1F0817FD9E8AC50 /* Pods_ParsimmonTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4606F75F6D9CFBC89EAD27C3 /* Pods_ParsimmonTests.framework */; }; E0DA52F51AD3A94000F3A28F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0DA52F41AD3A94000F3A28F /* AppDelegate.swift */; }; E0DA52FE1AD3A94000F3A28F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E0DA52FD1AD3A94000F3A28F /* Images.xcassets */; }; E0DA53011AD3A94000F3A28F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0DA52FF1AD3A94000F3A28F /* LaunchScreen.xib */; }; @@ -33,15 +33,12 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1E7F66326D3D745776350560 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; - 399C69D5D6BD8A3C833FA1E1 /* Pods-ParsimmonSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParsimmonSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ParsimmonSample/Pods-ParsimmonSample.debug.xcconfig"; sourceTree = ""; }; - 4FB1F6F7E1D519F7D1D4A99B /* Pods-ParsimmonTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParsimmonTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ParsimmonTests/Pods-ParsimmonTests.debug.xcconfig"; sourceTree = ""; }; - 5A90578CE89463108050AD1D /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 0ABBE5C17977BB46F92C89EE /* Pods-ParsimmonSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParsimmonSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-ParsimmonSample/Pods-ParsimmonSample.release.xcconfig"; sourceTree = ""; }; + 4606F75F6D9CFBC89EAD27C3 /* Pods_ParsimmonTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ParsimmonTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7D04F735CEDE891B1C4DD856 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 890ECA8C11825D41385B73DB /* Pods_ParsimmonSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ParsimmonSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BC471E95CCAF79111B1F28DC /* Pods_ParsimmonTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ParsimmonTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D7B462917BABEC6E696B91D3 /* Pods-ParsimmonTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParsimmonTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ParsimmonTests/Pods-ParsimmonTests.release.xcconfig"; sourceTree = ""; }; - DFF81E04E7388BF31EF1CEBF /* Pods-ParsimmonSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParsimmonSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-ParsimmonSample/Pods-ParsimmonSample.release.xcconfig"; sourceTree = ""; }; + AAAA3B6E41B553AD9A31E6C1 /* Pods_ParsimmonSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ParsimmonSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D39A1C4172D218ED9583978A /* Pods-ParsimmonTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParsimmonTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ParsimmonTests/Pods-ParsimmonTests.debug.xcconfig"; sourceTree = ""; }; + DFDC3799824A3A2DDD1F95C2 /* Pods-ParsimmonTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParsimmonTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ParsimmonTests/Pods-ParsimmonTests.release.xcconfig"; sourceTree = ""; }; E0DA52EF1AD3A94000F3A28F /* ParsimmonSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ParsimmonSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; E0DA52F31AD3A94000F3A28F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E0DA52F41AD3A94000F3A28F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -58,6 +55,7 @@ E0DA532F1AD3AA6700F3A28F /* TokenizerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenizerTests.swift; sourceTree = ""; }; E0DA53331AD42F3700F3A28F /* Parsimmon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Parsimmon.framework; path = "Pods/../build/Debug-iphoneos/Pods/Parsimmon.framework"; sourceTree = ""; }; E0DFD7A31AD4DA29005A6CC0 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; + F12923524E8D46482A4CC428 /* Pods-ParsimmonSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParsimmonSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ParsimmonSample/Pods-ParsimmonSample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -65,7 +63,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 0D47ED5DE340DDD01EBB99E1 /* Pods_ParsimmonSample.framework in Frameworks */, + 139B018D1ED492D0F248E5E4 /* Pods_ParsimmonSample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -73,33 +71,20 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DFE6B5C127F2F4B301DE3D61 /* Pods_ParsimmonTests.framework in Frameworks */, + 38E16204A1F0817FD9E8AC50 /* Pods_ParsimmonTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 43545B9A653D24D91C071FE1 /* Pods */ = { - isa = PBXGroup; - children = ( - 399C69D5D6BD8A3C833FA1E1 /* Pods-ParsimmonSample.debug.xcconfig */, - DFF81E04E7388BF31EF1CEBF /* Pods-ParsimmonSample.release.xcconfig */, - 1E7F66326D3D745776350560 /* Pods.debug.xcconfig */, - 5A90578CE89463108050AD1D /* Pods.release.xcconfig */, - 4FB1F6F7E1D519F7D1D4A99B /* Pods-ParsimmonTests.debug.xcconfig */, - D7B462917BABEC6E696B91D3 /* Pods-ParsimmonTests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; CA8B2C5F09A33011FBC4A93D /* Frameworks */ = { isa = PBXGroup; children = ( E0DA53331AD42F3700F3A28F /* Parsimmon.framework */, - 890ECA8C11825D41385B73DB /* Pods_ParsimmonSample.framework */, 7D04F735CEDE891B1C4DD856 /* Pods.framework */, - BC471E95CCAF79111B1F28DC /* Pods_ParsimmonTests.framework */, + AAAA3B6E41B553AD9A31E6C1 /* Pods_ParsimmonSample.framework */, + 4606F75F6D9CFBC89EAD27C3 /* Pods_ParsimmonTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -110,8 +95,8 @@ E0DA52F11AD3A94000F3A28F /* ParsimmonSample */, E0DA531F1AD3AA4C00F3A28F /* ParsimmonTests */, E0DA52F01AD3A94000F3A28F /* Products */, - 43545B9A653D24D91C071FE1 /* Pods */, CA8B2C5F09A33011FBC4A93D /* Frameworks */, + F0A06A94FE529BE08EEDBC80 /* Pods */, ); sourceTree = ""; }; @@ -167,6 +152,17 @@ name = "Supporting Files"; sourceTree = ""; }; + F0A06A94FE529BE08EEDBC80 /* Pods */ = { + isa = PBXGroup; + children = ( + F12923524E8D46482A4CC428 /* Pods-ParsimmonSample.debug.xcconfig */, + 0ABBE5C17977BB46F92C89EE /* Pods-ParsimmonSample.release.xcconfig */, + D39A1C4172D218ED9583978A /* Pods-ParsimmonTests.debug.xcconfig */, + DFDC3799824A3A2DDD1F95C2 /* Pods-ParsimmonTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -174,12 +170,12 @@ isa = PBXNativeTarget; buildConfigurationList = E0DA53101AD3A94000F3A28F /* Build configuration list for PBXNativeTarget "ParsimmonSample" */; buildPhases = ( - BEF59A36D7DE258BC6271E50 /* Check Pods Manifest.lock */, + 55F191AC8FC389C81EE340C6 /* [CP] Check Pods Manifest.lock */, E0DA52EB1AD3A94000F3A28F /* Sources */, E0DA52EC1AD3A94000F3A28F /* Frameworks */, E0DA52ED1AD3A94000F3A28F /* Resources */, - 73D50AF8118CAED73AA5F114 /* Embed Pods Frameworks */, - B51E12897A1FDFE2BD0D9E84 /* Copy Pods Resources */, + 5EB3857DAF79A136E4276018 /* [CP] Embed Pods Frameworks */, + 4917CE20804C22932EE70857 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -194,12 +190,12 @@ isa = PBXNativeTarget; buildConfigurationList = E0DA53261AD3AA4C00F3A28F /* Build configuration list for PBXNativeTarget "ParsimmonTests" */; buildPhases = ( - 0B1B1D0952B94D41EB78580F /* Check Pods Manifest.lock */, + 4004A37DD170778334FA90CD /* [CP] Check Pods Manifest.lock */, E0DA531A1AD3AA4C00F3A28F /* Sources */, E0DA531B1AD3AA4C00F3A28F /* Frameworks */, E0DA531C1AD3AA4C00F3A28F /* Resources */, - 949162FA7A81D693C7543A13 /* Embed Pods Frameworks */, - C9901806001566AB2C9F5564 /* Copy Pods Resources */, + 098E3DDB32CC63D8BD2591B2 /* [CP] Embed Pods Frameworks */, + 5A9BE5ACD0EDFEDADE523847 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -218,14 +214,16 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0710; - LastUpgradeCheck = 0730; + LastUpgradeCheck = 0810; ORGANIZATIONNAME = "Ayaka Nonaka"; TargetAttributes = { E0DA52EE1AD3A94000F3A28F = { CreatedOnToolsVersion = 6.3; + LastSwiftMigration = 0810; }; E0DA531D1AD3AA4C00F3A28F = { CreatedOnToolsVersion = 6.3; + LastSwiftMigration = 0810; TestTargetID = E0DA52EE1AD3A94000F3A28F; }; }; @@ -270,94 +268,94 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0B1B1D0952B94D41EB78580F /* Check Pods Manifest.lock */ = { + 098E3DDB32CC63D8BD2591B2 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ParsimmonTests/Pods-ParsimmonTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 73D50AF8118CAED73AA5F114 /* Embed Pods Frameworks */ = { + 4004A37DD170778334FA90CD /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ParsimmonSample/Pods-ParsimmonSample-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - 949162FA7A81D693C7543A13 /* Embed Pods Frameworks */ = { + 4917CE20804C22932EE70857 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ParsimmonTests/Pods-ParsimmonTests-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ParsimmonSample/Pods-ParsimmonSample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - B51E12897A1FDFE2BD0D9E84 /* Copy Pods Resources */ = { + 55F191AC8FC389C81EE340C6 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ParsimmonSample/Pods-ParsimmonSample-resources.sh\"\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - BEF59A36D7DE258BC6271E50 /* Check Pods Manifest.lock */ = { + 5A9BE5ACD0EDFEDADE523847 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ParsimmonTests/Pods-ParsimmonTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - C9901806001566AB2C9F5564 /* Copy Pods Resources */ = { + 5EB3857DAF79A136E4276018 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ParsimmonTests/Pods-ParsimmonTests-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ParsimmonSample/Pods-ParsimmonSample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -420,8 +418,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -465,8 +465,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -485,38 +487,44 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; name = Release; }; E0DA53111AD3A94000F3A28F /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 399C69D5D6BD8A3C833FA1E1 /* Pods-ParsimmonSample.debug.xcconfig */; + baseConfigurationReference = F12923524E8D46482A4CC428 /* Pods-ParsimmonSample.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = ParsimmonSample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ayakanonaka.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Debug; }; E0DA53121AD3A94000F3A28F /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DFF81E04E7388BF31EF1CEBF /* Pods-ParsimmonSample.release.xcconfig */; + baseConfigurationReference = 0ABBE5C17977BB46F92C89EE /* Pods-ParsimmonSample.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = ParsimmonSample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ayakanonaka.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Release; }; E0DA53271AD3AA4C00F3A28F /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4FB1F6F7E1D519F7D1D4A99B /* Pods-ParsimmonTests.debug.xcconfig */; + baseConfigurationReference = D39A1C4172D218ED9583978A /* Pods-ParsimmonTests.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -530,14 +538,16 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ayakanonaka.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ParsimmonSample.app/ParsimmonSample"; }; name = Debug; }; E0DA53281AD3AA4C00F3A28F /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D7B462917BABEC6E696B91D3 /* Pods-ParsimmonTests.release.xcconfig */; + baseConfigurationReference = DFDC3799824A3A2DDD1F95C2 /* Pods-ParsimmonTests.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -548,6 +558,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ayakanonaka.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ParsimmonSample.app/ParsimmonSample"; }; name = Release; diff --git a/ParsimmonSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ParsimmonSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 diff --git a/ParsimmonSample.xcodeproj/xcshareddata/xcschemes/ParsimmonSample.xcscheme b/ParsimmonSample.xcodeproj/xcshareddata/xcschemes/ParsimmonSample.xcscheme old mode 100644 new mode 100755 index cedc5cb..05b29d0 --- a/ParsimmonSample.xcodeproj/xcshareddata/xcschemes/ParsimmonSample.xcscheme +++ b/ParsimmonSample.xcodeproj/xcshareddata/xcschemes/ParsimmonSample.xcscheme @@ -1,6 +1,6 @@