Error

case Error[Token](consumed: Boolean, message: Message) extends Result[Token, Nothing]

Value members

Inherited methods

def consume: Result[Token, Nothing]

Marks this result as consuming.

Marks this result as consuming.

Inherited from:
Result
def empty: Result[Token, Nothing]

Marks this result as non-consuming.

Marks this result as non-consuming.

Inherited from:
Result
def label(label: String): Result[Token, Nothing]

Sets this parser's label.

Sets this parser's label.

Note that this only happens on non-consuming parsers: if the parser consumed data, then he's not one the possible outcomes of a disjunction, but the right branch of the disjunction. It just happened to fail.

Take for example:

val parser = string("foo") | string("bar")
parser.run("foa")

In this context, bar is clearly not a possibility - we've started parsing foo succesfully, and we want a message like "Expected o, found a". Applying the label to a consuming result would, instead, yield "Expected foo, found a", which is less useful.

Inherited from:
Result
def map[B](f: Nothing => B): Result[Token, B]
Inherited from:
Result
def mapMessage(f: Message => Message): Result[Token, Nothing]
Inherited from:
Result
def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product
def setStart(pos: Position): Result[Token, Nothing]
Inherited from:
Result
def toEither: Either[Message, Nothing]
Inherited from:
Result