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
  • Failure
  • Parsley
  • Parsley212
  • Result
  • Success
  • character
  • combinator
  • debug
  • io
  • lift
  • registers
  • unsafe
  • package token
    Definition Classes
    parsley
o

parsley

registers

object registers

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

Since

2.2.0

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

Type Members

  1. class Reg[A] extends AnyRef

    This class is used to index registers within the mutable state.

    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.

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

    Consumes no input and returns the value stored in one of the parser registers.

    Consumes no input and returns the value stored in one of the parser registers.

    S

    The type of the value in register r (this will result in a runtime type-check)

    r

    The index of the register to collect from

    returns

    The value stored in register r of type S

    Since

    2.2.0

    Note

    There are only 4 registers at present.

  10. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def gets[S, A](r: Reg[S], pf: Parsley[(S) ⇒ A]): Parsley[A]

    Returns the value stored in one of the parser registers after applying a function obtained from given parser.

    Returns the value stored in one of the parser registers after applying a function obtained from given parser.

    S

    The type of the value in register r (this will result in a runtime type-check)

    A

    The desired result type

    r

    The index of the register to collect from

    pf

    The parser which provides the function to transform values

    returns

    The value stored in register r applied to f from pf

    Since

    2.2.0

    Note

    There are only 4 registers at present. The value is fetched after pf is executed

  12. def gets[S, A](r: Reg[S], f: (S) ⇒ A): Parsley[A]

    Consumes no input and returns the value stored in one of the parser registers after applying a function.

    Consumes no input and returns the value stored in one of the parser registers after applying a function.

    S

    The type of the value in register r (this will result in a runtime type-check)

    A

    The desired result type

    r

    The index of the register to collect from

    f

    The function used to transform the value in the register

    returns

    The value stored in register r applied to f

    Since

    2.2.0

    Note

    There are only 4 registers at present.

  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. def local[R, A](r: Reg[R], f: (R) ⇒ R, p: ⇒ Parsley[A]): Parsley[A]

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

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

    r

    The index of the register to modify

    f

    The function used to modify the value in register r

    p

    The parser to execute with the adjusted state

    returns

    The parser that performs p with the modified state

    Since

    2.2.0

    Note

    There are only 4 registers at present.

  16. def local[R, A](r: Reg[R], p: ⇒ Parsley[R], q: ⇒ Parsley[A]): Parsley[A]

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

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

    r

    The index of the register to modify

    p

    The parser whose return value is placed in register r

    q

    The parser to execute with the adjusted state

    returns

    The parser that performs q with the modified state

    Since

    2.2.0

    Note

    There are only 4 registers at present.

  17. def local[R, A](r: Reg[R], x: R, p: ⇒ Parsley[A]): Parsley[A]

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

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

    r

    The index of the register to modify

    x

    The value to place in the register r

    p

    The parser to execute with the adjusted state

    returns

    The parser that performs p with the modified state

    Since

    2.2.0

    Note

    There are only 4 registers at present.

  18. def modify[S](r: Reg[S], f: (S) ⇒ S): Parsley[Unit]

    Modifies the value contained in register r using function f.

    Modifies the value contained in register r using function f.

    S

    The type of value currently assumed to be in the register

    r

    The index of the register to modify

    f

    The function used to modify the register

    Since

    2.2.0

    Note

    There are only 4 registers at present.

  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. def put[S](r: Reg[S], p: ⇒ Parsley[S]): Parsley[Unit]

    Places the result of running p into register r.

    Places the result of running p into register r.

    r

    The index of the register to place the value in

    p

    The parser to derive the value from

    Since

    2.2.0

    Note

    There are only 4 registers at present.

  23. def put[S](r: Reg[S], x: S): Parsley[Unit]

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

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

    r

    The index of the register to place the value in

    x

    The value to place in the register

    Since

    2.2.0

    Note

    There are only 4 registers at present.

  24. def puts[A, S](r: Reg[S], p: ⇒ Parsley[A], f: (A) ⇒ S): Parsley[Unit]

    Places the result of running p into register r.

    Places the result of running p into register r.

    r

    The index of the register to place the value in

    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

    Note

    There are only 4 registers at present.

  25. def rollback[A, B](reg: Reg[A], p: Parsley[B]): Parsley[B]

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

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

    reg

    The register to rollback on failure of p

    p

    The parser to perform

    returns

    The result of the parser p, if any

    Since

    2.2.0

  26. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  27. def toString(): String
    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  31. object Reg

Inherited from AnyRef

Inherited from Any

Ungrouped