Failure

case class Failure(msgProvider: Message, next: SourceCursor, maxOffset: Int) extends Parsed[Nothing]

The failure case of Parsed containing an error message and the remaining input.

Implementation note: The message property is of type Message, to allow for lazy message creation. The former SDK parser combinators which this API is partially inspired by contained a lot of unnecessary string concatenations for messages which were then never read. This implementation avoids this extra cost and the result is measurable (about 15% performance gain for a typical Markdown document for example).

Value parameters:
maxOffset

The offset position the parser could successfully read to before failing

msgProvider

A provider that produces an error message for this failure based on its SourceCursor

next

The unconsumed input at the point where the failing parser started

Companion:
object
trait Serializable
trait Product
trait Equals
class Parsed[Nothing]
class Object
trait Matchable
class Any

Value members

Concrete methods

def map[U](f: Nothing => U): Failure
def orElse[U](default: => Parsed[U]): Parsed[U]
def toEither: Either[String, Nothing]
def toOption: Option[Nothing]
override def toString: String
Definition Classes
Any

Inherited methods

def getOrElse[B](default: => B): B

Returns the result value from the parser invocation if the parser succeeded or otherwise the specified fallback value.

Returns the result value from the parser invocation if the parser succeeded or otherwise the specified fallback value.

Inherited from:
Parsed
def isFailure: Boolean

Indicates whether this results represents an unsuccessful parser invocation.

Indicates whether this results represents an unsuccessful parser invocation.

Inherited from:
Parsed
def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product

Concrete fields

val isSuccess: Boolean
lazy val message: String

The message specifying the cause of the failure.

The message specifying the cause of the failure.