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.expr contains the following sub modules:
    • parsley.implicits contains several implicits to add syntactic sugar to the combinators, such as being able to use character and string literals directly as parsers, as well as enabling lifting of functions to work on parsers.
    • 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.

    In addition to the modules and packages outlined above, this version of Parsley (up to version 3.0), also includes the so-called old-style API, which is deprecated (see the Parsley wiki for a discussion of these differences). You should use the modules described above, and avoid the following:

    • parsley.BitGen
    • parsley.Char
    • parsley.CharSet
    • parsley.Combinator
    • parsley.ExpressionParser
    • parsley.Impl
    • parsley.Implicits
    • parsley.LanguageDef
    • parsley.NotRequired
    • parsley.Parser
    • parsley.Predicate
    • parsley.Reg
    • parsley.TokenParser
    Definition Classes
    root
  • package parsley
    Definition Classes
    root
  • package expr
    Definition Classes
    parsley
  • package internal
    Definition Classes
    parsley
  • package token
    Definition Classes
    parsley
  • BitGen
  • Char
  • CharSet
  • Combinator
  • ExpressionParser
  • Failure
  • Impl
  • Implicits
  • LanguageDef
  • NotRequired
  • Parser
  • Parsley
  • Predicate
  • Reg
  • Result
  • Success
  • TokenParser
  • character
  • combinator
  • debug
  • implicits
  • lift
  • registers
  • unsafe
c

parsley

Result

sealed abstract class Result[+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(p: (A) => Boolean, msg: => String): Result[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](f: (A) => Result[B]): Result[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](implicit ev: <:<[A, Result[B]]): Result[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: (String) => 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[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](or: => Result[B]): Result[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[String, A]

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

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

    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