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.
- Alphabetic
- By Inheritance
- Reg
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- 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
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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
ffrompf
- Since
3.2.0
- Note
The value is fetched after
pfis executed
- 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
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def local[B](f: (A) => A)(p: => Parsley[B]): Parsley[B]
For the duration of parser
pthe state stored in this register is instead modified withf.For the duration of parser
pthe state stored in this register is instead modified withf. The change is undone afterphas 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
pwith the modified state
- Since
3.2.0
- def local[B](p: => Parsley[A])(q: => Parsley[B]): Parsley[B]
For the duration of parser
qthe state stored in this register is instead set to the return value ofp.For the duration of parser
qthe state stored in this register is instead set to the return value ofp. The change is undone afterqhas 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
qwith the modified state
- Since
3.2.0
- def local[B](x: A)(p: => Parsley[B]): Parsley[B]
For the duration of parser
pthe state stored in this register is instead set tox.For the duration of parser
pthe state stored in this register is instead set tox. The change is undone afterphas finished.- x
The value to place into this register
- p
The parser to execute with the adjusted state
- returns
The parser that performs
pwith the modified state
- Since
3.2.0
- def modify(pf: => Parsley[(A) => A]): Parsley[Unit]
Modifies the value contained in this register using function
fobtained from executingp.Modifies the value contained in this register using function
fobtained from executingp.- Since
3.2.0
- Note
The value is modified after
pfis executed
- 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
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def put(p: => Parsley[A]): Parsley[Unit]
Places the result of running
pinto this register.Places the result of running
pinto this register.- p
The parser to derive the value from
- Since
3.2.0
- def put(x: A): Parsley[Unit]
Consumes no input and places the value
xinto this register.Consumes no input and places the value
xinto this register.- x
The value to place in the register
- Since
3.2.0
- def puts[B](p: => Parsley[B], f: (B) => A): Parsley[Unit]
Places the result of running
pinto this register.Places the result of running
pinto this register.- p
The parser to derive the value from
- f
A function which adapts the result of
pso that it can fit inr
- Since
3.0.0
- def rollback[B](p: Parsley[B]): Parsley[B]
rollback(reg, p)will performp, but if it fails without consuming input, any changes to this register will be reverted.rollback(reg, p)will performp, 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
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
This is the documentation for Parsley.
Package structure
The parsley package contains the
Parsleyclass, as well as theResult,Success, andFailuretypes. 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.Parsleycontains the bulk of the core "function-style" combinators, as well as the implicit classes which enable the "method-style" combinators.parsley.combinatorcontains many helpful combinators that simplify some common parser patterns.parsley.charactercontains the combinators needed to read characters and strings, as well as combinators to match specific sub-sets of characters.parsley.debugcontains debugging combinators, helpful for identifying faults in parsers.parsley.iocontains extension methods to run parsers with input sourced from IO sources.parsley.exprcontains the following sub modules:parsley.expr.chaincontains combinators used in expression parsingparsley.expr.precedenceis a builder for expression parsers built on a precedence table.parsley.implicitscontains several implicits to add syntactic sugar to the combinators. These are sub-categorised into the following sub modules:parsley.implicits.charactercontains implicits to allow you to use character and string literals as parsers.parsley.implicits.combinatorcontains implicits related to combinators, such as the ability to make any parser into aParsley[Unit]automatically.parsley.implicits.liftenables postfix application of the lift combinator onto a function (or value).parsley.implicits.zippedenables 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.zippedmethod for building tuples out of several combinators.parsley.errorscontains modules to deal with error messages, their refinement and generation.parsley.errors.combinatorprovides combinators that can be used to either produce more detailed errors as well as refine existing errors.parsley.liftcontains 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.registerscontains combinators that interact with the context-sensitive functionality in the form of registers.parsley.tokencontains theLexerclass that provides a host of helpful lexing combinators when provided with the description of a language.parsley.unsafecontains unsafe (and not thread-safe) ways of speeding up the execution of a parser.