Skip to content

Commit

Permalink
Expose Substring parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
fcanas committed Aug 27, 2020
1 parent 15480e5 commit b5650a7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/FFCParserCombinator/StringParsing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ public extension Parser where S == Substring {
func run(_ x: String) -> (A, Substring)? {
return parse(x[x.fullRange])
}

/// Parses the full contents of the `Substring` parameter with a `Parser<Substring>`.
///
/// - Parameter x: The `Substring` content to be parsed.
/// - Returns: A result, `A` and a remainder, `Substring`
func run(_ x: Substring) -> (A, Substring)? {
return parse(x)
}
}

/** Builds a `Parser` for matching a single character
Expand Down

0 comments on commit b5650a7

Please sign in to comment.