combinator

object combinator

This module contains combinators that can be used to directly influence error messages of parsers.

This module contains combinators that can be used to directly influence error messages of parsers.

Since

3.0.0

class Object
trait Matchable
class Any

Type members

Classlikes

final class ErrorMethods[P, +A](p: => P)(con: P => Parsley[A])

This class exposes helpful combinators that are specialised for generating more helpful errors messages. For a description of why the library is designed in this way, see: the Parsley wiki

This class exposes helpful combinators that are specialised for generating more helpful errors messages. For a description of why the library is designed in this way, see: the Parsley wiki

Value Params
con

A conversion (if required) to turn p into a parser

p

The parser which serves as the method receiver

Version

3.0.0

Value members

Concrete methods

def amend[A](p: => Parsley[A]): Parsley[A]

This combinator adjusts the error messages that are generated within its scope so that they happen at the position on entry to the combinator. This is useful if validation work is done on the output of a parser that may render it invalid, but the error should point to the beginning of the structure. This combinators effect can be cancelled with [[entrench]]

This combinator adjusts the error messages that are generated within its scope so that they happen at the position on entry to the combinator. This is useful if validation work is done on the output of a parser that may render it invalid, but the error should point to the beginning of the structure. This combinators effect can be cancelled with [[entrench]]

Value Params
p

A parser whose error messages should be adjusted

Since

3.1.0

def entrench[A](p: => Parsley[A]): Parsley[A]

Sometimes, the error adjustments performed by [[amend]] should only affect errors generated within a certain part of a parser and not the whole thing. In this case, entrench can be used to protect sub-parsers from having their errors adjusted, providing a much more fine-grained scope for error adjustment.

Sometimes, the error adjustments performed by [[amend]] should only affect errors generated within a certain part of a parser and not the whole thing. In this case, entrench can be used to protect sub-parsers from having their errors adjusted, providing a much more fine-grained scope for error adjustment.

Value Params
p

A parser whose error messages should not be adjusted by any surrounding [[amend]]

Since

3.1.0

def fail(msgs: String*): Parsley[Nothing]

The fail(msgs) parser consumes no input and fails with msg as the error message

The fail(msgs) parser consumes no input and fails with msg as the error message

Since

3.0.0

def unexpected(msg: String): Parsley[Nothing]

The unexpected(msg) parser consumes no input and fails with msg as an unexpected error

The unexpected(msg) parser consumes no input and fails with msg as an unexpected error

Since

3.0.0