Skip to content

Commit

Permalink
Merge pull request #72 from finestructure/package-update
Browse files Browse the repository at this point in the history
Package update
  • Loading branch information
finestructure authored Oct 22, 2020
2 parents f163cfd + 2f49bf8 commit ccd7783
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
12 changes: 6 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
"repositoryURL": "https://github.com/finestructure/Parser",
"state": {
"branch": null,
"revision": "fa5d7caa39da4eb839136e02344c2697344b112d",
"version": "0.1.2"
"revision": "08c718279b757dd40d8ce05c3d15ec1a76eab53e",
"version": "0.2.0"
}
},
{
"package": "Path.swift",
"repositoryURL": "https://github.com/mxcl/Path.swift.git",
"state": {
"branch": null,
"revision": "6e1eeb158ae0e71da3af23ef869aa0dc1adf7355",
"version": "1.0.1"
"revision": "142d4bc1118602f3679c777d2e0da89c227cd918",
"version": "1.2.0"
}
},
{
"package": "SemanticVersion",
"repositoryURL": "https://github.com/SwiftPackageIndex/SemanticVersion",
"state": {
"branch": null,
"revision": "f751d9d68d8ec4917c951f92eb4ce0646475868c",
"version": "0.2.0"
"revision": "97f2bd0551cde27717c5ab7b88e23d392e96452b",
"version": "0.3.1"
}
},
{
Expand Down
26 changes: 17 additions & 9 deletions Sources/ArenaCore/Parser+ext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ let AllowedRevisionCharacters = CharacterSet.whitespacesAndNewlines.inverted

extension Parser where A == SemanticVersion {
static var version: Parser<SemanticVersion> {
zip(int, literal("."), int, literal("."), int).map { major, _, minor, _, patch in
zip(Parser<Int>.int,
Parser<Void>.literal("."),
Parser<Int>.int,
Parser<Void>.literal("."),
Parser<Int>.int)
.map { major, _, minor, _, patch in
SemanticVersion(major, minor, patch)
}
}
Expand All @@ -30,15 +35,15 @@ extension Parser where A == SemanticVersion {

extension Parser where A == RefSpec {
static var branch: Parser<RefSpec> {
zip(literal("@branch:"), branchName).map { .branch(String($0.1)) }
zip(Parser<Void>.literal("@branch:"), branchName).map { .branch(String($0.1)) }
}

static var exact: Parser<RefSpec> {
zip(literal("@"), .version).map { .exact($0.1) }
zip(Parser<Void>.literal("@"), .version).map { .exact($0.1) }
}

static var from: Parser<RefSpec> {
zip(literal("@from:"), .version).map { .from($0.1) }
zip(Parser<Void>.literal("@from:"), .version).map { .from($0.1) }
}

static var noVersion: Parser<RefSpec> {
Expand All @@ -47,8 +52,8 @@ extension Parser where A == RefSpec {

static var range: Parser<RefSpec> {
oneOf([
zip(literal("@"), .version, string("..<"), .version),
zip(literal("@"), .version, string("..."), .version)
zip(Parser<Void>.literal("@"), .version, Parser<String>.string("..<"), .version),
zip(Parser<Void>.literal("@"), .version, Parser<String>.string("..."), .version)
]).map { _, minVersion, rangeOp, maxVersion in
rangeOp == "..<"
? .range(minVersion..<maxVersion)
Expand All @@ -57,7 +62,7 @@ extension Parser where A == RefSpec {
}

static var revision: Parser<RefSpec> {
zip(literal("@revision:"), prefix(charactersIn: AllowedRevisionCharacters))
zip(Parser<Void>.literal("@revision:"), Parser<Substring>.prefix(charactersIn: AllowedRevisionCharacters))
.map { .revision(String($0.1)) }
}

Expand All @@ -72,7 +77,10 @@ extension Parser where A == RefSpec {

extension Parser where A == Scheme {
static var scheme: Parser<Scheme> {
oneOf(Scheme.allCases.map { string($0.rawValue).map { Scheme(rawValue: $0)! } } )
oneOf(Scheme.allCases.map {
Parser<String>.string($0.rawValue)
.map { Scheme(rawValue: $0)! }
})
}
}

Expand All @@ -81,7 +89,7 @@ extension Parser where A == Foundation.URL {
static var url: Parser<Foundation.URL> {
zip(
Parser<Scheme>.scheme,
prefix(upTo: "@").map(String.init)
Parser<Substring>.prefix(upTo: "@").map(String.init)
).flatMap { (scheme, rest) in
if let url = scheme.url(path: rest) {
return always(url)
Expand Down

0 comments on commit ccd7783

Please sign in to comment.