Packages

  • package root

    This is the documentation for Parsley.

    This is the documentation for Parsley.

    Package structure

    The parsley package contains the Parsley class, as well as the Result, Success, and Failure types. In addition to these, it also contains the following packages and "modules" (a module is defined as being an object which mocks a package):

    • parsley.Parsley contains the bulk of the core "function-style" combinators, as well as the implicit classes which enable the "method-style" combinators.
    • parsley.combinator contains many helpful combinators that simplify some common parser patterns.
    • parsley.character contains the combinators needed to read characters and strings, as well as combinators to match specific sub-sets of characters.
    • parsley.debug contains debugging combinators, helpful for identifying faults in parsers.
    • parsley.io contains extension methods to run parsers with input sourced from IO sources.
    • parsley.expr contains the following sub modules:
    • parsley.implicits contains several implicits to add syntactic sugar to the combinators. These are sub-categorised into the following sub modules:
      • parsley.implicits.character contains implicits to allow you to use character and string literals as parsers.
      • parsley.implicits.combinator contains implicits related to combinators, such as the ability to make any parser into a Parsley[Unit] automatically.
      • parsley.implicits.lift enables postfix application of the lift combinator onto a function (or value).
      • parsley.implicits.zipped enables boths a reversed form of lift where the function appears on the right and is applied on a tuple (useful when type inference has failed) as well as a .zipped method for building tuples out of several combinators.
    • parsley.errors contains modules to deal with error messages, their refinement and generation.
      • parsley.errors.combinator provides combinators that can be used to either produce more detailed errors as well as refine existing errors.
    • parsley.lift contains functions which lift functions that work on regular types to those which now combine the results of parsers returning those same types. these are ubiquitous.
    • parsley.registers contains combinators that interact with the context-sensitive functionality in the form of registers.
    • parsley.token contains the Lexer class that provides a host of helpful lexing combinators when provided with the description of a language.
    • parsley.unsafe contains unsafe (and not thread-safe) ways of speeding up the execution of a parser.
    Definition Classes
    root
  • package parsley
    Definition Classes
    root
  • package errors
    Definition Classes
    parsley
  • package expr
    Definition Classes
    parsley
  • package implicits
    Definition Classes
    parsley
  • package token
    Definition Classes
    parsley
  • Failure
  • Parsley
  • Result
  • Success
  • character
  • combinator
  • debug
  • io
  • lift
  • registers
  • unsafe
t

parsley

Result

sealed trait Result[+Err, +A] extends AnyRef

Result of a parser. Either a Success[A] or a Failure

A

The type of expected success result

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Result
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def get: A

    Returns the results's value.

    Returns the results's value.

    Since

    1.7.0

    Exceptions thrown

    java.util.NoSuchElementException if the result is a failure.

    Note

    The result must not be a failure.

  2. abstract def isFailure: Boolean

    Returns true if this is a Failure, false otherwise.

    Returns true if this is a Failure, false otherwise.

    Since

    1.7.0

  3. abstract def isSuccess: Boolean

    Returns true if this is a Success, false otherwise.

    Returns true if this is a Success, false otherwise.

    Since

    1.7.0

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def contains[B >: A](elem: B): Boolean

    Returns true if this is a Success and its value is equal to elem (as determined by ==), returns false otherwise.

    Returns true if this is a Success and its value is equal to elem (as determined by ==), returns false otherwise.

    elem

    the element to test.

    returns

    true if this is a Success value equal to elem.

    Since

    1.7.0

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def exists(p: (A) => Boolean): Boolean

    Returns false if Failure or returns the result of the application of the given predicate to the Success value.

    Returns false if Failure or returns the result of the application of the given predicate to the Success value.

    Since

    1.7.0

  10. def filterOrElse[Err_ >: Err](p: (A) => Boolean, msg: => Err_): Result[Err_, A]

    Returns Success with the existing value of Success if this is a Success and the given predicate p holds for the right value, or Failure(msg) if this is a Success and the given predicate p does not hold for the right value, or Failure with the existing value of Failure if this is a Failure.

    Returns Success with the existing value of Success if this is a Success and the given predicate p holds for the right value, or Failure(msg) if this is a Success and the given predicate p does not hold for the right value, or Failure with the existing value of Failure if this is a Failure.

    Since

    1.7.0

  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  12. def flatMap[B, Err_ >: Err](f: (A) => Result[Err_, B]): Result[Err_, B]

    Binds the given function across Success.

    Binds the given function across Success.

    f

    The function to bind across Success.

    Since

    1.7.0

  13. def flatten[B, Err_ >: Err](implicit ev: <:<[A, Result[Err_, B]]): Result[Err_, B]

    Returns the right value if this is right or this value if this is left

    Returns the right value if this is right or this value if this is left

    Equivalent to flatMap(id => id)

    Since

    1.7.0

  14. def fold[B](ferr: (Err) => B, fa: (A) => B): B

    Applies fa if this is a Failure or fb if this is a Success.

    Applies fa if this is a Failure or fb if this is a Success.

    ferr

    the function to apply if this is a Failure

    fa

    the function to apply if this is a Success

    returns

    the results of applying the function

    Since

    1.7.0

  15. def forall(f: (A) => Boolean): Boolean

    Returns true if Failure or returns the result of the application of the given predicate to the Success value.

    Returns true if Failure or returns the result of the application of the given predicate to the Success value.

    Since

    1.7.0

  16. def foreach[U](f: (A) => U): Unit

    Executes the given side-effecting function if this is a Success.

    Executes the given side-effecting function if this is a Success.

    f

    The side-effecting function to execute.

    Since

    1.7.0

  17. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def getOrElse[B >: A](or: => B): B

    Returns the value from this Success or the given argument if this is a Failure.

    Returns the value from this Success or the given argument if this is a Failure.

    Since

    1.7.0

  19. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. def map[B](f: (A) => B): Result[Err, B]

    The given function is applied if this is a Success.

    The given function is applied if this is a Success.

    Since

    1.7.0

  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. def orElse[B >: A, Err_ >: Err](or: => Result[Err_, B]): Result[Err_, B]

    Returns this Success or the given argument if this is a Failure.

    Returns this Success or the given argument if this is a Failure.

    Since

    1.7.0

  26. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  27. def toEither: Either[Err, A]

    Converts the Result into a Either where Failure maps to a Left[Err]

    Converts the Result into a Either where Failure maps to a Left[Err]

    Since

    1.7.0

  28. def toOption: Option[A]

    Returns a Some containing the Success value if it exists or a None if this is a Failure.

    Returns a Some containing the Success value if it exists or a None if this is a Failure.

    Since

    1.7.0

  29. def toSeq: Seq[A]

    Returns a Seq containing the Success value if it exists or an empty Seq if this is a Failure.

    Returns a Seq containing the Success value if it exists or an empty Seq if this is a Failure.

    Since

    1.7.0

  30. def toString(): String
    Definition Classes
    AnyRef → Any
  31. def toTry: Try[A]

    Converts the Result into a Try where Failure maps to a plain Exception

    Converts the Result into a Try where Failure maps to a plain Exception

    Since

    1.7.0

  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped