object Parsley

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. All

Type Members

  1. implicit final class LazyChooseParsley[P, +A] extends AnyRef
  2. implicit final class LazyMapParsley[A, +B] extends AnyRef
  3. implicit final class LazyParsley[P, +A] extends AnyRef

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( ... ) @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: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def fail(msg: String): Parsley[Nothing]

    The fail(msg) parser consumes no input and fails with msg as the error message

  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def get[S](v: Var)(implicit ev: =!=[S, Nothing]): 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 v (this will result in a runtime type-check)

    v

    The index of the register to collect from

    returns

    The value stored in register v of type S

    Note

    There are only 4 registers at present.

  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def gets[S, A](v: Var, 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 v (this will result in a runtime type-check)

    A

    The desired result type

    v

    The index of the register to collect from

    pf

    The parser which provides the function to transform values

    returns

    The value stored in register v applied to f from pf

    Note

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

  17. def gets[S, A](v: Var, 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 v (this will result in a runtime type-check)

    A

    The desired result type

    v

    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 v applied to f

    Note

    There are only 4 registers at present.

  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. 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.

  21. def label[A](p: Parsley[A], msg: String): Parsley[A]

    Alias for p ? msg.

  22. def lift1[A, B](f: (A) ⇒ B, p: ⇒ Parsley[A]): Parsley[B]

    lift(f, p) is an alias for p.map(f).

    lift(f, p) is an alias for p.map(f). It is provided for symmetry with lift2 and lift3

  23. def lift2[A, B, C](f: (A, B) ⇒ C, p: ⇒ Parsley[A], q: ⇒ Parsley[B]): Parsley[C]

    Traditionally, lift2 is defined as lift2(f, p, q) = p.map(f) <*> q.

    Traditionally, lift2 is defined as lift2(f, p, q) = p.map(f) <*> q. However, f is actually uncurried, so it's actually more exactly defined as; read p and then read q then provide their results to function f. This is designed to bring higher performance to any curried operations that are not themselves intrinsic.

    f

    The function to apply to the results of p and q

    p

    The first parser to parse

    q

    The second parser to parse

    returns

    f(x, y) where x is the result of p and y is the result of q.

  24. def lift3[A, B, C, D](f: (A, B, C) ⇒ D, p: ⇒ Parsley[A], q: ⇒ Parsley[B], r: ⇒ Parsley[C]): Parsley[D]

    Traditionally, lift2 is defined as lift3(f, p, q, r) = p.map(f) <*> q <*> r.

    Traditionally, lift2 is defined as lift3(f, p, q, r) = p.map(f) <*> q <*> r. However, f is actually uncurried, so it's actually more exactly defined as; read p and then read q and then read 'r' then provide their results to function f. This is designed to bring higher performance to any curried operations that are not themselves intrinsic.

    f

    The function to apply to the results of p and q

    p

    The first parser to parse

    q

    The second parser to parse

    r

    The third parser to parse

    returns

    f(x, y, z) where x is the result of p, y is the result of q and z is the result of r.

  25. 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

  26. def local[R, A](v: Var, f: (R) ⇒ R, p: ⇒ Parsley[A]): Parsley[A]

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

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

    v

    The index of the register to modify

    f

    The function used to modify the value in register v

    p

    The parser to execute with the adjusted state

    returns

    The parser that performs p with the modified state

    Note

    There are only 4 registers at present.

  27. def local[R, A](v: Var, p: ⇒ Parsley[R], q: ⇒ Parsley[A]): Parsley[A]

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

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

    v

    The index of the register to modify

    p

    The parser whose return value is placed in register v

    q

    The parser to execute with the adjusted state

    returns

    The parser that performs q with the modified state

    Note

    There are only 4 registers at present.

  28. def local[R, A](v: Var, x: R, p: ⇒ Parsley[A]): Parsley[A]

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

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

    v

    The index of the register to modify

    x

    The value to place in the register v

    p

    The parser to execute with the adjusted state

    returns

    The parser that performs p with the modified state

    Note

    There are only 4 registers at present.

  29. 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

  30. def many[A](p: ⇒ Parsley[A]): Parsley[List[A]]

    many(p) executes the parser p zero or more times.

    many(p) executes the parser p zero or more times. Returns a list of the returned values of p.

  31. def modify[S](v: Var, f: (S) ⇒ S): Parsley[Unit]

    Modifies the value contained in register v using function f.

    Modifies the value contained in register v using function f. It is left to the users responsibility to ensure the types line up. There is no compile-time type checking enforced!

    S

    The type of value currently assumed to be in the register

    v

    The index of the register to modify

    f

    The function used to modify the register

    Note

    There are only 4 registers at present.

  32. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  33. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  34. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  35. 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

  36. 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

  37. def put[S](v: Var, p: ⇒ Parsley[S]): Parsley[Unit]

    Places the result of running p into register v.

    Places the result of running p into register v.

    v

    The index of the register to place the value in

    p

    The parser to derive the value from

    Note

    There are only 4 registers at present.

  38. def put[S](v: Var, x: S): Parsley[Unit]

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

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

    v

    The index of the register to place the value in

    x

    The value to place in the register

    Note

    There are only 4 registers at present.

  39. 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

  40. 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

  41. 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

  42. def skipMany[A](p: ⇒ Parsley[A]): Parsley[Unit]

    skipMany(p) executes the parser p zero or more times and ignores the results.

    skipMany(p) executes the parser p zero or more times and ignores the results. Returns ()

  43. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  44. def toString(): String
    Definition Classes
    AnyRef → Any
  45. 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

  46. def unexpected(msg: String): Parsley[Nothing]

    The unexpected(msg) parser consumes no input and fails with msg as an unexpected error

  47. val unit: Parsley[Unit]

    Returns ().

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

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

    converts a parser's result to ()

  49. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped