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
  • object registers

    This module contains all the functionality and operations for using and manipulating registers.

    This module contains all the functionality and operations for using and manipulating registers.

    Definition Classes
    parsley
    Since

    2.2.0

  • Reg
  • RegisterMethods

class Reg[A] extends AnyRef

This class is used to index registers within the mutable state. Currently, there are only 4 available registers, so use them wisely!

If you need more than four registers but know that they will be used at different times you can rename your register, as long as they point to the same reference. You may find the Parsley[A].cast[B: ClassTag]: Parsley[B] combinator useful to change the type of a Reg[Any].

Since

2.2.0

Note

It is undefined behaviour to use a register in multiple different independent parsers. You should be careful to parameterise the registers in shared parsers and allocate fresh ones for each "top-level" parser you will run.

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

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 eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. def get: Parsley[A]

    Consumes no input and returns the value stored in this register

    Consumes no input and returns the value stored in this register

    returns

    The value stored in register

    Since

    3.2.0

  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def gets[B](pf: Parsley[(A) => B]): Parsley[B]

    Returns the value stored this register after applying a function obtained from given parser.

    Returns the value stored this register after applying a function obtained from given parser.

    B

    The desired result type

    pf

    The parser which provides the function to transform values

    returns

    The value stored in this register applied to f from pf

    Since

    3.2.0

    Note

    The value is fetched after pf is executed

  12. def gets[B](f: (A) => B): Parsley[B]

    Consumes no input and returns the value stored in this register after applying a function.

    Consumes no input and returns the value stored in this register after applying a function.

    B

    The desired result type

    f

    The function used to transform the value in this register

    returns

    The value stored in this register applied to f

    Since

    3.2.0

  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. def local[B](f: (A) => A)(p: => Parsley[B]): Parsley[B]

    For the duration of parser p the state stored in this register is instead modified with f.

    For the duration of parser p the state stored in this register is instead modified with f. The change is undone after p has finished.

    f

    The function used to modify the value in this register

    p

    The parser to execute with the adjusted state

    returns

    The parser that performs p with the modified state

    Since

    3.2.0

  16. def local[B](p: => Parsley[A])(q: => Parsley[B]): Parsley[B]

    For the duration of parser q the state stored in this register is instead set to the return value of p.

    For the duration of parser q the state stored in this register is instead set to the return value of p. The change is undone after q has finished.

    p

    The parser whose return value is placed in this register

    q

    The parser to execute with the adjusted state

    returns

    The parser that performs q with the modified state

    Since

    3.2.0

  17. def local[B](x: A)(p: => Parsley[B]): Parsley[B]

    For the duration of parser p the state stored in this register is instead set to x.

    For the duration of parser p the state stored in this register is instead set to x. The change is undone after p has finished.

    x

    The value to place into this register

    p

    The parser to execute with the adjusted state

    returns

    The parser that performs p with the modified state

    Since

    3.2.0

  18. def modify(pf: => Parsley[(A) => A]): Parsley[Unit]

    Modifies the value contained in this register using function f obtained from executing p.

    Modifies the value contained in this register using function f obtained from executing p.

    Since

    3.2.0

    Note

    The value is modified after pf is executed

  19. def modify(f: (A) => A): Parsley[Unit]

    Modifies the value contained in this register using function f.

    Modifies the value contained in this register using function f.

    f

    The function used to modify the register

    Since

    3.2.0

  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. def put(p: => Parsley[A]): Parsley[Unit]

    Places the result of running p into this register.

    Places the result of running p into this register.

    p

    The parser to derive the value from

    Since

    3.2.0

  24. def put(x: A): Parsley[Unit]

    Consumes no input and places the value x into this register.

    Consumes no input and places the value x into this register.

    x

    The value to place in the register

    Since

    3.2.0

  25. def puts[B](p: => Parsley[B], f: (B) => A): Parsley[Unit]

    Places the result of running p into this register.

    Places the result of running p into this register.

    p

    The parser to derive the value from

    f

    A function which adapts the result of p so that it can fit in r

    Since

    3.0.0

  26. def rollback[B](p: Parsley[B]): Parsley[B]

    rollback(reg, p) will perform p, but if it fails without consuming input, any changes to this register will be reverted.

    rollback(reg, p) will perform p, but if it fails without consuming input, any changes to this register will be reverted.

    p

    The parser to perform

    returns

    The result of the parser p, if any

    Since

    3.2.0

  27. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  28. def toString(): String
    Definition Classes
    AnyRef → Any
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped