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.
    • 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.expr.chain contains combinators used in expression parsing
      • parsley.expr.precedence is a builder for expression parsers built on a precedence table.
      • parsley.expr.infix contains combinators used in expression parsing, but with more permissive types than their equivalents in chain.
      • parsley.expr.mixed contains combinators that can be used for expression parsing, but where different fixities may be mixed on the same level: this is rare in practice.
    • parsley.syntax contains several implicits to add syntactic sugar to the combinators. These are sub-categorised into the following sub modules:
      • parsley.syntax.character contains implicits to allow you to use character and string literals as parsers.
      • parsley.syntax.lift enables postfix application of the lift combinator onto a function (or value).
      • parsley.syntax.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.syntax.extension contains syntactic sugar combinators exposed as implicit classes.
    • parsley.errors contains modules to deal with error messages, their refinement and generation.
    • 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.ap contains functions which allow for the application of a parser returning a function to several parsers returning each of the argument types.
    • parsley.state contains combinators that interact with the context-sensitive functionality in the form of state.
    • parsley.token contains the Lexer class that provides a host of helpful lexing combinators when provided with the description of a language.
    • parsley.position contains parsers for extracting position information.
    • parsley.generic contains some basic implementations of the Parser Bridge pattern (see Design Patterns for Parser Combinators in Scala, or the parsley wiki): these can be used before more specialised generic bridge traits can be constructed.
    Definition Classes
    root
  • package parsley
    Definition Classes
    root
  • package errors

    This package contains various functionality relating to the generation and formatting of error messages.

    This package contains various functionality relating to the generation and formatting of error messages.

    In particular, it includes a collection of combinators for improving error messages within the parser, including labelling and providing additional information. It also contains combinators that can be used to valid data produced by a parser, to ensure it conforms to expected invariances, producing good quality error messages if this is not the case. Finally, this package contains ways of changing the formatting of error messages: this can either be changing how the default String-based errors are formatted, or by injectiing Parsley's errors into a custom error object.

    Definition Classes
    parsley
  • package expr

    This package contains various functionality relating to the parsing of expressions..

    This package contains various functionality relating to the parsing of expressions..

    This includes the "chain" combinators, which tackle the left-recursion problem and allow for the parsing and combining of operators with values. It also includes functionality for constructing larger precedence tables, which may even vary the type of each layer in the table, allowing for strongly-typed expression parsing.

    Definition Classes
    parsley
  • package syntax

    This package contains various functionality that involve Scala's implicits mechanism.

    This package contains various functionality that involve Scala's implicits mechanism.

    This includes conversions from scala literals into parsers, as well as enabling new syntax on regular Scala values (such as Parsley's lift or zipped syntax). Automatic conversion to Parsley[Unit] is also supported within this package.

    Definition Classes
    parsley
  • package token

    This package provides a wealth of functionality for performing common lexing tasks.

    This package provides a wealth of functionality for performing common lexing tasks.

    It is organised as follows:

    • the main parsing functionality is accessed via Lexer, which provides implementations for the combinators found in the sub-packages given a LexicalDesc.
    • the descriptions sub-package is how a lexical structure can be described, providing the configuration that alters the behaviour of the parsers produced by the Lexer.
    • the other sub-packages contain the high-level interfaces that the Lexer exposes, which can be used to pass whitespace-aware and non-whitespace-aware combinators around in a uniform way.
    • the predicate module contains functionality to help define boolean predicates on characters or unicode codepoints.
    Definition Classes
    parsley
  • Failure
  • Parsley
  • PlatformSpecific
  • Result
  • Success
  • ap
  • character
  • combinator
  • debug
  • generic
  • lift
  • position
  • state
  • unicode
c

parsley

Success

final case class Success[A](x: A) extends Result[Nothing, A] with Product with Serializable

This class is used for when a parser succeeds, and contains its result.

A

the type of expected success result.

x

the result value of the successful parse.

Source
Result.scala
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Success
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Result
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Success(x: A)

    x

    the result value of the successful parse.

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( ... ) @native()
  6. def contains[B >: A](elem: B): Boolean

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

    Returns true if this result 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.

    Definition Classes
    Result
    Since

    1.7.0

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. 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.

    Definition Classes
    Result
    Since

    1.7.0

  9. def filterOrElse[Errʹ >: Nothing](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.

    Definition Classes
    Result
    Since

    1.7.0

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

    Returns the result of applying f to this result if it is a success.

    Returns the result of applying f to this result if it is a success. Returns a failure if this result is a failure. Differs from map as f returns a result instead of just a value.

    Definition Classes
    Result
    Since

    1.7.0

  12. def flatten[B, Errʹ >: Nothing](implicit ev: <:<[A, Result[Errʹ, B]]): Result[Errʹ, B]

    Returns the nested result if this result is a success, otherwise return this failure.

    Returns the nested result if this result is a success, otherwise return this failure.

    Equivalent to flatMap(identity[Result[Errʹ, B]]).

    Definition Classes
    Result
    Since

    1.7.0

  13. def fold[B](ferr: (Nothing) ⇒ B, fa: (A) ⇒ B): B

    Returns the result of applying ferr to this result's error if this is a Failure or fa to the result stored in the Success otherwise.

    Returns the result of applying ferr to this result's error if this is a Failure or fa to the result stored in the Success otherwise.

    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

    Definition Classes
    Result
    Since

    1.7.0

  14. def forall(f: (A) ⇒ Boolean): Boolean

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

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

    Definition Classes
    Result
    Since

    1.7.0

  15. def foreach[U](f: (A) ⇒ U): Unit

    Executes the procedure f if this is a Success.

    Executes the procedure f if this is a Success. Otherwise, do nothing.

    This is equivalent to:

    result match {
      case Success(x) => f(x)
      case _          => ()
    }
    f

    The side-effecting function to execute.

    Definition Classes
    Result
    Since

    1.7.0

  16. def get: A

    Returns the successful value within the result.

    Returns the successful value within the result.

    This is equivalent to:

    result match {
      case Success(x) => x
      case _          => throw new Exception
    }
    Definition Classes
    SuccessResult
  17. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def getOrElse[B >: A](default: ⇒ B): B

    Returns the value from this Success or the result of evaluating default if this is a Failure.

    Returns the value from this Success or the result of evaluating default if this is a Failure.

    Definition Classes
    Result
    Since

    1.7.0

  19. def isFailure: Boolean

    Returns true if this is a Failure, false otherwise.

    Returns true if this is a Failure, false otherwise.

    Definition Classes
    SuccessResult
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. def isSuccess: Boolean

    Returns true if this is a Success, false otherwise.

    Returns true if this is a Success, false otherwise.

    Definition Classes
    SuccessResult
  22. def map[B](f: (A) ⇒ B): Result[Nothing, B]

    Returns a Success containing the result of applying f to this result's value if this is a success.

    Returns a Success containing the result of applying f to this result's value if this is a success. Otherwise, returns a failure.

    Definition Classes
    Result
    Since

    1.7.0

  23. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. def orElse[B >: A, Errʹ >: Nothing](alternative: ⇒ Result[Errʹ, B]): Result[Errʹ, B]

    Returns this result if it is a Success, otherwise return the result of evaluating alternative.

    Returns this result if it is a Success, otherwise return the result of evaluating alternative.

    Definition Classes
    Result
    Since

    1.7.0

  27. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  28. def toEither: Either[Nothing, 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].

    Definition Classes
    Result
    Since

    1.7.0

  29. 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.

    Definition Classes
    Result
    Since

    1.7.0

  30. 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.

    Definition Classes
    Result
    Since

    1.7.0

  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.

    Definition Classes
    Result
    Since

    1.7.0

  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  35. val x: A

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Result[Nothing, A]

Inherited from AnyRef

Inherited from Any

Ungrouped