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

object Parsley

This object contains the core "function-style" combinators as well as the implicit classes which provide the "method-style" combinators. All parsers will likely require something from within!

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

Type Members

  1. implicit final class LazyChooseParsley[P, +A] extends AnyRef

    This class exposes a ternary operator on pairs of parsers.

    This class exposes a ternary operator on pairs of parsers.

    Version

    1.0.0

  2. implicit final class LazyMapParsley[-A, +B] extends AnyRef

    This class exposes the <#> combinator on functions.

    This class exposes the <#> combinator on functions.

    Version

    1.0.0

  3. implicit final class LazyParsley[P, +A] extends AnyRef

    This class exposes the commonly used combinators in Parsley.

    This class exposes the commonly used combinators in Parsley. For a description of why the library is designed in this way, see: the Parsley wiki

    Version

    1.0.0

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 attempt[A](p: => Parsley[A]): Parsley[A]

    Given a parser p, attempts to parse p.

    Given a parser p, attempts to parse p. If the parser fails, then attempt ensures that no input was consumed. This allows for backtracking capabilities, disabling the implicit cut semantics offered by <|>.

    p

    The parser to run

    returns

    The result of p, or if p failed ensures the parser state was as it was on entry.

  6. def branch[A, B, C](b: => Parsley[Either[A, B]], p: => Parsley[(A) => C], q: => Parsley[(B) => C]): Parsley[C]

    This is one of the core operations of a selective functor.

    This is one of the core operations of a selective functor. It will conditionally execute one of p and q depending on the result from b. This can be used to implement conditional choice within a parser without relying on expensive monadic operations.

    b

    The first parser to parse

    p

    If b returns Left then this parser is executed with the result

    q

    If b returns Right then this parser is executed with the result

    returns

    Either the result from p or q depending on b.

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. val col: Parsley[Int]

    This parser consumes no input and returns the current column number reached in the input stream

    This parser consumes no input and returns the current column number reached in the input stream

    returns

    The column number the parser is currently at

  9. val empty: Parsley[Nothing]

    The empty parser consumes no input and fails softly (that is to say, no error message)

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def join[A](p: => Parsley[Parsley[A]]): Parsley[A]

    This function is an alias for _.flatten.

    This function is an alias for _.flatten. Provides namesake to Haskell.

  17. val line: Parsley[Int]

    This parser consumes no input and returns the current line number reached in the input stream

    This parser consumes no input and returns the current line number reached in the input stream

    returns

    The line number the parser is currently at

  18. def lookAhead[A](p: => Parsley[A]): Parsley[A]

    Parses p without consuming any input.

    Parses p without consuming any input. If p fails and consumes input then so does lookAhead(p). Combine with attempt if this is undesirable.

    p

    The parser to look ahead at

    returns

    The result of the lookahead

  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def notFollowedBy(p: Parsley[_]): Parsley[Unit]

    notFollowedBy(p) only succeeds when parser p fails.

    notFollowedBy(p) only succeeds when parser p fails. This parser does not consume any input. This parser can be used to implement the 'longest match' rule. For example, when recognising keywords, we want to make sure that a keyword is not followed by a legal identifier character, in which case the keyword is actually an identifier. We can program this behaviour as follows:

    attempt(kw *> notFollowedBy(alphaNum))
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. val pos: Parsley[(Int, Int)]

    This parser consumes no input and returns the current position reached in the input stream

    This parser consumes no input and returns the current position reached in the input stream

    returns

    Tuple of line and column number that the parser has reached

  24. def pure[A](x: A): Parsley[A]

    This is the traditional applicative pure function (or monadic return) for parsers.

    This is the traditional applicative pure function (or monadic return) for parsers. It consumes no input and does not influence the state of the parser, but does return the value provided. Useful to inject pure values into the parsing process.

    x

    The value to be returned from the parser

    returns

    A parser which consumes nothing and returns x

  25. def select[A, B](p: => Parsley[Either[A, B]], q: => Parsley[(A) => B]): Parsley[B]

    This is one of the core operations of a selective functor.

    This is one of the core operations of a selective functor. It will conditionally execute one of q depending on whether or not p returns a Left. It can be used to implement branch and other selective operations, however it is more efficiently implemented with branch itself.

    p

    The first parser to parse

    q

    If p returns Left then this parser is executed with the result

    returns

    Either the result from p if it returned Left or the result of q applied to the Right from p

  26. def sequence[A](ps: Parsley[A]*): Parsley[List[A]]

    Evaluate each of the parsers in ps sequentially from left to right, collecting the results.

    Evaluate each of the parsers in ps sequentially from left to right, collecting the results.

    ps

    Parsers to be sequenced

    returns

    The list containing results, one from each parser, in order

  27. def skip(ps: Parsley[_]*): Parsley[Unit]

    Evaluate each of the parsers in ps sequentially from left to right, ignoring the results.

    Evaluate each of the parsers in ps sequentially from left to right, ignoring the results.

    ps

    Parsers to be performed

  28. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  29. def toString(): String
    Definition Classes
    AnyRef → Any
  30. def traverse[A, B](f: (A) => Parsley[B], xs: A*): Parsley[List[B]]

    Like sequence but produces a list of parsers to sequence by applying the function f to each element in xs.

    Like sequence but produces a list of parsers to sequence by applying the function f to each element in xs.

    f

    The function to map on each element of xs to produce parsers

    xs

    Values to generate parsers from

    returns

    The list containing results formed by executing each parser generated from xs and f in sequence

  31. val unit: Parsley[Unit]

    Returns ().

    Returns (). Defined as pure(()) but aliased for sugar

  32. def void(p: Parsley[_]): Parsley[Unit]

    converts a parser's result to ()

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

Inherited from AnyRef

Inherited from Any

Ungrouped