implicit final class RegisterMethods[P, A] extends AnyRef
This class, when in scope, enables the use of combinators directly on parsers that interact with the register system to store and persist results so they can be used multiple times.
- Source
- registers.scala
- Alphabetic
- By Inheritance
- RegisterMethods
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RegisterMethods(p: P)(implicit con: (P) => Parsley[A])
This constructor should not be called manually, it is designed to be used via Scala's implicit resolution.
This constructor should not be called manually, it is designed to be used via Scala's implicit resolution.
- p
the value that this class is enabling methods on.
- con
a conversion that allows values convertible to parsers to be used.
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 fillReg[B](body: (Reg[A]) => Parsley[B]): Parsley[B]
This combinator fills a fresh register with the result of this parser, this register is provided to the given function, which continues the parse.
This combinator fills a fresh register with the result of this parser, this register is provided to the given function, which continues the parse.
This allows for a more controlled way of creating registers during a parse, without explicitly creating them with
Reg.make[A]and usingput. These registers are intended to be fresh every time they are "created", in other words, a recursive call with afillRegcall inside will modify a different register each time.- body
a function to generate a parser that can interact with the freshly created register.
// this is an efficient implementation for persist. def persist[B](f: Parsley[A] => Parsley[B]): Parsley[B] = this.fillReg(reg => f(reg.get))
- Since
4.0.0
Example: - def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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 persist[B](f: (Parsley[A]) => Parsley[B]): Parsley[B]
This combinator allows for the result of this parser to be used multiple times within a function, without needing to reparse or recompute.
This combinator allows for the result of this parser to be used multiple times within a function, without needing to reparse or recompute.
Similar to
flatMap, except it is much cheaper to do, at the cost of the restriction that the argument isParsley[A]and not justA.- f
a function to generate a new parser that can observe the result of this parser many times without reparsing.
// this is a reasonable implementation, though direct use of `branch` may be more efficent. def filter(pred: A => Boolean): Parsley[A] = { this.persist(px => ifP(px.map(pred), px, empty)) }
- Since
3.2.0
Example: - 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()