ParseResult

public enum ParseResult<Param, Result> where Param : Hashable

The result of parsing a particular symbol with a particular input parameter.

  • This denotes the case that parsing has failed at the given position in the input.

    Declaration

    Swift

    case failed(position: Int)
  • This denotes the case of a successful parse.

    • length: The number of characters in the input that the successful parse encompasses.
    • results: A dictionary mapping the output parameter of the successfully parsed symbol to an optional result. This dictionary will contain at least one entry, and can contain multiple entries in case of an ambiguous parse. If the dictionary contains only a single entry this does not necessarily imply that the parse has been unambiguous. This is because ambiguity might have been subsumed into the optional result via ConstructResult.merge(key:results:).

    Declaration

    Swift

    case success(length: Int, results: [Param : Result?])