From bb1ebacb7b504d99997b73266a5067cf4eb8cbd5 Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Mon, 31 Aug 2015 19:54:01 +0200 Subject: [PATCH 01/14] Updated the dependencies --- Cartfile | 8 +-- Cartfile.private | 4 +- Cartfile.resolved | 14 ++--- Carthage/Checkouts/Box | 2 +- Carthage/Checkouts/Either | 2 +- Carthage/Checkouts/Madness | 2 +- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Prelude | 2 +- Carthage/Checkouts/Quick | 2 +- Carthage/Checkouts/xcconfigs | 2 +- OGDL/Parser.swift | 111 ++++++++++++++++++----------------- OGDLTests/ParserSpec.swift | 30 +++++----- 12 files changed, 91 insertions(+), 90 deletions(-) diff --git a/Cartfile b/Cartfile index e424d0f..f3045b7 100644 --- a/Cartfile +++ b/Cartfile @@ -1,4 +1,4 @@ -github "robrix/Madness" "significant-indentation" -github "robrix/Either" ~> 1.1 -github "robrix/Box" ~> 1.0.1 -github "robrix/Prelude" ~> 1.4 +github "robrix/Madness" "master" +github "robrix/Either" ~> 1.2.2 +github "robrix/Box" ~> 1.2.2 +github "robrix/Prelude" ~> 1.5 diff --git a/Cartfile.private b/Cartfile.private index e88c05b..4c81532 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,3 +1,3 @@ github "jspahrsummers/xcconfigs" -github "Quick/Quick" ~> 0.2.2 -github "Quick/Nimble" ~> 0.2 +github "Quick/Quick" ~> 0.3.1 +github "Quick/Nimble" ~> 1.0.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 24c98e1..1105559 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,7 +1,7 @@ -github "robrix/Box" "1.0.1" -github "robrix/Either" "1.1" -github "robrix/Madness" "b5e2882e924b2377da83adcdb59592ba7fdab52a" -github "Quick/Nimble" "v0.2.0" -github "robrix/Prelude" "1.4" -github "Quick/Quick" "v0.2.2" -github "jspahrsummers/xcconfigs" "0.7.1" +github "robrix/Box" "1.2.2" +github "Quick/Nimble" "v1.0.0" +github "robrix/Prelude" "1.5.0" +github "Quick/Quick" "v0.3.1" +github "jspahrsummers/xcconfigs" "0.8.1" +github "robrix/Either" "1.2.2" +github "robrix/Madness" "fa440dd21e7341f687f748afd98ccb12574e1bd0" diff --git a/Carthage/Checkouts/Box b/Carthage/Checkouts/Box index 1bb4b48..bbe4e61 160000 --- a/Carthage/Checkouts/Box +++ b/Carthage/Checkouts/Box @@ -1 +1 @@ -Subproject commit 1bb4b482fddbad54466e73f91e98bca5c59abf54 +Subproject commit bbe4e612a03ffe0bbb0e2e476c2be4534b6777a5 diff --git a/Carthage/Checkouts/Either b/Carthage/Checkouts/Either index af46d1e..e26f160 160000 --- a/Carthage/Checkouts/Either +++ b/Carthage/Checkouts/Either @@ -1 +1 @@ -Subproject commit af46d1e2952753fda70c6f5984ee713fb4c6e9be +Subproject commit e26f160a978bea26ddc4efce92edeee9dd2085cc diff --git a/Carthage/Checkouts/Madness b/Carthage/Checkouts/Madness index b5e2882..fa440dd 160000 --- a/Carthage/Checkouts/Madness +++ b/Carthage/Checkouts/Madness @@ -1 +1 @@ -Subproject commit b5e2882e924b2377da83adcdb59592ba7fdab52a +Subproject commit fa440dd21e7341f687f748afd98ccb12574e1bd0 diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 6f787ee..61697d0 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 6f787eeb75b2fa71464981f28b3dc8d7bd532e69 +Subproject commit 61697d0b11bc5160fd620737365dcdd31cd5cf86 diff --git a/Carthage/Checkouts/Prelude b/Carthage/Checkouts/Prelude index dcd04cb..223829a 160000 --- a/Carthage/Checkouts/Prelude +++ b/Carthage/Checkouts/Prelude @@ -1 +1 @@ -Subproject commit dcd04cb7de654f8ee122890fa43f2df1f49306a9 +Subproject commit 223829acf3f8a44fb56388f56d55c0fb98fbd81e diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index b0e9828..8bf96f7 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit b0e98286db7e9d1f1e73cd4e69eac2aae2a1e3f8 +Subproject commit 8bf96f708924d728dab5f0cf7543b6f1b896a209 diff --git a/Carthage/Checkouts/xcconfigs b/Carthage/Checkouts/xcconfigs index b09b4b6..99624a6 160000 --- a/Carthage/Checkouts/xcconfigs +++ b/Carthage/Checkouts/xcconfigs @@ -1 +1 @@ -Subproject commit b09b4b63235b760a3a48a8dd19c0415aaaa8f269 +Subproject commit 99624a6af366c015b678a1135e4c558776a59be6 diff --git a/OGDL/Parser.swift b/OGDL/Parser.swift index e652365..2a4498f 100644 --- a/OGDL/Parser.swift +++ b/OGDL/Parser.swift @@ -12,30 +12,27 @@ import Madness import Prelude /// Returns a parser which parses one character from the given set. -internal prefix func % (characterSet: NSCharacterSet) -> Parser.Function { - return { string in - let scalars = string.unicodeScalars - - if let scalar = first(scalars) { - if characterSet.longCharacterIsMember(scalar.value) { - return (String(scalar), String(dropFirst(scalars))) - } - } - - return nil +internal prefix func % (characterSet: NSCharacterSet) -> Parser.Function { + return { collection, index in + if index != collection.endIndex { + if let scalar = first(String(collection[index]).unicodeScalars) where characterSet.longCharacterIsMember(scalar.value) { + return .right(String(scalar), index.successor()) + } + } + return .left(.leaf("Character is not present in NSCharacterSet", index)) } } /// Removes the characters in the given string from the character set. internal func - (characterSet: NSCharacterSet, characters: String) -> NSCharacterSet { - let mutableSet = characterSet.mutableCopy() as NSMutableCharacterSet + let mutableSet = characterSet.mutableCopy() as! NSMutableCharacterSet mutableSet.removeCharactersInString(characters) return mutableSet } /// Removes characters in the latter set from the former. internal func - (characterSet: NSCharacterSet, subtrahend: NSCharacterSet) -> NSCharacterSet { - let mutableSet = characterSet.mutableCopy() as NSMutableCharacterSet + let mutableSet = characterSet.mutableCopy() as! NSMutableCharacterSet mutableSet.formIntersectionWithCharacterSet(subtrahend.invertedSet) return mutableSet } @@ -44,8 +41,8 @@ internal func - (characterSet: NSCharacterSet, subtrahend: NSCharacterSet) -> NS postfix operator |? {} /// Matches zero or one occurrence of the given parser. -internal postfix func |? (parser: Parser.Function) -> Parser.Function { - return (parser * (0..<2)) --> first +internal postfix func |? (parser: Parser.Function) -> Parser.Function { + return first <^> (parser * (0..<2)) } private let char_control = NSCharacterSet.controlCharacterSet() @@ -57,43 +54,46 @@ private let char_break = NSCharacterSet.newlineCharacterSet() // TODO: Use this somewhere. private let char_end = char_control - NSCharacterSet.whitespaceAndNewlineCharacterSet() -private let wordStart: Parser.Function = %(char_word - "#'\"") -private let wordChars: Parser.Function = (%(char_word - "'\""))* --> { strings in join("", strings) } -private let word: Parser.Function = wordStart ++ wordChars --> (+) -private let br: Parser<()>.Function = ignore(%char_break) -private let eof: Parser<()>.Function = { $0 == "" ? ((), "") : nil } -private let comment: Parser<()>.Function = ignore(%"#" ++ (%char_text)+ ++ (br | eof)) +private let wordStart: Parser.Function = %(char_word - "#'\"") +private let wordChars: Parser.Function = { join("", $0) } <^> (%(char_word - "'\""))* +private let word: Parser.Function = (+) <^> wordStart ++ wordChars +private let br: Parser.Function = ignore(%char_break) +private let eof: Parser.Function = ignore("")//{ $0 == "" ? ((), "") : nil } + +private let br_eof = br | eof +private let comment: Parser.Function = ignore(%"#" ++ (%char_text)+ ++ br_eof) + // TODO: Escape sequences. -private let singleQuotedChars: Parser.Function = (%(char_text - "'"))* --> { strings in join("", strings) } -private let singleQuoted: Parser.Function = ignore(%"'") ++ singleQuotedChars ++ ignore(%"'") -private let doubleQuotedChars: Parser.Function = (%(char_text - "\""))* --> { strings in join("", strings) } -private let doubleQuoted: Parser.Function = ignore(%"\"") ++ doubleQuotedChars ++ ignore(%"\"") -private let quoted: Parser.Function = singleQuoted | doubleQuoted -private let requiredSpace: Parser<()>.Function = ignore((comment | %char_space)+) -private let optionalSpace: Parser<()>.Function = ignore((comment | %char_space)*) -private let separator: Parser<()>.Function = ignore(optionalSpace ++ %"," ++ optionalSpace) +private let singleQuotedChars: Parser.Function = { join("", $0) } <^> (%(char_text - "'"))* +private let singleQuoted: Parser.Function = ignore(%"'") ++ singleQuotedChars ++ ignore(%"'") +private let doubleQuotedChars: Parser.Function = { join("", $0) } <^> (%(char_text - "\""))* +private let doubleQuoted: Parser.Function = ignore(%"\"") ++ doubleQuotedChars ++ ignore(%"\"") +private let quoted: Parser.Function = singleQuoted | doubleQuoted +private let requiredSpace: Parser.Function = ignore((comment | %char_space)+) +private let optionalSpace: Parser.Function = ignore((comment | %char_space)*) +private let separator: Parser.Function = ignore(optionalSpace ++ %"," ++ optionalSpace) -private let value: Parser.Function = word | quoted +private let value: Parser.Function = word | quoted /// A function taking an Int and returning a parser which parses at least that many /// indentation characters. -func indentation(n: Int) -> Parser.Function { - return (%char_space * (n.. { $0.count } +func indentation(n: Int) -> Parser.Function { + return count <^> (%char_space * (n..(parser: () -> Parser.Function) -> Parser.Function { +private func lazy(parser: () -> Parser.Function) -> Parser.Function { return { parser()($0) } } /// Returns a parser which produces an array of parse trees produced by `parser` interleaved with ignored parses of `separator`. /// /// This is convenient for e.g. comma-separated lists. -private func interleave(separator: Parser.Function, parser: Parser.Function) -> Parser<[T]>.Function { - return (parser ++ (ignore(separator) ++ parser)*) --> { [$0] + $1 } +private func interleave(separator: Parser.Function, parser: Parser.Function) -> Parser.Function { + return { [$0] + $1 } <^> (parser ++ (ignore(separator) ++ parser)*) } private func foldr(sequence: S, initial: Result, combine: (S.Generator.Element, Result) -> Result) -> Result { @@ -105,12 +105,12 @@ private func foldr(inout generator: G, initial: Result return generator.next().map { combine($0, foldr(&generator, initial, combine)) } ?? initial } -private func | (left: Parser.Function, right: String -> U) -> Parser>.Function { - return left | { (right($0), $0) } +private func | (left: Parser.Function, right: () -> U) -> Parser>.Function { + return left | { .right(right(), $1 == $0.endIndex ? $1 : $1.successor()) } } -private func | (left: Parser.Function, right: String -> T) -> Parser.Function { - return left | { (right($0), $0) } +private func | (left: Parser.Function, right: () -> T) -> Parser.Function { + return left | { .right(right(), $1 == $0.endIndex ? $1 : $1.successor()) } } private func flatMap(x: [T], f: T -> [U]) -> [U] { @@ -119,45 +119,46 @@ private func flatMap(x: [T], f: T -> [U]) -> [U] { // MARK: OGDL -private let children: Parser<[Node]>.Function = lazy { group | (element --> { elem in [ elem ] }) } +private let children: Parser.Function = lazy { group | ({ elem in [ elem ] } <^> element) } -private let element = lazy { value ++ (optionalSpace ++ children)|? --> { value, children in Node(value: value, children: children ?? []) } } +private let element = lazy { { Node(value: $0, children: $1 ?? []) } <^> value ++ (optionalSpace ++ children)|? } // TODO: See Carthage/ogdl-swift#3. -private let block: Int -> Parser<()>.Function = { n in const(nil) } +private let block: Int -> Parser.Function = { _ in ignore(any) } /// Parses a single descendent element. /// /// This is an element which may be an in-line descendent, and which may further have in-line descendents of its own. -private let descendent = value --> { Node(value: $0) } +private let descendent = { Node(value: $0) } <^> value /// Parses a sequence of hierarchically descending elements, e.g.: /// /// x y z # => Node(x, [Node(y, Node(z))]) -public let descendents: Parser.Function = interleave(requiredSpace, descendent) --> { - foldr(dropLast($0), last($0)!) { $0.nodeByAppendingChildren([ $1 ]) } -} +public let descendents: Parser.Function = + { foldr(dropLast($0), last($0)!) { $0.nodeByAppendingChildren([ $1 ]) } } + <^> interleave(requiredSpace, descendent) /// Parses a chain of descendents, optionally ending in a group. /// /// x y (u, v) # => Node(x, [ Node(y, [ Node(u), Node(v) ]) ]) -private let descendentChain: Parser.Function = (descendents ++ ((optionalSpace ++ group) | const([]))) --> uncurry(Node.nodeByAppendingChildren) +private let descendentChain: Parser.Function = + uncurry(Node.nodeByAppendingChildren) <^> (descendents ++ ((optionalSpace ++ group) | const([]))) /// Parses a sequence of adjacent sibling elements, e.g.: /// /// x, y z, w (u, v) # => [ Node(x), Node(y, Node(z)), Node(w, [ Node(u), Node(v) ]) ] -public let adjacent: Parser<[Node]>.Function = lazy { interleave(separator, descendentChain) } +public let adjacent: Parser.Function = lazy { interleave(separator, descendentChain) } /// Parses a parenthesized sequence of sibling elements, e.g.: /// /// (x, y z, w) # => [ Node(x), Node(y, Node(z)), Node(w) ] private let group = lazy { ignore(%"(") ++ optionalSpace ++ adjacent ++ optionalSpace ++ ignore(%")") } -private let subgraph: Int -> Parser<[Node]>.Function = { n in - (descendents ++ lines(n + 1) --> { [ $0.nodeByAppendingChildren($1) ] }) | adjacent +private let subgraph: Int -> Parser.Function = { n in + ({ [ $0.nodeByAppendingChildren($1) ] } <^> descendents ++ lines(n + 1)) | adjacent } -private let line: Int -> Parser<[Node]>.Function = fix { line in +private let line: Int -> Parser.Function = fix { line in { n in // TODO: block parsing: ignore(%char_space+ ++ block(n))|?) ++ // See Carthage/ogdl-swift#3. @@ -167,9 +168,9 @@ private let line: Int -> Parser<[Node]>.Function = fix { line in } } -private let followingLine: Int -> Parser<[Node]>.Function = { n in (ignore(comment | br)+ ++ line(n)) } -private let lines: Int -> Parser<[Node]>.Function = { n in - (line(n)|? ++ followingLine(n)*) --> { ($0 ?? []) + flatMap($1, id) } +private let followingLine: Int -> Parser.Function = { n in (ignore(comment | br)+ ++ line(n)) } +private let lines: Int -> Parser.Function = { n in + { ($0 ?? []) + flatMap($1, id) } <^> (line(n)|? ++ followingLine(n)*) } /// Parses a textual OGDL graph into a list of nodes (and their descendants). @@ -177,4 +178,4 @@ private let lines: Int -> Parser<[Node]>.Function = { n in /// Example: /// /// let nodes = parse(graph, "foo (bar, buzz baz)") -public let graph: Parser<[Node]>.Function = ignore(comment | br)* ++ (lines(0) | adjacent) ++ ignore(comment | br)* +public let graph: Parser.Function = ignore(comment | br)* ++ (lines(0) | adjacent) ++ ignore(comment | br)* diff --git a/OGDLTests/ParserSpec.swift b/OGDLTests/ParserSpec.swift index a75a907..c4ca8c6 100644 --- a/OGDLTests/ParserSpec.swift +++ b/OGDLTests/ParserSpec.swift @@ -15,34 +15,34 @@ import Quick class ParserSpec: QuickSpec { override func spec() { it("should parse the empty string") { - expect(parse(graph, "")).to(equal([])) + expect(parse(graph, "").right).to(equal([])) } it("should parse a line break") { - expect(parse(graph, "\n")).to(equal([])) + expect(parse(graph, "\n").right).to(equal([])) } it("should parse a series of line breaks") { - expect(parse(graph, "\n\n\n")).to(equal([])) + expect(parse(graph, "\n\n\n").right).to(equal([])) } it("should parse a single node with descendents") { - expect(parse(descendents, "foobar")).to(equal(Node(value: "foobar"))) + expect(parse(descendents, "foobar").right).to(equal(Node(value: "foobar"))) } it("should parse a single node with adjacent") { - expect(parse(adjacent, "foobar")).to(equal([ Node(value: "foobar") ])) + expect(parse(adjacent, "foobar").right).to(equal([ Node(value: "foobar") ])) } it("should parse a single node") { let expectedGraph = [ Node(value: "foobar") ] - let parsedGraph = parse(graph, "foobar") + let parsedGraph = parse(graph, "foobar").right expect(parsedGraph).to(equal(expectedGraph)) } it("should parse a single node ending with a newline") { let expectedGraph = [ Node(value: "foobar") ] - let parsedGraph = parse(graph, "foobar\n") + let parsedGraph = parse(graph, "foobar\n").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -57,7 +57,7 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo bar fuzz buzz") + let parsedGraph = parse(graph, "foo bar fuzz buzz").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -70,7 +70,7 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo \"bar\" \"fuzz buzz\"") + let parsedGraph = parse(graph, "foo \"bar\" \"fuzz buzz\"").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -86,7 +86,7 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo bar, fuzz buzz") + let parsedGraph = parse(graph, "foo bar, fuzz buzz").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -99,7 +99,7 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo (bar, quux)") + let parsedGraph = parse(graph, "foo (bar, quux)").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -112,12 +112,12 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo ( bar.o 1.2, quux.o 2.1 )") + let parsedGraph = parse(graph, "foo ( bar.o 1.2, quux.o 2.1 )").right expect(parsedGraph).to(equal(expectedGraph)) } it("should parse comments") { - let parsedGraph = parse(graph, "#foo") + let parsedGraph = parse(graph, "#foo").right expect(parsedGraph).to(equal([])) } @@ -142,10 +142,10 @@ class ParserSpec: QuickSpec { for i in 1...5 { let URL = NSBundle(forClass: self.dynamicType).URLForResource("Example2-\(i)", withExtension: "ogdl", subdirectory: "Samples")! - let sample = NSString(contentsOfURL: URL, encoding: NSUTF8StringEncoding, error: nil) + let sample = NSString(contentsOfURL: URL, encoding: NSUTF8StringEncoding, error: nil) as? String expect(sample).notTo(beNil()) - let parsedGraph = parse(graph, sample ?? "") + let parsedGraph = parse(graph, sample ?? "").right if let parsedGraph = parsedGraph { println("graph \(i):\n\(parsedGraph)\n") } From 9a8360c8b0276e641cbd549d6935e0cbe46a495a Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Mon, 16 Nov 2015 18:03:03 +0100 Subject: [PATCH 02/14] Fix indentation --- OGDL/Parser.swift | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/OGDL/Parser.swift b/OGDL/Parser.swift index 2a4498f..17088cd 100644 --- a/OGDL/Parser.swift +++ b/OGDL/Parser.swift @@ -14,11 +14,11 @@ import Prelude /// Returns a parser which parses one character from the given set. internal prefix func % (characterSet: NSCharacterSet) -> Parser.Function { return { collection, index in - if index != collection.endIndex { - if let scalar = first(String(collection[index]).unicodeScalars) where characterSet.longCharacterIsMember(scalar.value) { - return .right(String(scalar), index.successor()) - } - } + if index != collection.endIndex { + if let scalar = first(String(collection[index]).unicodeScalars) where characterSet.longCharacterIsMember(scalar.value) { + return .right(String(scalar), index.successor()) + } + } return .left(.leaf("Character is not present in NSCharacterSet", index)) } } @@ -106,11 +106,11 @@ private func foldr(inout generator: G, initial: Result } private func | (left: Parser.Function, right: () -> U) -> Parser>.Function { - return left | { .right(right(), $1 == $0.endIndex ? $1 : $1.successor()) } + return left | { .right(right(), $1 == $0.endIndex ? $1 : $1.successor()) } } private func | (left: Parser.Function, right: () -> T) -> Parser.Function { - return left | { .right(right(), $1 == $0.endIndex ? $1 : $1.successor()) } + return left | { .right(right(), $1 == $0.endIndex ? $1 : $1.successor()) } } private func flatMap(x: [T], f: T -> [U]) -> [U] { @@ -135,14 +135,14 @@ private let descendent = { Node(value: $0) } <^> value /// /// x y z # => Node(x, [Node(y, Node(z))]) public let descendents: Parser.Function = - { foldr(dropLast($0), last($0)!) { $0.nodeByAppendingChildren([ $1 ]) } } - <^> interleave(requiredSpace, descendent) + { foldr(dropLast($0), last($0)!) { $0.nodeByAppendingChildren([ $1 ]) } } + <^> interleave(requiredSpace, descendent) /// Parses a chain of descendents, optionally ending in a group. /// /// x y (u, v) # => Node(x, [ Node(y, [ Node(u), Node(v) ]) ]) private let descendentChain: Parser.Function = - uncurry(Node.nodeByAppendingChildren) <^> (descendents ++ ((optionalSpace ++ group) | const([]))) + uncurry(Node.nodeByAppendingChildren) <^> (descendents ++ ((optionalSpace ++ group) | const([]))) /// Parses a sequence of adjacent sibling elements, e.g.: /// @@ -170,7 +170,7 @@ private let line: Int -> Parser.Function = fix { line in private let followingLine: Int -> Parser.Function = { n in (ignore(comment | br)+ ++ line(n)) } private let lines: Int -> Parser.Function = { n in - { ($0 ?? []) + flatMap($1, id) } <^> (line(n)|? ++ followingLine(n)*) + { ($0 ?? []) + flatMap($1, id) } <^> (line(n)|? ++ followingLine(n)*) } /// Parses a textual OGDL graph into a list of nodes (and their descendants). From 96670197e1f09b9946ee01d69ec83e5fb8c877ce Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Mon, 16 Nov 2015 18:54:18 +0100 Subject: [PATCH 03/14] Update dependencies --- Cartfile | 3 - Cartfile.private | 4 +- Cartfile.resolved | 11 ++- Carthage/Checkouts/Either | 2 +- Carthage/Checkouts/Madness | 2 +- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Prelude | 2 +- Carthage/Checkouts/Quick | 2 +- OGDL.xcodeproj/project.pbxproj | 1 + OGDL.xcworkspace/contents.xcworkspacedata | 3 - .../xcshareddata/OGDL.xcscmblueprint | 77 +++++++++++++++++++ 11 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 OGDL.xcworkspace/xcshareddata/OGDL.xcscmblueprint diff --git a/Cartfile b/Cartfile index f3045b7..29ba186 100644 --- a/Cartfile +++ b/Cartfile @@ -1,4 +1 @@ github "robrix/Madness" "master" -github "robrix/Either" ~> 1.2.2 -github "robrix/Box" ~> 1.2.2 -github "robrix/Prelude" ~> 1.5 diff --git a/Cartfile.private b/Cartfile.private index 4c81532..d0a0946 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,3 +1,3 @@ github "jspahrsummers/xcconfigs" -github "Quick/Quick" ~> 0.3.1 -github "Quick/Nimble" ~> 1.0.0 +github "Quick/Quick" ~> 0.8.0 +github "Quick/Nimble" ~> 3.0.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 1105559..8e32c21 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,7 +1,6 @@ -github "robrix/Box" "1.2.2" -github "Quick/Nimble" "v1.0.0" -github "robrix/Prelude" "1.5.0" -github "Quick/Quick" "v0.3.1" +github "Quick/Nimble" "v3.0.0" +github "robrix/Prelude" "bd23a25d8c7c90a7a4b2505be65ad511c9d1db81" +github "Quick/Quick" "v0.8.0" github "jspahrsummers/xcconfigs" "0.8.1" -github "robrix/Either" "1.2.2" -github "robrix/Madness" "fa440dd21e7341f687f748afd98ccb12574e1bd0" +github "robrix/Either" "1.3.1" +github "robrix/Madness" "d682f7854596dc01d1298446a8c49c8c70ffe5f8" diff --git a/Carthage/Checkouts/Either b/Carthage/Checkouts/Either index e26f160..7f7f177 160000 --- a/Carthage/Checkouts/Either +++ b/Carthage/Checkouts/Either @@ -1 +1 @@ -Subproject commit e26f160a978bea26ddc4efce92edeee9dd2085cc +Subproject commit 7f7f1776373cd112a42445f778e885cc3a70d040 diff --git a/Carthage/Checkouts/Madness b/Carthage/Checkouts/Madness index fa440dd..d682f78 160000 --- a/Carthage/Checkouts/Madness +++ b/Carthage/Checkouts/Madness @@ -1 +1 @@ -Subproject commit fa440dd21e7341f687f748afd98ccb12574e1bd0 +Subproject commit d682f7854596dc01d1298446a8c49c8c70ffe5f8 diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 61697d0..10e1906 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 61697d0b11bc5160fd620737365dcdd31cd5cf86 +Subproject commit 10e1906a76085b26f050ced40754640add4ebcf4 diff --git a/Carthage/Checkouts/Prelude b/Carthage/Checkouts/Prelude index 223829a..bd23a25 160000 --- a/Carthage/Checkouts/Prelude +++ b/Carthage/Checkouts/Prelude @@ -1 +1 @@ -Subproject commit 223829acf3f8a44fb56388f56d55c0fb98fbd81e +Subproject commit bd23a25d8c7c90a7a4b2505be65ad511c9d1db81 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index 8bf96f7..e0ce8a8 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit 8bf96f708924d728dab5f0cf7543b6f1b896a209 +Subproject commit e0ce8a820ff0acf8b7fedcab27186736b51412b8 diff --git a/OGDL.xcodeproj/project.pbxproj b/OGDL.xcodeproj/project.pbxproj index 5a277e7..c20abcb 100644 --- a/OGDL.xcodeproj/project.pbxproj +++ b/OGDL.xcodeproj/project.pbxproj @@ -364,6 +364,7 @@ D0BBBFB21A5DBF26007913DA /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftUpdateCheck = 0710; LastUpgradeCheck = 0610; ORGANIZATIONNAME = Carthage; TargetAttributes = { diff --git a/OGDL.xcworkspace/contents.xcworkspacedata b/OGDL.xcworkspace/contents.xcworkspacedata index d3052b4..b0a9692 100644 --- a/OGDL.xcworkspace/contents.xcworkspacedata +++ b/OGDL.xcworkspace/contents.xcworkspacedata @@ -7,9 +7,6 @@ - - diff --git a/OGDL.xcworkspace/xcshareddata/OGDL.xcscmblueprint b/OGDL.xcworkspace/xcshareddata/OGDL.xcscmblueprint new file mode 100644 index 0000000..9274e0a --- /dev/null +++ b/OGDL.xcworkspace/xcshareddata/OGDL.xcscmblueprint @@ -0,0 +1,77 @@ +{ + "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "D01149946CBFB7F4D884E8659DC65D5DEB658A19", + "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { + + }, + "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { + "D01149946CBFB7F4D884E8659DC65D5DEB658A19" : 0, + "D5FA66743146831DA2A20C0EAE4583EF424D9041" : 0, + "D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" : 0, + "9A760A1EBAC1979D46EF016B1BE84D98E53C16FF" : 0, + "95438028B10BBB846574013D29F154A00556A9D1" : 0, + "E084C86B03F81D63323C9E7510697EA528A758C7" : 0, + "57C931977B7D2307CC013C2BD93F90CF7C676790" : 0, + "7FCD68358D0D5A67F26F2A5E7B31EB3EF0CB2C00" : 0 + }, + "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "E83B8028-25D4-408D-B553-312799016D19", + "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { + "D01149946CBFB7F4D884E8659DC65D5DEB658A19" : "ogdl-swift\/", + "D5FA66743146831DA2A20C0EAE4583EF424D9041" : "ogdl-swift\/Carthage\/Checkouts\/Either\/", + "D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" : "ogdl-swift\/Carthage\/Checkouts\/Quick\/", + "9A760A1EBAC1979D46EF016B1BE84D98E53C16FF" : "ogdl-swift\/Carthage\/Checkouts\/Prelude\/", + "95438028B10BBB846574013D29F154A00556A9D1" : "ogdl-swift\/Carthage\/Checkouts\/Quick\/Externals\/Nimble\/", + "E084C86B03F81D63323C9E7510697EA528A758C7" : "ogdl-swift\/Carthage\/Checkouts\/xcconfigs\/", + "57C931977B7D2307CC013C2BD93F90CF7C676790" : "ogdl-swift\/Carthage\/Checkouts\/Box\/", + "7FCD68358D0D5A67F26F2A5E7B31EB3EF0CB2C00" : "ogdl-swift\/Carthage\/Checkouts\/Madness\/" + }, + "DVTSourceControlWorkspaceBlueprintNameKey" : "OGDL", + "DVTSourceControlWorkspaceBlueprintVersion" : 204, + "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "OGDL.xcworkspace", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Box.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "57C931977B7D2307CC013C2BD93F90CF7C676790" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Madness.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "7FCD68358D0D5A67F26F2A5E7B31EB3EF0CB2C00" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Nimble.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "95438028B10BBB846574013D29F154A00556A9D1" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Nimble.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "95438028B10BBB846574013D29F154A00556A9D1" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Prelude.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "9A760A1EBAC1979D46EF016B1BE84D98E53C16FF" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/coenert\/ogdl-swift.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D01149946CBFB7F4D884E8659DC65D5DEB658A19" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Quick.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Either.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D5FA66743146831DA2A20C0EAE4583EF424D9041" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/jspahrsummers\/xcconfigs.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "E084C86B03F81D63323C9E7510697EA528A758C7" + } + ] +} \ No newline at end of file From 72280fcb45cf8b7c5a78dc880ea5acb9dbe4706e Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Mon, 16 Nov 2015 18:55:03 +0100 Subject: [PATCH 04/14] Convert Graph.swift --- OGDL/Graph.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OGDL/Graph.swift b/OGDL/Graph.swift index 935b4df..16eb192 100644 --- a/OGDL/Graph.swift +++ b/OGDL/Graph.swift @@ -37,7 +37,7 @@ extension Node: Hashable { } } -extension Node: Printable { +extension Node: CustomStringConvertible { public var description: String { var string = "" if value.rangeOfCharacterFromSet(NSCharacterSet.alphanumericCharacterSet().invertedSet) == nil { @@ -47,8 +47,8 @@ extension Node: Printable { } if !children.isEmpty { - let childDescriptions = map(children) { $0.description } - string += " (" + join(", ", childDescriptions) + ")" + let childDescriptions = children.map { $0.description } + string += " (" + childDescriptions.joinWithSeparator(", ") + ")" } return string From 78ddf6b7b1e8678b67d4fc2dfcb113817686693a Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Mon, 16 Nov 2015 20:53:52 +0100 Subject: [PATCH 05/14] Remove Box from targets --- OGDL.xcodeproj/project.pbxproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/OGDL.xcodeproj/project.pbxproj b/OGDL.xcodeproj/project.pbxproj index c20abcb..4951e64 100644 --- a/OGDL.xcodeproj/project.pbxproj +++ b/OGDL.xcodeproj/project.pbxproj @@ -9,11 +9,9 @@ /* Begin PBXBuildFile section */ D00F9CDB1A5DC12500B4851E /* OGDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00F9CD01A5DC12500B4851E /* OGDL.framework */; }; D00F9CEA1A5DC1C900B4851E /* OGDL.h in Headers */ = {isa = PBXBuildFile; fileRef = D0BBBFC01A5DBF26007913DA /* OGDL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D00F9CEF1A5DC45D00B4851E /* Box.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00F9CEB1A5DC45D00B4851E /* Box.framework */; }; D00F9CF01A5DC45D00B4851E /* Either.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00F9CEC1A5DC45D00B4851E /* Either.framework */; }; D00F9CF11A5DC45D00B4851E /* Madness.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00F9CED1A5DC45D00B4851E /* Madness.framework */; }; D00F9CF21A5DC45D00B4851E /* Prelude.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00F9CEE1A5DC45D00B4851E /* Prelude.framework */; }; - D00F9CF31A5DC47500B4851E /* Box.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00F9CEB1A5DC45D00B4851E /* Box.framework */; }; D00F9CF41A5DC47500B4851E /* Either.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00F9CEC1A5DC45D00B4851E /* Either.framework */; }; D00F9CF51A5DC47500B4851E /* Madness.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00F9CED1A5DC45D00B4851E /* Madness.framework */; }; D00F9CF61A5DC47500B4851E /* Prelude.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00F9CEE1A5DC45D00B4851E /* Prelude.framework */; }; @@ -110,7 +108,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D00F9CEF1A5DC45D00B4851E /* Box.framework in Frameworks */, D00F9CF01A5DC45D00B4851E /* Either.framework in Frameworks */, D00F9CF11A5DC45D00B4851E /* Madness.framework in Frameworks */, D00F9CF21A5DC45D00B4851E /* Prelude.framework in Frameworks */, @@ -122,7 +119,6 @@ buildActionMask = 2147483647; files = ( D0BBBFC71A5DBF26007913DA /* OGDL.framework in Frameworks */, - D00F9CF31A5DC47500B4851E /* Box.framework in Frameworks */, D00F9CF41A5DC47500B4851E /* Either.framework in Frameworks */, D00F9CFD1A5DC51300B4851E /* Nimble.framework in Frameworks */, D00F9CF51A5DC47500B4851E /* Madness.framework in Frameworks */, From c9f0fc95d91f616fa197c67ebc54c2a10e249047 Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Mon, 16 Nov 2015 21:04:34 +0100 Subject: [PATCH 06/14] Converted Parser.swift --- OGDL/Parser.swift | 134 +++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 72 deletions(-) diff --git a/OGDL/Parser.swift b/OGDL/Parser.swift index 17088cd..ada15c3 100644 --- a/OGDL/Parser.swift +++ b/OGDL/Parser.swift @@ -12,14 +12,15 @@ import Madness import Prelude /// Returns a parser which parses one character from the given set. -internal prefix func % (characterSet: NSCharacterSet) -> Parser.Function { - return { collection, index in - if index != collection.endIndex { - if let scalar = first(String(collection[index]).unicodeScalars) where characterSet.longCharacterIsMember(scalar.value) { - return .right(String(scalar), index.successor()) +internal func memberOf(characterSet: NSCharacterSet) -> CharacterParser { + return { input, sourcePos in + if sourcePos.index != input.endIndex { + let character = input[sourcePos.index] + if let scalar = String(character).unicodeScalars.first where sourcePos.index != input.endIndex && characterSet.longCharacterIsMember(scalar.value) { + return .Right((character, updateIndex(sourcePos, sourcePos.index.successor()))) } } - return .left(.leaf("Character is not present in NSCharacterSet", index)) + return .Left(.leaf("Character is not present in NSCharacterSet", sourcePos)) } } @@ -37,14 +38,6 @@ internal func - (characterSet: NSCharacterSet, subtrahend: NSCharacterSet) -> NS return mutableSet } -/// Optional matching operator. -postfix operator |? {} - -/// Matches zero or one occurrence of the given parser. -internal postfix func |? (parser: Parser.Function) -> Parser.Function { - return first <^> (parser * (0..<2)) -} - private let char_control = NSCharacterSet.controlCharacterSet() private let char_text = char_control.invertedSet - NSCharacterSet.newlineCharacterSet() private let char_word = char_text - ",()" - NSCharacterSet.whitespaceCharacterSet() @@ -54,123 +47,120 @@ private let char_break = NSCharacterSet.newlineCharacterSet() // TODO: Use this somewhere. private let char_end = char_control - NSCharacterSet.whitespaceAndNewlineCharacterSet() -private let wordStart: Parser.Function = %(char_word - "#'\"") -private let wordChars: Parser.Function = { join("", $0) } <^> (%(char_word - "'\""))* -private let word: Parser.Function = (+) <^> wordStart ++ wordChars -private let br: Parser.Function = ignore(%char_break) -private let eof: Parser.Function = ignore("")//{ $0 == "" ? ((), "") : nil } +private let wordStart = memberOf(char_word - "#'\"") +private let wordChars = many(memberOf(char_word - "'\"")) +private let word = prepend <^> wordStart <*> wordChars +private let br = memberOf(char_break) +private let eof = %"" -private let br_eof = br | eof -private let comment: Parser.Function = ignore(%"#" ++ (%char_text)+ ++ br_eof) +private let br_eof = br <|> eof +private let comment = char("#") *> some(memberOf(char_text)) <* br_eof + +// Map helper functions +private func prepend(value: T) -> [T] -> [T] { + return { [value] + $0 } +} + +public func concat(left: [T], right: [T]) -> [T] { + return left + right +} + +public func pure(value: T) -> [T] { + return [value] +} // TODO: Escape sequences. -private let singleQuotedChars: Parser.Function = { join("", $0) } <^> (%(char_text - "'"))* -private let singleQuoted: Parser.Function = ignore(%"'") ++ singleQuotedChars ++ ignore(%"'") -private let doubleQuotedChars: Parser.Function = { join("", $0) } <^> (%(char_text - "\""))* -private let doubleQuoted: Parser.Function = ignore(%"\"") ++ doubleQuotedChars ++ ignore(%"\"") -private let quoted: Parser.Function = singleQuoted | doubleQuoted -private let requiredSpace: Parser.Function = ignore((comment | %char_space)+) -private let optionalSpace: Parser.Function = ignore((comment | %char_space)*) -private let separator: Parser.Function = ignore(optionalSpace ++ %"," ++ optionalSpace) +private let singleQuotedChars = many(memberOf(char_text - "'")) +private let singleQuoted = char("'") *> singleQuotedChars <* char("'") +private let doubleQuotedChars = many(memberOf(char_text - "\"")) +private let doubleQuoted = char("\"") *> doubleQuotedChars <* char("\"") +private let quoted = singleQuoted <|> doubleQuoted +private let requiredSpace = some(comment <|> memberOf(char_space)) +private let optionalSpace = many(comment <|> memberOf(char_space)) +private let separator = optionalSpace *> char(",") <* optionalSpace -private let value: Parser.Function = word | quoted +private let value = String.init <^> (word <|> quoted) /// A function taking an Int and returning a parser which parses at least that many /// indentation characters. -func indentation(n: Int) -> Parser.Function { - return count <^> (%char_space * (n.. Parser.Function { + return { $0.count } <^> (memberOf(char_space) * (n..(parser: () -> Parser.Function) -> Parser.Function { - return { parser()($0) } -} - /// Returns a parser which produces an array of parse trees produced by `parser` interleaved with ignored parses of `separator`. /// /// This is convenient for e.g. comma-separated lists. -private func interleave(separator: Parser.Function, parser: Parser.Function) -> Parser.Function { - return { [$0] + $1 } <^> (parser ++ (ignore(separator) ++ parser)*) +private func interleave(separator: Parser.Function, _ parser: Parser.Function) -> Parser.Function { + return prepend <^> parser <*> many(separator *> parser) } private func foldr(sequence: S, initial: Result, combine: (S.Generator.Element, Result) -> Result) -> Result { var generator = sequence.generate() - return foldr(&generator, initial, combine) + return foldr(&generator, initial: initial, combine: combine) } private func foldr(inout generator: G, initial: Result, combine: (G.Element, Result) -> Result) -> Result { - return generator.next().map { combine($0, foldr(&generator, initial, combine)) } ?? initial -} - -private func | (left: Parser.Function, right: () -> U) -> Parser>.Function { - return left | { .right(right(), $1 == $0.endIndex ? $1 : $1.successor()) } -} - -private func | (left: Parser.Function, right: () -> T) -> Parser.Function { - return left | { .right(right(), $1 == $0.endIndex ? $1 : $1.successor()) } -} - -private func flatMap(x: [T], f: T -> [U]) -> [U] { - return reduce(lazy(x).map(f), [], +) + return generator.next().map { combine($0, foldr(&generator, initial: initial, combine: combine)) } ?? initial } // MARK: OGDL -private let children: Parser.Function = lazy { group | ({ elem in [ elem ] } <^> element) } +private let children: Parser.Function = delay { group <|> (pure <^> element) } -private let element = lazy { { Node(value: $0, children: $1 ?? []) } <^> value ++ (optionalSpace ++ children)|? } +private let element = delay { + curry { Node(value: $0, children: $1 ?? []) } <^> value <*> (optionalSpace *> children)|? +} // TODO: See Carthage/ogdl-swift#3. -private let block: Int -> Parser.Function = { _ in ignore(any) } +//private let block: Int -> StringParser = { _ in %"" } /// Parses a single descendent element. /// /// This is an element which may be an in-line descendent, and which may further have in-line descendents of its own. -private let descendent = { Node(value: $0) } <^> value +private let descendent = value |> map { Node(value: $0) } /// Parses a sequence of hierarchically descending elements, e.g.: /// /// x y z # => Node(x, [Node(y, Node(z))]) -public let descendents: Parser.Function = - { foldr(dropLast($0), last($0)!) { $0.nodeByAppendingChildren([ $1 ]) } } - <^> interleave(requiredSpace, descendent) +public let descendents = interleave(requiredSpace, descendent) + |> map { foldr($0.dropLast(), initial: $0.last!) { $0.nodeByAppendingChildren([ $1 ]) } } /// Parses a chain of descendents, optionally ending in a group. /// /// x y (u, v) # => Node(x, [ Node(y, [ Node(u), Node(v) ]) ]) -private let descendentChain: Parser.Function = - uncurry(Node.nodeByAppendingChildren) <^> (descendents ++ ((optionalSpace ++ group) | const([]))) +private let descendentChain: Parser.Function = + curry { $0.nodeByAppendingChildren($1 ?? []) } <^> descendents <*> (optionalSpace *> group)|? /// Parses a sequence of adjacent sibling elements, e.g.: /// /// x, y z, w (u, v) # => [ Node(x), Node(y, Node(z)), Node(w, [ Node(u), Node(v) ]) ] -public let adjacent: Parser.Function = lazy { interleave(separator, descendentChain) } +public let adjacent: Parser.Function = delay { interleave(separator, descendentChain) } /// Parses a parenthesized sequence of sibling elements, e.g.: /// /// (x, y z, w) # => [ Node(x), Node(y, Node(z)), Node(w) ] -private let group = lazy { ignore(%"(") ++ optionalSpace ++ adjacent ++ optionalSpace ++ ignore(%")") } +private let group = delay { char("(") *> optionalSpace *> adjacent <* optionalSpace <* char(")") } -private let subgraph: Int -> Parser.Function = { n in - ({ [ $0.nodeByAppendingChildren($1) ] } <^> descendents ++ lines(n + 1)) | adjacent +private let subgraph: Int -> Parser.Function = { n in + (curry { [ $0.0.nodeByAppendingChildren($0.1) ] } <^> descendents <*> lines(n + 1)) <|> adjacent } -private let line: Int -> Parser.Function = fix { line in +private let line: Int -> Parser.Function = fix { line in { n in // TODO: block parsing: ignore(%char_space+ ++ block(n))|?) ++ // See Carthage/ogdl-swift#3. indentation(n) >>- { n in - subgraph(n) ++ optionalSpace + subgraph(n) <* optionalSpace } } } -private let followingLine: Int -> Parser.Function = { n in (ignore(comment | br)+ ++ line(n)) } -private let lines: Int -> Parser.Function = { n in - { ($0 ?? []) + flatMap($1, id) } <^> (line(n)|? ++ followingLine(n)*) +private let followingLine: Int -> Parser.Function = { n in some(comment <|> br) *> line(n) } +private let lines: Int -> Parser.Function = { n in + curry { ($0 ?? []) + $1.flatMap(id) } <^> line(n)|? <*> many(followingLine(n)) } /// Parses a textual OGDL graph into a list of nodes (and their descendants). @@ -178,4 +168,4 @@ private let lines: Int -> Parser.Function = { n in /// Example: /// /// let nodes = parse(graph, "foo (bar, buzz baz)") -public let graph: Parser.Function = ignore(comment | br)* ++ (lines(0) | adjacent) ++ ignore(comment | br)* +public let graph: Parser.Function = many(comment <|> br) *> (lines(0) <|> adjacent) <* many(comment <|> br) From f672dd40cedab7ff01eb1e2001f63d3843fdd3d4 Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Mon, 16 Nov 2015 21:05:10 +0100 Subject: [PATCH 07/14] Converted ParserSpec.swift --- OGDLTests/ParserSpec.swift | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/OGDLTests/ParserSpec.swift b/OGDLTests/ParserSpec.swift index c4ca8c6..d7de91b 100644 --- a/OGDLTests/ParserSpec.swift +++ b/OGDLTests/ParserSpec.swift @@ -15,34 +15,34 @@ import Quick class ParserSpec: QuickSpec { override func spec() { it("should parse the empty string") { - expect(parse(graph, "").right).to(equal([])) + expect(parse(graph, input: "").right).to(equal([])) } it("should parse a line break") { - expect(parse(graph, "\n").right).to(equal([])) + expect(parse(graph, input: "\n").right).to(equal([])) } it("should parse a series of line breaks") { - expect(parse(graph, "\n\n\n").right).to(equal([])) + expect(parse(graph, input: "\n\n\n").right).to(equal([])) } it("should parse a single node with descendents") { - expect(parse(descendents, "foobar").right).to(equal(Node(value: "foobar"))) + expect(parse(descendents, input: "foobar").right).to(equal(Node(value: "foobar"))) } it("should parse a single node with adjacent") { - expect(parse(adjacent, "foobar").right).to(equal([ Node(value: "foobar") ])) + expect(parse(adjacent, input: "foobar").right).to(equal([ Node(value: "foobar") ])) } it("should parse a single node") { let expectedGraph = [ Node(value: "foobar") ] - let parsedGraph = parse(graph, "foobar").right + let parsedGraph = parse(graph, input: "foobar").right expect(parsedGraph).to(equal(expectedGraph)) } it("should parse a single node ending with a newline") { let expectedGraph = [ Node(value: "foobar") ] - let parsedGraph = parse(graph, "foobar\n").right + let parsedGraph = parse(graph, input: "foobar\n").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -57,7 +57,7 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo bar fuzz buzz").right + let parsedGraph = parse(graph, input: "foo bar fuzz buzz").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -70,7 +70,7 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo \"bar\" \"fuzz buzz\"").right + let parsedGraph = parse(graph, input: "foo \"bar\" \"fuzz buzz\"").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -86,7 +86,7 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo bar, fuzz buzz").right + let parsedGraph = parse(graph, input: "foo bar, fuzz buzz").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -99,7 +99,7 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo (bar, quux)").right + let parsedGraph = parse(graph, input: "foo (bar, quux)").right expect(parsedGraph).to(equal(expectedGraph)) } @@ -112,12 +112,12 @@ class ParserSpec: QuickSpec { ]) ] - let parsedGraph = parse(graph, "foo ( bar.o 1.2, quux.o 2.1 )").right + let parsedGraph = parse(graph, input: "foo ( bar.o 1.2, quux.o 2.1 )").right expect(parsedGraph).to(equal(expectedGraph)) } it("should parse comments") { - let parsedGraph = parse(graph, "#foo").right + let parsedGraph = parse(graph, input: "#foo").right expect(parsedGraph).to(equal([])) } @@ -142,12 +142,12 @@ class ParserSpec: QuickSpec { for i in 1...5 { let URL = NSBundle(forClass: self.dynamicType).URLForResource("Example2-\(i)", withExtension: "ogdl", subdirectory: "Samples")! - let sample = NSString(contentsOfURL: URL, encoding: NSUTF8StringEncoding, error: nil) as? String + let sample = try? String(contentsOfURL: URL, encoding: NSUTF8StringEncoding) expect(sample).notTo(beNil()) - let parsedGraph = parse(graph, sample ?? "").right + let parsedGraph = parse(graph, input: sample ?? "").right if let parsedGraph = parsedGraph { - println("graph \(i):\n\(parsedGraph)\n") + print("graph \(i):\n\(parsedGraph)\n") } expect(parsedGraph).to(equal(expectedGraph)) From 8589f007255885a9ce76d0b3ea395180939b89ac Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Mon, 16 Nov 2015 21:20:16 +0100 Subject: [PATCH 08/14] Simplify mapping a bit --- OGDL/Parser.swift | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/OGDL/Parser.swift b/OGDL/Parser.swift index ada15c3..edabba8 100644 --- a/OGDL/Parser.swift +++ b/OGDL/Parser.swift @@ -69,6 +69,10 @@ public func pure(value: T) -> [T] { return [value] } +public func flatten(value: [[T]]) -> [T] { + return value.flatMap(id) +} + // TODO: Escape sequences. private let singleQuotedChars = many(memberOf(char_text - "'")) private let singleQuoted = char("'") *> singleQuotedChars <* char("'") @@ -106,12 +110,18 @@ private func foldr(inout generator: G, initial: Result return generator.next().map { combine($0, foldr(&generator, initial: initial, combine: combine)) } ?? initial } +private func <|> (parser: Parser.Function, @autoclosure(escaping) right: () -> T) -> Parser.Function { + return { $0 ?? right() } <^> (parser|?) +} + // MARK: OGDL private let children: Parser.Function = delay { group <|> (pure <^> element) } private let element = delay { - curry { Node(value: $0, children: $1 ?? []) } <^> value <*> (optionalSpace *> children)|? + curry(Node.init) + <^> value + <*> ((optionalSpace *> children) <|> []) } // TODO: See Carthage/ogdl-swift#3. @@ -132,12 +142,14 @@ public let descendents = interleave(requiredSpace, descendent) /// /// x y (u, v) # => Node(x, [ Node(y, [ Node(u), Node(v) ]) ]) private let descendentChain: Parser.Function = - curry { $0.nodeByAppendingChildren($1 ?? []) } <^> descendents <*> (optionalSpace *> group)|? + Node.nodeByAppendingChildren + <^> descendents + <*> ((optionalSpace *> group) <|> []) /// Parses a sequence of adjacent sibling elements, e.g.: /// /// x, y z, w (u, v) # => [ Node(x), Node(y, Node(z)), Node(w, [ Node(u), Node(v) ]) ] -public let adjacent: Parser.Function = delay { interleave(separator, descendentChain) } +public let adjacent = delay { interleave(separator, descendentChain) } /// Parses a parenthesized sequence of sibling elements, e.g.: /// @@ -145,7 +157,7 @@ public let adjacent: Parser.Function = delay { int private let group = delay { char("(") *> optionalSpace *> adjacent <* optionalSpace <* char(")") } private let subgraph: Int -> Parser.Function = { n in - (curry { [ $0.0.nodeByAppendingChildren($0.1) ] } <^> descendents <*> lines(n + 1)) <|> adjacent + pure <^> (Node.nodeByAppendingChildren <^> descendents <*> lines(n + 1)) <|> adjacent } private let line: Int -> Parser.Function = fix { line in @@ -160,7 +172,9 @@ private let line: Int -> Parser.Function = fix { l private let followingLine: Int -> Parser.Function = { n in some(comment <|> br) *> line(n) } private let lines: Int -> Parser.Function = { n in - curry { ($0 ?? []) + $1.flatMap(id) } <^> line(n)|? <*> many(followingLine(n)) + curry(concat) + <^> (line(n) <|> []) + <*> (flatten <^> many(followingLine(n))) } /// Parses a textual OGDL graph into a list of nodes (and their descendants). From b4acc620b45df54c620e343ffc70dba6a4306dea Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Tue, 17 Nov 2015 11:14:54 +0100 Subject: [PATCH 09/14] Curry concat by default --- OGDL/Parser.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OGDL/Parser.swift b/OGDL/Parser.swift index edabba8..f86ec55 100644 --- a/OGDL/Parser.swift +++ b/OGDL/Parser.swift @@ -61,8 +61,8 @@ private func prepend(value: T) -> [T] -> [T] { return { [value] + $0 } } -public func concat(left: [T], right: [T]) -> [T] { - return left + right +public func concat(left: [T]) -> [T] -> [T] { + return { right in right + right } } public func pure(value: T) -> [T] { @@ -172,7 +172,7 @@ private let line: Int -> Parser.Function = fix { l private let followingLine: Int -> Parser.Function = { n in some(comment <|> br) *> line(n) } private let lines: Int -> Parser.Function = { n in - curry(concat) + concat <^> (line(n) <|> []) <*> (flatten <^> many(followingLine(n))) } From 50017985dc17f736cddee6e829495f468f049023 Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Tue, 17 Nov 2015 11:16:32 +0100 Subject: [PATCH 10/14] Use ?? operator instead of <|> --- OGDL/Parser.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OGDL/Parser.swift b/OGDL/Parser.swift index f86ec55..6cd97ff 100644 --- a/OGDL/Parser.swift +++ b/OGDL/Parser.swift @@ -110,7 +110,7 @@ private func foldr(inout generator: G, initial: Result return generator.next().map { combine($0, foldr(&generator, initial: initial, combine: combine)) } ?? initial } -private func <|> (parser: Parser.Function, @autoclosure(escaping) right: () -> T) -> Parser.Function { +private func ?? (parser: Parser.Function, @autoclosure(escaping) right: () -> T) -> Parser.Function { return { $0 ?? right() } <^> (parser|?) } @@ -121,7 +121,7 @@ private let children: Parser.Function = delay { gr private let element = delay { curry(Node.init) <^> value - <*> ((optionalSpace *> children) <|> []) + <*> (optionalSpace *> children) ?? [] } // TODO: See Carthage/ogdl-swift#3. @@ -144,7 +144,7 @@ public let descendents = interleave(requiredSpace, descendent) private let descendentChain: Parser.Function = Node.nodeByAppendingChildren <^> descendents - <*> ((optionalSpace *> group) <|> []) + <*> (optionalSpace *> group) ?? [] /// Parses a sequence of adjacent sibling elements, e.g.: /// @@ -173,7 +173,7 @@ private let line: Int -> Parser.Function = fix { l private let followingLine: Int -> Parser.Function = { n in some(comment <|> br) *> line(n) } private let lines: Int -> Parser.Function = { n in concat - <^> (line(n) <|> []) + <^> line(n) ?? [] <*> (flatten <^> many(followingLine(n))) } From 8b9f0a9be595850524f276bf97d16aeeac512e45 Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Tue, 17 Nov 2015 11:28:54 +0100 Subject: [PATCH 11/14] Remove unnecessary constraint --- OGDL/Parser.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OGDL/Parser.swift b/OGDL/Parser.swift index 6cd97ff..a496488 100644 --- a/OGDL/Parser.swift +++ b/OGDL/Parser.swift @@ -97,7 +97,7 @@ func indentation(n: Int) -> Parser.Function { /// Returns a parser which produces an array of parse trees produced by `parser` interleaved with ignored parses of `separator`. /// /// This is convenient for e.g. comma-separated lists. -private func interleave(separator: Parser.Function, _ parser: Parser.Function) -> Parser.Function { +private func interleave(separator: Parser.Function, _ parser: Parser.Function) -> Parser.Function { return prepend <^> parser <*> many(separator *> parser) } From 0103d60c5bddf004e74f6f7ae70c3c63fcdff115 Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Wed, 18 Nov 2015 08:39:01 +0100 Subject: [PATCH 12/14] Fix concat --- OGDL/Parser.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OGDL/Parser.swift b/OGDL/Parser.swift index a496488..a5064a3 100644 --- a/OGDL/Parser.swift +++ b/OGDL/Parser.swift @@ -62,7 +62,7 @@ private func prepend(value: T) -> [T] -> [T] { } public func concat(left: [T]) -> [T] -> [T] { - return { right in right + right } + return { right in left + right } } public func pure(value: T) -> [T] { From 2b3eea3b336176f7584cc7f65abe612f08679dde Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Wed, 18 Nov 2015 08:39:56 +0100 Subject: [PATCH 13/14] Remove unnecessary parens --- OGDL/Parser.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OGDL/Parser.swift b/OGDL/Parser.swift index a5064a3..7da832f 100644 --- a/OGDL/Parser.swift +++ b/OGDL/Parser.swift @@ -111,7 +111,7 @@ private func foldr(inout generator: G, initial: Result } private func ?? (parser: Parser.Function, @autoclosure(escaping) right: () -> T) -> Parser.Function { - return { $0 ?? right() } <^> (parser|?) + return { $0 ?? right() } <^> parser|? } // MARK: OGDL From 777f0668e1281fdd5d54611bea13027c61a3afc3 Mon Sep 17 00:00:00 2001 From: Coen Wessels Date: Wed, 18 Nov 2015 20:07:01 +0100 Subject: [PATCH 14/14] Ignore .xcscmblueprint --- .gitignore | 1 + .../xcshareddata/OGDL.xcscmblueprint | 77 ------------------- 2 files changed, 1 insertion(+), 77 deletions(-) delete mode 100644 OGDL.xcworkspace/xcshareddata/OGDL.xcscmblueprint diff --git a/.gitignore b/.gitignore index e2d2f31..05d1d30 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ build/ !default.perspectivev3 xcuserdata *.xccheckout +*.xcscmblueprint *.moved-aside DerivedData *.hmap diff --git a/OGDL.xcworkspace/xcshareddata/OGDL.xcscmblueprint b/OGDL.xcworkspace/xcshareddata/OGDL.xcscmblueprint deleted file mode 100644 index 9274e0a..0000000 --- a/OGDL.xcworkspace/xcshareddata/OGDL.xcscmblueprint +++ /dev/null @@ -1,77 +0,0 @@ -{ - "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "D01149946CBFB7F4D884E8659DC65D5DEB658A19", - "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { - - }, - "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { - "D01149946CBFB7F4D884E8659DC65D5DEB658A19" : 0, - "D5FA66743146831DA2A20C0EAE4583EF424D9041" : 0, - "D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" : 0, - "9A760A1EBAC1979D46EF016B1BE84D98E53C16FF" : 0, - "95438028B10BBB846574013D29F154A00556A9D1" : 0, - "E084C86B03F81D63323C9E7510697EA528A758C7" : 0, - "57C931977B7D2307CC013C2BD93F90CF7C676790" : 0, - "7FCD68358D0D5A67F26F2A5E7B31EB3EF0CB2C00" : 0 - }, - "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "E83B8028-25D4-408D-B553-312799016D19", - "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { - "D01149946CBFB7F4D884E8659DC65D5DEB658A19" : "ogdl-swift\/", - "D5FA66743146831DA2A20C0EAE4583EF424D9041" : "ogdl-swift\/Carthage\/Checkouts\/Either\/", - "D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" : "ogdl-swift\/Carthage\/Checkouts\/Quick\/", - "9A760A1EBAC1979D46EF016B1BE84D98E53C16FF" : "ogdl-swift\/Carthage\/Checkouts\/Prelude\/", - "95438028B10BBB846574013D29F154A00556A9D1" : "ogdl-swift\/Carthage\/Checkouts\/Quick\/Externals\/Nimble\/", - "E084C86B03F81D63323C9E7510697EA528A758C7" : "ogdl-swift\/Carthage\/Checkouts\/xcconfigs\/", - "57C931977B7D2307CC013C2BD93F90CF7C676790" : "ogdl-swift\/Carthage\/Checkouts\/Box\/", - "7FCD68358D0D5A67F26F2A5E7B31EB3EF0CB2C00" : "ogdl-swift\/Carthage\/Checkouts\/Madness\/" - }, - "DVTSourceControlWorkspaceBlueprintNameKey" : "OGDL", - "DVTSourceControlWorkspaceBlueprintVersion" : 204, - "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "OGDL.xcworkspace", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Box.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "57C931977B7D2307CC013C2BD93F90CF7C676790" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Madness.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "7FCD68358D0D5A67F26F2A5E7B31EB3EF0CB2C00" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Nimble.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "95438028B10BBB846574013D29F154A00556A9D1" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Nimble.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "95438028B10BBB846574013D29F154A00556A9D1" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Prelude.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "9A760A1EBAC1979D46EF016B1BE84D98E53C16FF" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/coenert\/ogdl-swift.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D01149946CBFB7F4D884E8659DC65D5DEB658A19" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Quick.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Either.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D5FA66743146831DA2A20C0EAE4583EF424D9041" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/jspahrsummers\/xcconfigs.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "E084C86B03F81D63323C9E7510697EA528A758C7" - } - ] -} \ No newline at end of file