From 57917ea2e4820917ae80930fbc52b6de2adbb146 Mon Sep 17 00:00:00 2001 From: David Dufresne Date: Sat, 6 Aug 2016 19:08:34 -0400 Subject: [PATCH] Update syntax according to changes introduced in Xcode 8 beta 4 --- Sources/SwiftParsec/Combinator.swift | 2 +- Sources/SwiftParsec/Error.swift | 2 +- Sources/SwiftParsec/Expression.swift | 4 ++-- Sources/SwiftParsec/Parsec.swift | 2 +- Sources/SwiftParsec/Permutation.swift | 2 +- Tests/SwiftParsec/GenericParserTests.swift | 2 +- Tests/SwiftParsec/JSONBenchmarkTests.swift | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/SwiftParsec/Combinator.swift b/Sources/SwiftParsec/Combinator.swift index 30a2114..5742308 100644 --- a/Sources/SwiftParsec/Combinator.swift +++ b/Sources/SwiftParsec/Combinator.swift @@ -22,7 +22,7 @@ public extension GenericParser { _ parsers: S ) -> GenericParser { - return parsers.reduce(GenericParser.empty, combine: <|>) + return parsers.reduce(GenericParser.empty, <|>) } diff --git a/Sources/SwiftParsec/Error.swift b/Sources/SwiftParsec/Error.swift index 7379b29..7487ad3 100644 --- a/Sources/SwiftParsec/Error.swift +++ b/Sources/SwiftParsec/Error.swift @@ -86,7 +86,7 @@ public func <(leftMsg: Message, rightMsg: Message) -> Bool { /// `ParseError` represents parse errors. It provides the source position /// (`SourcePosition`) of the error and an array of error messages (`Message`). /// A `ParseError` can be returned by the function `parse`. -public struct ParseError: ErrorProtocol, CustomStringConvertible { +public struct ParseError: Error, CustomStringConvertible { /// Return an unknown parse error. /// diff --git a/Sources/SwiftParsec/Expression.swift b/Sources/SwiftParsec/Expression.swift index 4019a27..742a98a 100644 --- a/Sources/SwiftParsec/Expression.swift +++ b/Sources/SwiftParsec/Expression.swift @@ -36,7 +36,7 @@ public enum Operator { } public struct OperatorTable: -RangeReplaceableCollection, ArrayLiteralConvertible { +RangeReplaceableCollection, ExpressibleByArrayLiteral { /// Represents a valid position in the operator table. public typealias Index = Int @@ -203,7 +203,7 @@ RangeReplaceableCollection, ArrayLiteralConvertible { let ops: OperatorsTuple = operators.reduce( ([], [], [], [], []), - combine: splitOperators + splitOperators ) let rightAssocOp = GenericParser.choice(ops.right) diff --git a/Sources/SwiftParsec/Parsec.swift b/Sources/SwiftParsec/Parsec.swift index 7e1532a..65b3117 100644 --- a/Sources/SwiftParsec/Parsec.swift +++ b/Sources/SwiftParsec/Parsec.swift @@ -288,7 +288,7 @@ public extension Parsec where UserState == () { /// A `Stream` instance is responsible for maintaining the position of the /// parser's stream. -public protocol Stream: Collection, ArrayLiteralConvertible {} +public protocol Stream: Collection, ExpressibleByArrayLiteral {} extension String: Stream { diff --git a/Sources/SwiftParsec/Permutation.swift b/Sources/SwiftParsec/Permutation.swift index e8f9ab7..2a142fb 100644 --- a/Sources/SwiftParsec/Permutation.swift +++ b/Sources/SwiftParsec/Permutation.swift @@ -25,7 +25,7 @@ /// let parser = permutation.parser.stringValue /// public struct Permutation: -RangeReplaceableCollection, ArrayLiteralConvertible { +RangeReplaceableCollection, ExpressibleByArrayLiteral { /// Represents a valid position in the permutation. public typealias Index = Int diff --git a/Tests/SwiftParsec/GenericParserTests.swift b/Tests/SwiftParsec/GenericParserTests.swift index 6b02a54..1e895f9 100644 --- a/Tests/SwiftParsec/GenericParserTests.swift +++ b/Tests/SwiftParsec/GenericParserTests.swift @@ -612,7 +612,7 @@ class GenericParserTests: XCTestCase { /// implementation for the `+` operator. protocol PlusOperator { - func +(lhs: Self, rhs: Self) -> Self + static func +(lhs: Self, rhs: Self) -> Self } diff --git a/Tests/SwiftParsec/JSONBenchmarkTests.swift b/Tests/SwiftParsec/JSONBenchmarkTests.swift index d2a85bf..a2a37be 100644 --- a/Tests/SwiftParsec/JSONBenchmarkTests.swift +++ b/Tests/SwiftParsec/JSONBenchmarkTests.swift @@ -143,7 +143,7 @@ class BenchmarkTests: XCTestCase { ) let bundle = Bundle(for: self.dynamicType) - let path = bundle.pathForResource("SampleJSON", ofType: "json")! + let path = bundle.path(forResource: "SampleJSON", ofType: "json")! let jsonData = try! String( contentsOfFile: path, encoding: String.Encoding.utf8