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.
    • 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.extension contains syntactic sugar combinators exposed as implicit classes.
    • parsley.io contains extension methods to run parsers with input sourced from IO sources.
    • parsley.expr contains the following sub modules:
      • parsley.expr.chain contains combinators used in expression parsing
      • parsley.expr.precedence is a builder for expression parsers built on a precedence table.
      • parsley.expr.infix contains combinators used in expression parsing, but with more permissive types than their equivalents in chain.
      • parsley.expr.mixed contains combinators that can be used for expression parsing, but where different fixities may be mixed on the same level: this is rare in practice.
    • 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.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.ap contains functions which allow for the application of a parser returning a function to several parsers returning each of the argument types.
    • 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.genericbridges contains some basic implementations of the Parser Bridge pattern (see Design Patterns for Parser Combinators in Scala, or the parsley wiki): these can be used before more specialised generic bridge traits can be constructed.
    Definition Classes
    root
  • package parsley
    Definition Classes
    root
  • package implicits

    This package contains various functionality that involve Scala's implicits mechanism.

    This package contains various functionality that involve Scala's implicits mechanism.

    This includes conversions from scala literals into parsers, as well as enabling new syntax on regular Scala values (such as Parsley's lift or zipped syntax). Automatic conversion to Parsley[Unit] is also supported within this package.

    Definition Classes
    parsley
  • object lift

    This module provides the "lift syntax", which enables a lift combinator on functions of arities up to 22, applying the function across the results of several parsers.

    This module provides the "lift syntax", which enables a lift combinator on functions of arities up to 22, applying the function across the results of several parsers.

    Definition Classes
    implicits
    Example:
    1. scala> import parsley.character.char
      scala> import parsley.implicits.lift.{Lift2, Lift3}
      scala> case class Add(x: Int, y: Int)
      scala> val p = Add.lift(char('a') #> 4, char('b') #> 5)
      scala> p.parse("ab")
      val res0 = Success(Add(4, 5))
      scala> val f = (x: Int, y: Int, z: Int) => x * y + z
      scala> val q = f.lift(char('a') #> 3, char('b') #> 2, char('c') #> 5)
      scala> q.parse("abc")
      val res1 = Success(11)
      scala> q.parse("ab")
      val res2 = Failure(..)
    Since

    3.0.0

    Note

    a limitation of this syntax is that it requires the function's type to be fully known. For a version of this syntax that behaves better with type inference, see zipped.

  • Lift0
  • Lift1
  • Lift10
  • Lift11
  • Lift12
  • Lift13
  • Lift14
  • Lift15
  • Lift16
  • Lift17
  • Lift18
  • Lift19
  • Lift2
  • Lift20
  • Lift21
  • Lift22
  • Lift3
  • Lift4
  • Lift5
  • Lift6
  • Lift7
  • Lift8
  • Lift9

implicit final class Lift2[T1, T2, R] extends AnyVal

This class enables the lift syntax on functions of arity two.

Source
lift.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Lift2
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Lift2(f: (T1, T2) => R)

    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.

    f

    the function to apply to the parsers.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  6. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  7. def lift(p1: Parsley[T1], p2: => Parsley[T2]): Parsley[R]

    This combinator executes each of its argument parsers in turn and applies this function to their results.

    This combinator executes each of its argument parsers in turn and applies this function to their results.

    Each of the given parsers is executed in sequence, each yielding a result. So long as every parser succeeded, the whole combinator succeeds and each of the results is fed into this function. The result of this application is returned by the combinator. If any of the given parsers fails then the whole combinator fails.

    returns

    a parser that applies this function to the results of all the given parsers.

    See also

    lift2

  8. def toString(): String
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped