mirror of
https://github.com/zhigang1992/SwiftParsec.git
synced 2026-01-12 22:52:43 +08:00
Update syntax according to changes introduced in Xcode 8 beta 4
This commit is contained in:
@@ -22,7 +22,7 @@ public extension GenericParser {
|
||||
_ parsers: S
|
||||
) -> GenericParser {
|
||||
|
||||
return parsers.reduce(GenericParser.empty, combine: <|>)
|
||||
return parsers.reduce(GenericParser.empty, <|>)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
///
|
||||
|
||||
@@ -36,7 +36,7 @@ public enum Operator<StreamType: Stream, UserState, Result> {
|
||||
}
|
||||
|
||||
public struct OperatorTable<StreamType: Stream, UserState, Result>:
|
||||
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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
/// let parser = permutation.parser.stringValue
|
||||
///
|
||||
public struct Permutation<StreamType: Stream, UserState, Result>:
|
||||
RangeReplaceableCollection, ArrayLiteralConvertible {
|
||||
RangeReplaceableCollection, ExpressibleByArrayLiteral {
|
||||
|
||||
/// Represents a valid position in the permutation.
|
||||
public typealias Index = Int
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user