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, as well as the implicit classes which enable the "method-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.expr contains the following sub modules:
    • parsley.implicits contains several implicits to add syntactic sugar to the combinators, such as being able to use character and string literals directly as parsers, as well as enabling lifting of functions to work on parsers.
    • 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.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.unsafe contains unsafe (and not thread-safe) ways of speeding up the execution of a parser.

    In addition to the modules and packages outlined above, this version of Parsley (up to version 3.0), also includes the so-called old-style API, which is deprecated (see the Parsley wiki for a discussion of these differences). You should use the modules described above, and avoid the following:

    • parsley.BitGen
    • parsley.Char
    • parsley.CharSet
    • parsley.Combinator
    • parsley.ExpressionParser
    • parsley.Impl
    • parsley.Implicits
    • parsley.LanguageDef
    • parsley.NotRequired
    • parsley.Parser
    • parsley.Predicate
    • parsley.Reg
    • parsley.TokenParser
    Definition Classes
    root
  • package parsley
    Definition Classes
    root
  • package expr
    Definition Classes
    parsley
  • package token
    Definition Classes
    parsley
  • BitGen
  • Char
  • CharSet
  • Combinator
  • ExpressionParser
  • Failure
  • Impl
  • Implicits
  • LanguageDef
  • NotRequired
  • Parser
  • Parsley
  • Predicate
  • Reg
  • Result
  • Success
  • TokenParser
  • character
  • combinator
  • debug
  • implicits
  • lift
  • registers
  • unsafe
o

parsley

Combinator

object Combinator

Annotations
@deprecated
Deprecated

(Since version v2.2.0) This object will be removed in Parsley 3.0, use parsley.combinator instead

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Combinator
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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 clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Deprecated Value Members

  1. def attemptChoice[A](ps: Parsley[A]*): Parsley[A]

    attemptChoice(ps) tries to apply the parsers in the list ps in order, until one of them succeeds.

    attemptChoice(ps) tries to apply the parsers in the list ps in order, until one of them succeeds. Returns the value of the succeeding parser. Utilises <\> vs choice's <|>.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.attemptChoice instead

  2. def between[A](open: => Parsley[_], close: => Parsley[_], p: => Parsley[A]): Parsley[A]

    between(open, close, p) parses open, followed by p and close.

    between(open, close, p) parses open, followed by p and close. Returns the value returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.between instead

  3. def chainPost[A](p: => Parsley[A], op: => Parsley[(A) => A]): Parsley[A]

    chainPost(p, op) parses one occurrence of p, followed by many postfix applications of op that associate to the left.

    chainPost(p, op) parses one occurrence of p, followed by many postfix applications of op that associate to the left.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.expr.chain.postfix instead

  4. def chainPre[A](op: => Parsley[(A) => A], p: => Parsley[A]): Parsley[A]

    chainPre(op, p) parses many prefixed applications of op onto a single final result of p

    chainPre(op, p) parses many prefixed applications of op onto a single final result of p

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.expr.chain.prefix instead

  5. def chainl[A, B](p: => Parsley[A], op: => Parsley[(B, A) => B], x: B)(implicit wrap: (A) => B): Parsley[B]

    chainl(p, op, x) parses *zero* or more occurrences of p, separated by op.

    chainl(p, op, x) parses *zero* or more occurrences of p, separated by op. Returns a value obtained by a left associative application of all functions returned by op to the values returned by p. If there are no occurrences of p, the value x is returned.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.expr.chain.left instead

  6. def chainl1[A, B](p: => Parsley[A], op: => Parsley[(B, A) => B])(implicit wrap: (A) => B): Parsley[B]

    chainl1(p, op) parses *one* or more occurrences of p, separated by op.

    chainl1(p, op) parses *one* or more occurrences of p, separated by op. Returns a value obtained by a left associative application of all functions return by op to the values returned by p. This parser can for example be used to eliminate left recursion which typically occurs in expression grammars.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.expr.chain.left1 instead

  7. def chainr[A, B](p: => Parsley[A], op: => Parsley[(A, B) => B], x: B)(implicit wrap: (A) => B): Parsley[B]

    chainr(p, op, x) parses *zero* or more occurrences of p, separated by op.

    chainr(p, op, x) parses *zero* or more occurrences of p, separated by op. Returns a value obtained by a right associative application of all functions return by op to the values returned by p. If there are no occurrences of p, the value x is returned.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.expr.chain.right instead

  8. def chainr1[A, B](p: => Parsley[A], op: => Parsley[(A, B) => B])(implicit wrap: (A) => B): Parsley[B]

    chainr1(p, op) parses *one* or more occurrences of p, separated by op.

    chainr1(p, op) parses *one* or more occurrences of p, separated by op. Returns a value obtained by a right associative application of all functions return by op to the values returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.expr.chain.right1 instead

  9. def choice[A](ps: Parsley[A]*): Parsley[A]

    choice(ps) tries to apply the parsers in the list ps in order, until one of them succeeds.

    choice(ps) tries to apply the parsers in the list ps in order, until one of them succeeds. Returns the value of the succeeding parser.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.choice instead

  10. def decide[A](p: => Parsley[Option[A]], q: => Parsley[A]): Parsley[A]

    decide(p, q) removes the option from inside parser p, if it returned None then q is executed.

    decide(p, q) removes the option from inside parser p, if it returned None then q is executed.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.decide instead

  11. def decide[A](p: => Parsley[Option[A]]): Parsley[A]

    decide(p) removes the option from inside parser p, and if it returned None will fail.

    decide(p) removes the option from inside parser p, and if it returned None will fail.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.decide instead

  12. def endBy[A, B](p: => Parsley[A], sep: => Parsley[B]): Parsley[List[A]]

    endBy(p, sep) parses *zero* or more occurrences of p, separated and ended by sep.

    endBy(p, sep) parses *zero* or more occurrences of p, separated and ended by sep. Returns a list of values returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.endBy instead

  13. def endBy1[A, B](p: => Parsley[A], sep: => Parsley[B]): Parsley[List[A]]

    endBy1(p, sep) parses *one* or more occurrences of p, separated and ended by sep.

    endBy1(p, sep) parses *one* or more occurrences of p, separated and ended by sep. Returns a list of values returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.endBy1 instead

  14. val eof: Parsley[Unit]

    This parser only succeeds at the end of the input.

    This parser only succeeds at the end of the input. This is a primitive parser.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.eof instead

  15. def manyN[A](n: Int, p: => Parsley[A]): Parsley[List[A]]

    manyN(n, p) applies the parser p *n* or more times.

    manyN(n, p) applies the parser p *n* or more times. Returns a list of the returned values of p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.manyN instead

  16. def manyUntil[A, B](p: => Parsley[A], end: => Parsley[B]): Parsley[List[A]]

    manyUntil(p, end) applies parser p zero or more times until the parser end succeeds.

    manyUntil(p, end) applies parser p zero or more times until the parser end succeeds. Returns a list of values returned by p. This parser can be used to scan comments.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.manyUntil instead

  17. val more: Parsley[Unit]

    This parser only succeeds if there is still more input.

    This parser only succeeds if there is still more input.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.more instead

  18. def notFollowedBy(p: Parsley[_]): Parsley[Unit]

    notFollowedBy(p) only succeeds when parser p fails.

    notFollowedBy(p) only succeeds when parser p fails. This parser does not consume any input. This parser can be used to implement the 'longest match' rule. For example, when recognising keywords, we want to make sure that a keyword is not followed by a legal identifier character, in which case the keyword is actually an identifier. We can program this behaviour as follows:

    attempt(kw *> notFollowedBy(alphaNum))
    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.Parsley.notFollowedBy instead

  19. def option[A](p: => Parsley[A]): Parsley[Option[A]]

    option(p) tries to apply parser p.

    option(p) tries to apply parser p. If p fails without consuming input, it returns None, otherwise it returns Some of the value returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.option instead

  20. def optional(p: => Parsley[_]): Parsley[Unit]

    optional(p) tries to apply parser p.

    optional(p) tries to apply parser p. It will parse p or nothing. It only fails if p fails after consuming input. It discards the result of p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.optional instead

  21. def optionally[A](p: => Parsley[_], x: => A): Parsley[A]

    optionally(p, x) tries to apply parser p.

    optionally(p, x) tries to apply parser p. It will always result in x regardless of whether or not p succeeded or p failed without consuming input.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.optionally instead

  22. def repeat[A](n: Int, p: => Parsley[A]): Parsley[List[A]]

    repeat(n, p) parses n occurrences of p.

    repeat(n, p) parses n occurrences of p. If n is smaller or equal to zero, the parser is pure(Nil). Returns a list of n values returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.repeat instead

  23. def sepBy[A, B](p: => Parsley[A], sep: => Parsley[B]): Parsley[List[A]]

    sepBy(p, sep) parses *zero* or more occurrences of p, separated by sep.

    sepBy(p, sep) parses *zero* or more occurrences of p, separated by sep. Returns a list of values returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.sepBy instead

  24. def sepBy1[A, B](p: => Parsley[A], sep: => Parsley[B]): Parsley[List[A]]

    sepBy1(p, sep) parses *one* or more occurrences of p, separated by sep.

    sepBy1(p, sep) parses *one* or more occurrences of p, separated by sep. Returns a list of values returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.sepBy1 instead

  25. def sepEndBy[A, B](p: => Parsley[A], sep: => Parsley[B]): Parsley[List[A]]

    sepEndBy(p, sep) parses *zero* or more occurrences of p, separated and optionally ended by sep.

    sepEndBy(p, sep) parses *zero* or more occurrences of p, separated and optionally ended by sep. Returns a list of values returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.sepEndBy instead

  26. def sepEndBy1[A, B](p: => Parsley[A], sep: => Parsley[B]): Parsley[List[A]]

    sepEndBy1(p, sep) parses *one* or more occurrences of p, separated and optionally ended by sep.

    sepEndBy1(p, sep) parses *one* or more occurrences of p, separated and optionally ended by sep. Returns a list of values returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.sepEndBy1 instead

  27. def skipManyN[A](n: Int, p: => Parsley[A]): Parsley[Unit]

    skipManyN(n, p) applies the parser p *n* or more times, skipping its result.

    skipManyN(n, p) applies the parser p *n* or more times, skipping its result.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.skipManyN instead

  28. def skipSome[A](p: => Parsley[A]): Parsley[Unit]

    skipSome(p) applies the parser p *one* or more times, skipping its result.

    skipSome(p) applies the parser p *one* or more times, skipping its result.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.skipSome instead

  29. def some[A](p: => Parsley[A]): Parsley[List[A]]

    some(p) applies the parser p *one* or more times.

    some(p) applies the parser p *one* or more times. Returns a list of the returned values of p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.some instead

  30. def someUntil[A, B](p: => Parsley[A], end: => Parsley[B]): Parsley[List[A]]

    someUntil(p, end) applies parser p one or more times until the parser end succeeds.

    someUntil(p, end) applies parser p one or more times until the parser end succeeds. Returns a list of values returned by p.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.someUntil instead

  31. def when(p: => Parsley[Boolean], q: => Parsley[Unit]): Parsley[Unit]

    when(p, q) will first perform p, and if the result is true will then execute q or else return unit.

    when(p, q) will first perform p, and if the result is true will then execute q or else return unit.

    p

    The first parser to parse

    q

    If p returns true then this parser is executed

    returns

    ()

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.when instead

  32. def whileP(p: => Parsley[Boolean]): Parsley[Unit]

    whileP(p) will continue to run p until it returns false.

    whileP(p) will continue to run p until it returns false. This is often useful in conjunction with stateful parsers.

    p

    The parser to continuously execute

    returns

    ()

    Annotations
    @deprecated
    Deprecated

    (Since version v2.2.0) This method will be removed in Parsley 3.0, use parsley.combinator.whileP instead

Inherited from AnyRef

Inherited from Any

Ungrouped