parsley.syntax

package parsley.syntax

Members list

Type members

Classlikes

final class HaskellStyleMap[-A, +B] extends AnyVal

This class exposes the <#> combinator on functions.

This class exposes the <#> combinator on functions.

This extension class operates on functions. It enables the use of the <#> combinator, which is an alias for map designed to more closely mimic Haskell's style.

Attributes

Source
extension.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class LazyChooseParsley[+A]

This class exposes an if combinator on pairs of parsers.

This class exposes an if combinator on pairs of parsers.

This extension class operators on pairs of values that are convertible to parsers. It enables the use of the ?: combinator, which is an alias for ifP.

Attributes

Source
extension.scala
Supertypes
class Object
trait Matchable
class Any
final class Lift0[R] extends AnyVal

This class implements the lift syntax on any value, which functions as pure as a postfix method.

This class implements the lift syntax on any value, which functions as pure as a postfix method.

Value parameters

x

the value to lift to the parser level.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift1[T1, R] extends AnyVal

This class enables the lift syntax on functions of arity one: a flipped map.

This class enables the lift syntax on functions of arity one: a flipped map.

Value parameters

f

the function to apply to the result of the parser.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift2[T1, T2, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R] extends AnyVal

This class enables the lift syntax on functions of arity twenty-one.

This class enables the lift syntax on functions of arity twenty-one.

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift3[T1, T2, T3, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift4[T1, T2, T3, T4, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift5[T1, T2, T3, T4, T5, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift6[T1, T2, T3, T4, T5, T6, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift7[T1, T2, T3, T4, T5, T6, T7, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift8[T1, T2, T3, T4, T5, T6, T7, T8, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Lift9[T1, T2, T3, T4, T5, T6, T7, T8, T9, R] extends AnyVal

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

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

Value parameters

f

the function to apply to the parsers.

Attributes

Source
lift.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class OperatorSugar[+A]

This class enables "operator-style" alternative combinators on parsers.

This class enables "operator-style" alternative combinators on parsers.

This extension class exposes a collection of "operator-style" combinators on values that are convertible to parsers that are plain syntactic sugar for other functionality in the library; they are potentially less readable than the combinators they replace, so should be used sparingly.

Attributes

Since

4.0.0

Source
extension.scala
Supertypes
class Object
trait Matchable
class Any
final class Zipped10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10] extends AnyVal

This class enables the zipped syntax on tuples of ten parsers.

This class enables the zipped syntax on tuples of ten parsers.

Value parameters

t

the ten parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11] extends AnyVal

This class enables the zipped syntax on tuples of eleven parsers.

This class enables the zipped syntax on tuples of eleven parsers.

Value parameters

t

the eleven parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12] extends AnyVal

This class enables the zipped syntax on tuples of twelve parsers.

This class enables the zipped syntax on tuples of twelve parsers.

Value parameters

t

the twelve parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13] extends AnyVal

This class enables the zipped syntax on tuples of thirteen parsers.

This class enables the zipped syntax on tuples of thirteen parsers.

Value parameters

t

the thirteen parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14] extends AnyVal

This class enables the zipped syntax on tuples of fourteen parsers.

This class enables the zipped syntax on tuples of fourteen parsers.

Value parameters

t

the fourteen parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15] extends AnyVal

This class enables the zipped syntax on tuples of fifteen parsers.

This class enables the zipped syntax on tuples of fifteen parsers.

Value parameters

t

the fifteen parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16] extends AnyVal

This class enables the zipped syntax on tuples of sixteen parsers.

This class enables the zipped syntax on tuples of sixteen parsers.

Value parameters

t

the sixteen parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17] extends AnyVal

This class enables the zipped syntax on tuples of seventeen parsers.

This class enables the zipped syntax on tuples of seventeen parsers.

Value parameters

t

the seventeen parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18] extends AnyVal

This class enables the zipped syntax on tuples of eighteen parsers.

This class enables the zipped syntax on tuples of eighteen parsers.

Value parameters

t

the eighteen parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19] extends AnyVal

This class enables the zipped syntax on tuples of nineteen parsers.

This class enables the zipped syntax on tuples of nineteen parsers.

Value parameters

t

the nineteen parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped2[T1, T2] extends AnyVal

This class enables the zipped syntax on pairs of two parsers.

This class enables the zipped syntax on pairs of two parsers.

Value parameters

t

the two parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20] extends AnyVal

This class enables the zipped syntax on tuples of twenty parsers.

This class enables the zipped syntax on tuples of twenty parsers.

Value parameters

t

the twenty parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21] extends AnyVal

This class enables the zipped syntax on tuples of twenty-one parsers.

This class enables the zipped syntax on tuples of twenty-one parsers.

Value parameters

t

the twenty-one parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22] extends AnyVal

This class enables the zipped syntax on tuples of twenty-two parsers.

This class enables the zipped syntax on tuples of twenty-two parsers.

Value parameters

t

the twenty-two parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped3[T1, T2, T3] extends AnyVal

This class enables the zipped syntax on tuples of three parsers.

This class enables the zipped syntax on tuples of three parsers.

Value parameters

t

the three parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped4[T1, T2, T3, T4] extends AnyVal

This class enables the zipped syntax on tuples of four parsers.

This class enables the zipped syntax on tuples of four parsers.

Value parameters

t

the four parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped5[T1, T2, T3, T4, T5] extends AnyVal

This class enables the zipped syntax on tuples of five parsers.

This class enables the zipped syntax on tuples of five parsers.

Value parameters

t

the five parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped6[T1, T2, T3, T4, T5, T6] extends AnyVal

This class enables the zipped syntax on tuples of six parsers.

This class enables the zipped syntax on tuples of six parsers.

Value parameters

t

the six parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped7[T1, T2, T3, T4, T5, T6, T7] extends AnyVal

This class enables the zipped syntax on tuples of seven parsers.

This class enables the zipped syntax on tuples of seven parsers.

Value parameters

t

the seven parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped8[T1, T2, T3, T4, T5, T6, T7, T8] extends AnyVal

This class enables the zipped syntax on tuples of eight parsers.

This class enables the zipped syntax on tuples of eight parsers.

Value parameters

t

the eight parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
final class Zipped9[T1, T2, T3, T4, T5, T6, T7, T8, T9] extends AnyVal

This class enables the zipped syntax on tuples of nine parsers.

This class enables the zipped syntax on tuples of nine parsers.

Value parameters

t

the nine parsers whose results should be zipped together.

Attributes

Source
zipped.scala
Supertypes
class AnyVal
trait Matchable
class Any
object all

Attributes

Source
all.scala
Supertypes
class Object
trait Matchable
class Any
Self type
all.type
object character

Provides implicit conversions for characters and strings into parsers.

Provides implicit conversions for characters and strings into parsers.

The use of char and string can be distracting to the overall structure of the parser with respect to the grammar. This module exposes combinators that can implicitly convert Scala's string and character literals so that they represent parsers. These will not be whitespace sensitive.

Attributes

Since

4.5.0

Source
character.scala
Supertypes
class Object
trait Matchable
class Any
Self type
character.type
object extension

These implicit classes can be used to extend the core combinator set of Parsley.

These implicit classes can be used to extend the core combinator set of Parsley.

This may mean that importing them enables combinators that can be used on non-Parsley types, or might enable some syntactic sugar that is not part of the core combinator "style".

Attributes

Since

4.5.0

Source
extension.scala
Supertypes
class Object
trait Matchable
class Any
Self type
extension.type
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.

Attributes

Since

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

Example

scala> import parsley.character.char
scala> import parsley.syntax.lift.{liftSyntax2, liftSyntax3}
scala> case class Add(x: Int, y: Int)
scala> val p = Add.lift(char('a').as(4), char('b').as(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').as(3), char('b').as(2), char('c').as(5))
scala> q.parse("abc")
val res1 = Success(11)
scala> q.parse("ab")
val res2 = Failure(..)
Source
lift.scala
Supertypes
class Object
trait Matchable
class Any
Self type
lift.type
object zipped

This module provides alternatives to the f.lift(x, y) syntax, (x, y).zipped(f), which works better with type inference.

This module provides alternatives to the f.lift(x, y) syntax, (x, y).zipped(f), which works better with type inference.

Also enables a parameterless zipped method, to pair an arbitrary number of parsers such that (p, q).zipped = p.zip(q).

Thanks to Andrei Gramescu and George Stacey for ensuring that these combinators even exist in the first place.

Attributes

Since

4.5.0

Note

these methods are not lazy like the lift syntax or liftN functions! Use the prefix ~ combinator to make arguments lazy where necessary.

Example

scala> import parsley.character.char
scala> import parsley.syntax.zipped._
scala> case class Add(x: Int, y: Int)
scala> val p = (char('a').as(4), char('b').as(5)).zipped(Add)
scala> p.parse("ab")
val res0 = Success(Add(4, 5))
scala> val q = (char('a').as(3), char('b').as(2), char('c').as(5)).zipped((x, y, z) => x * y + z)
scala> q.parse("abc")
val res1 = Success(11)
scala> q.parse("ab")
val res2 = Failure(..)
Source
zipped.scala
Supertypes
class Object
trait Matchable
class Any
Self type
zipped.type