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.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.syntax contains several implicits to add syntactic sugar to the combinators. These are sub-categorised into the following sub modules:
      • parsley.syntax.character contains implicits to allow you to use character and string literals as parsers.
      • parsley.syntax.lift enables postfix application of the lift combinator onto a function (or value).
      • parsley.syntax.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.syntax.extension contains syntactic sugar combinators exposed as implicit classes.
    • 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.state contains combinators that interact with the context-sensitive functionality in the form of state.
    • parsley.token contains the Lexer class that provides a host of helpful lexing combinators when provided with the description of a language.
    • parsley.position contains parsers for extracting position information.
    • parsley.generic 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 errors

    This package contains various functionality relating to the generation and formatting of error messages.

    This package contains various functionality relating to the generation and formatting of error messages.

    In particular, it includes a collection of combinators for improving error messages within the parser, including labelling and providing additional information. It also contains combinators that can be used to valid data produced by a parser, to ensure it conforms to expected invariances, producing good quality error messages if this is not the case. Finally, this package contains ways of changing the formatting of error messages: this can either be changing how the default String-based errors are formatted, or by injectiing Parsley's errors into a custom error object.

    Definition Classes
    parsley
  • package expr

    This package contains various functionality relating to the parsing of expressions..

    This package contains various functionality relating to the parsing of expressions..

    This includes the "chain" combinators, which tackle the left-recursion problem and allow for the parsing and combining of operators with values. It also includes functionality for constructing larger precedence tables, which may even vary the type of each layer in the table, allowing for strongly-typed expression parsing.

    Definition Classes
    parsley
  • Failure
  • Parsley
  • PlatformSpecific
  • Result
  • Success
  • ap
  • character
  • combinator
  • debug
  • generic
  • lift
  • position
  • quick
  • state
  • unicode
  • package syntax

    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
  • package token

    This package provides a wealth of functionality for performing common lexing tasks.

    This package provides a wealth of functionality for performing common lexing tasks.

    It is organised as follows:

    • the main parsing functionality is accessed via Lexer, which provides implementations for the combinators found in the sub-packages given a LexicalDesc.
    • the descriptions sub-package is how a lexical structure can be described, providing the configuration that alters the behaviour of the parsers produced by the Lexer.
    • the other sub-packages contain the high-level interfaces that the Lexer exposes, which can be used to pass whitespace-aware and non-whitespace-aware combinators around in a uniform way.
    • the predicate module contains functionality to help define boolean predicates on characters or unicode codepoints.
    Definition Classes
    parsley

object quick extends ParsleyImpl with combinator with character with position with lift with ap

This serves as a quick way of importing everything from Parsley, character, position, lift, and ap. Other packages are not included in this, but this should be a good baseline for any non-lexing/expression parsing work.

Source
quick.scala
Since

5.0.0

Linear Supertypes
ap, lift, position, character, combinator, ParsleyImpl, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. quick
  2. ap
  3. lift
  4. position
  5. character
  6. combinator
  7. ParsleyImpl
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type Parsley[+A] = parsley.Parsley[A]

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 ap1[T1, R](pf: parsley.Parsley[(T1) => R], p1: => parsley.Parsley[T1]): parsley.Parsley[R]

    This combinator allows the function that results from one parser to be applied to the result of another parser.

    This combinator allows the function that results from one parser to be applied to the result of another parser.

    Effectively alias for <*>, to be consistent with the other ap variants.

    pf

    the parser whose result is a function to map across the result of p1.

    returns

    a parser that applies the function f resulting from pf to the result x of the parser p1.

    Definition Classes
    ap
  5. final def ap10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity ten.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  6. final def ap11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity eleven.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  7. final def ap12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity twelve.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  8. final def ap13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity thirteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  9. final def ap14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity fourteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  10. final def ap15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity fifteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  11. final def ap16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity sixteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  12. final def ap17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity seventeen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  13. final def ap18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity eighteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  14. final def ap19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18], p19: => parsley.Parsley[T19]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity nineteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  15. final def ap2[T1, T2, R](pf: parsley.Parsley[(T1, T2) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity two.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  16. final def ap20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18], p19: => parsley.Parsley[T19], p20: => parsley.Parsley[T20]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity twenty.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  17. final def ap21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18], p19: => parsley.Parsley[T19], p20: => parsley.Parsley[T20], p21: => parsley.Parsley[T21]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity twenty-one.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  18. final def ap22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18], p19: => parsley.Parsley[T19], p20: => parsley.Parsley[T20], p21: => parsley.Parsley[T21], p22: => parsley.Parsley[T22]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity twenty-two.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  19. final def ap3[T1, T2, T3, R](pf: parsley.Parsley[(T1, T2, T3) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity three.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  20. final def ap4[T1, T2, T3, T4, R](pf: parsley.Parsley[(T1, T2, T3, T4) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity four.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  21. final def ap5[T1, T2, T3, T4, T5, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity five.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  22. final def ap6[T1, T2, T3, T4, T5, T6, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity six.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  23. final def ap7[T1, T2, T3, T4, T5, T6, T7, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity seven.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  24. final def ap8[T1, T2, T3, T4, T5, T6, T7, T8, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity eight.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  25. final def ap9[T1, T2, T3, T4, T5, T6, T7, T8, T9, R](pf: parsley.Parsley[(T1, T2, T3, T4, T5, T6, T7, T8, T9) => R], p1: => parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    This combinator applies the given parsers in sequence and then applies the function returned by pf of to all of the results of the other parsers.

    Firstly, each parser is parsed in turn, each producing a result (and the first, a function f). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    pf

    a parser that returns a function to apply to the results of the parsers with arity nine.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    ap
  26. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  27. final def atomic[A](p: parsley.Parsley[A]): parsley.Parsley[A]

    This combinator parses its argument p, but rolls back any consumed input on failure.

    This combinator parses its argument p, but rolls back any consumed input on failure.

    If the parser p succeeds, then atomic(p) has no effect. However, if p failed, then any input that it consumed is rolled back. This ensures that the parser p is all-or-nothing when consuming input. While there are many legimate uses for all-or-nothing behaviour, one notable, if discouraged, use is to allow the <|> combinator to backtrack -- recall it can only parse its alternative if the first failed without consuming input. This is discouraged, however, as it can affect the complexity of the parser and harm error messages.

    p

    the parser to execute, if it fails, it will not have consumed input.

    returns

    a parser that tries p, but never consumes input if it fails.

    Definition Classes
    ParsleyImpl
    Example:
    1. scala> import parsley.character.string, parsley.Parsley.atomic
      scala> (string("abc") <|> string("abd")).parse("abd")
      val res0 = Failure(..) // first parser consumed a, so no backtrack
      scala> (atomic(string("abc")) <|> string("abd")).parse("abd")
      val res1 = Success("abd") // first parser does not consume input on failure now
    Since

    4.4.0

  28. final val bit: parsley.Parsley[Char]

    This parser tries to parse a binary digit (bit) and returns it if successful.

    This parser tries to parse a binary digit (bit) and returns it if successful.

    A bit is either '0' or '1'.

    Definition Classes
    character
  29. final def branch[A, B, C](either: parsley.Parsley[Either[A, B]], left: => parsley.Parsley[(A) => C], right: => parsley.Parsley[(B) => C]): parsley.Parsley[C]

    This combinator parses its first argument either, and then parses either left or right depending on its result.

    This combinator parses its first argument either, and then parses either left or right depending on its result.

    First, branch(either, left, right) parses either, which, if successful, will produce either a Left(x) or a Right(y). If a Left(x) is produced, the parser left is executed to produce a function f, and f(x) is returned. Otherwise, if a Right(y) is produced, the parser right is executed to produce a function g, and g(y) is returned. If either of the two executed parsers fail, the entire combinator fails.

    First introduced in Selective Applicative Functors (Mokhov et al. 2019).

    either

    the first parser to execute, its result decides which parser to execute next.

    left

    a parser to execute if either returns a Left.

    right

    a parser to execute if either returns a Right.

    returns

    a parser that will parse one of left or right depending on either's result.

    Definition Classes
    ParsleyImpl
    Example:
    1. def ifP[A](b: Parsley[Boolean], t: =>Parsley[A], e: =>Parsley[A]): Parsley[A] = {
          val cond = b.map {
              case true => Left(())
              case false => Right(())
          }
          branch(cond, t.map[Unit => A](x => _ => x), e.map[Unit => A](x => _ => x))
      }
  30. final def char(c: Char): parsley.Parsley[Char]

    This combinator tries to parse a single specific character c from the input.

    This combinator tries to parse a single specific character c from the input.

    Attempts to read the given character c from the input stream at the current position. If this character can be found, it is consumed and returned. Otherwise, no input is consumed and this combinator will fail.

    c

    the character to parse

    returns

    a parser that tries to read a single c, or fails.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.char
      scala> char('a').parse("")
      val res0 = Failure(..)
      scala> char('a').parse("a")
      val res1 = Success('a')
      scala> char('a').parse("ba")
      val res2 = Failure(..)
    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using string or unicode.char.

  31. final def choice[A](ps: parsley.Parsley[A]*): parsley.Parsley[A]

    This combinator tries to parse each of the parsers ps in order, until one of them succeeds.

    This combinator tries to parse each of the parsers ps in order, until one of them succeeds.

    Finds the first parser in ps which succeeds, returning its result. If none of the parsers succeed, then this combinator fails. If a parser fails having consumed input, this combinator fails immediately.

    ps

    the parsers to try, in order.

    returns

    a parser that tries to parse one of ps.

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.combinator.choice
      scala> import parsley.character.string
      scala> val p = choice(string("abc"), string("ab"), string("bc"), string("d"))
      scala> p.parse("abc")
      val res0 = Success("abc")
      scala> p.parse("ab")
      val res1 = Failure(..)
      scala> p.parse("bc")
      val res2 = Success("bc")
      scala> p.parse("x")
      val res3 = Failure(..)
    See also

    <|>

  32. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  33. final val col: parsley.Parsley[Int]

    This parser returns the current column number (starting at 1) of the input without having any other effect.

    This parser returns the current column number (starting at 1) of the input without having any other effect.

    When this combinator is ran, no input is required, nor consumed, and the current column number will always be successfully returned. It has no other effect on the state of the parser.

    returns

    a parser that returns the column number the parser is currently at.

    Definition Classes
    position
    Example:
    1. scala> import parsley.position.col, parsley.character.char
      scala> col.parse("")
      val res0 = Success(1)
      scala> (char('a') *> col).parse("a")
      val res0 = Success(2)
      scala> (char('\n') *> col).parse("\n")
      val res0 = Success(1)
    Note

    in the presence of wide unicode characters, the value returned may be inaccurate.

  34. final def count(min: Int, max: Int)(p: parsley.Parsley[_]): parsley.Parsley[Int]

    This combinator parses between min and max occurrences of p, returning the number of successes.

    This combinator parses between min and max occurrences of p, returning the number of successes.

    Parses p repeatedly a minimum of min times and up to max times both inclusive. If p fails before min is reached, then this combinator fails. It is not required for p to fail after the maxth parse. The results are discarded and the number of successful parses of p, n, is returned instead, such that min <= n <= max.

    min

    the minimum number of times to repeat p, inclusive.

    max

    the maximum number of times to repeat p, inclusive.

    p

    the parser to repeat.

    returns

    the number of times p parsed successfully.

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.character.item
      scala> import parsley.combinator.count
      scala> val p = count(min=3, max=5)(item)
      scala> p.parse("ab")
      val res0 = Failure(..)
      scala> p.parse("abc")
      val res1 = Success(3)
      scala> p.parse("abcd")
      val res2 = Success(4)
      scala> p.parse("abcde")
      val res2 = Success(5)
      scala> p.parse("abcdef")
      val res2 = Success(5)
    Since

    4.4.0

  35. final def countMany(p: parsley.Parsley[_]): parsley.Parsley[Int]

    This combinator repeatedly parses a given parser zero or more times, returning how many times it succeeded.

    This combinator repeatedly parses a given parser zero or more times, returning how many times it succeeded.

    Parses a given parser, p, repeatedly until it fails. If p failed having consumed input, this combinator fails. Otherwise when p fails without consuming input, this combinator will succeed. The number of times p succeeded is returned as the result.

    p

    the parser to execute multiple times.

    returns

    the number of times p successfully parses

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.character.string
      scala> import parsley.combinator.countMany
      scala> val p = countMany(string("ab"))
      scala> p.parse("")
      val res0 = Success(0)
      scala> p.parse("ab")
      val res1 = Success(1)
      scala> p.parse("abababab")
      val res2 = Success(4)
      scala> p.parse("aba")
      val res3 = Failure(..)
    Since

    4.5.0

  36. final def countSome(p: parsley.Parsley[_]): parsley.Parsley[Int]

    This combinator repeatedly parses a given parser one or more times, returning how many times it succeeded.

    This combinator repeatedly parses a given parser one or more times, returning how many times it succeeded.

    Parses a given parser, p, repeatedly until it fails. If p failed having consumed input, this combinator fails. Otherwise when p fails without consuming input, this combinator will succeed. The parser p must succeed at least once. The number of times p succeeded is returned as the result.

    p

    the parser to execute multiple times.

    returns

    the number of times p successfully parses

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.character.string
      scala> import parsley.combinator.countSome
      scala> val p = countSome(string("ab"))
      scala> p.parse("")
      val res0 = Failure(..)
      scala> p.parse("ab")
      val res1 = Success(1)
      scala> p.parse("abababab")
      val res2 = Success(4)
      scala> p.parse("aba")
      val res3 = Failure(..)
    Since

    4.5.0

  37. final val crlf: parsley.Parsley[Char]

    This parser tries to parse a CRLF newline character pair, returning '\n' if successful.

    This parser tries to parse a CRLF newline character pair, returning '\n' if successful.

    A CRLF character is the pair of carriage return ('\r') and line feed ('\n'). These two characters will be parsed together or not at all. The parser is made atomic using atomic.

    Definition Classes
    character
  38. final def decide[A](p: parsley.Parsley[Option[A]], q: => parsley.Parsley[A]): parsley.Parsley[A]

    This combinator parses q depending only if p returns a None.

    This combinator parses q depending only if p returns a None.

    First parses p. If p returned Some(x), then x is returned. Otherwise, if p returned None then q is parsed, producing y, and y is returned. If p or q fails, the combinator fails.

    p

    the first parser, which returns an Option to eliminate.

    q

    a parser to execute when p returns None, to provide a value of type A.

    returns

    a parser that either just parses p or both p and q in order to return an A.

    Definition Classes
    combinator
    Example:
    1. decide(option(p), q) = p <|> q
  39. final def decide[A](p: parsley.Parsley[Option[A]]): parsley.Parsley[A]

    This combinator can eliminate an Option from the result of the parser p.

    This combinator can eliminate an Option from the result of the parser p.

    First parse p, if it succeeds returning Some(x), then return x. However, if p fails, or returned None, then this combinator fails.

    p

    the parser to parse and extract the result from.

    returns

    a parser that tries to extract the result from p.

    Definition Classes
    combinator
    Example:
    1. decide(option(p)) = p
  40. final val digit: parsley.Parsley[Char]

    This parser tries to parse a digit, and returns it if successful.

    This parser tries to parse a digit, and returns it if successful.

    A digit is any character c <= '\uffff' whose Unicode Category Type is Decimal Number (Nd). Examples of (inclusive) ranges within this category include:

    • the Latin digits '0' through '9'
    • the Arabic-Indic digits '\u0660' through '\u0669'
    • the Extended Arabic-Indic digits '\u06f0' through '\u06f9'
    • the Devangari digits '\u0966' through '\u096f'
    • the Fullwidth digits '\uff10' through '\uff19'

    The full list of codepoints found in a category can be found in the Unicode Character Database.

    Definition Classes
    character
  41. final def empty(caretWidth: Int): parsley.Parsley[Nothing]

    This combinator fails immediately, with a caret of the given width and no other information.

    This combinator fails immediately, with a caret of the given width and no other information.

    By producing basically no information, this combinator is principally for adjusting the caret-width of another error, rather than the value empty, which is used to fail with no effect on error content.

    caretWidth

    the width of the caret for the error produced by this combinator.

    returns

    a parser that fails.

    Definition Classes
    ParsleyImpl
    Since

    4.4.0

  42. final val empty: parsley.Parsley[Nothing]

    This parser fails immediately, with an unknown parse error.

    This parser fails immediately, with an unknown parse error.

    returns

    a parser that fails.

    Definition Classes
    ParsleyImpl
    Example:
    1. scala> import parsley.Parsley.empty
      scala> empty.parse("")
      val res0 = Failure(..)
    Note

    equivalent to empty(0)

  43. final def endBy[A](p: parsley.Parsley[A], sep: => parsley.Parsley[_]): parsley.Parsley[List[A]]

    This combinator parses zero or more occurrences of p, separated and ended by sep.

    This combinator parses zero or more occurrences of p, separated and ended by sep.

    Behaves just like endBy1, except does not require an initial p and sep, returning the empty list instead.

    p

    the parser whose results are collected into a list.

    sep

    the delimiter that must be parsed between every p.

    returns

    a parser that parses p delimited by sep, returning the list of p's results.

    Definition Classes
    combinator
    Example:
    1. scala> ...
      scala> val args = endBy(int, string(";\n"))
      scala> args.parse("7;\n3;\n2")
      val res0 = Failure(..)
      scala> args.parse("")
      val res1 = Success(Nil)
      scala> args.parse("1;\n")
      val res2 = Success(List(1))
      scala> args.parse("1;\n2;\n")
      val res3 = Success(List(1, 2))
  44. final def endBy1[A](p: parsley.Parsley[A], sep: => parsley.Parsley[_]): parsley.Parsley[List[A]]

    This combinator parses one or more occurrences of p, separated and ended by sep.

    This combinator parses one or more occurrences of p, separated and ended by sep.

    Parses p followed by sep one or more times. The results of the p's, x1 through xn, are returned as List(x1, .., xn). If p or sep fails having consumed input, the whole parser fails.

    p

    the parser whose results are collected into a list.

    sep

    the delimiter that must be parsed between every p.

    returns

    a parser that parses p delimited by sep, returning the list of p's results.

    Definition Classes
    combinator
    Example:
    1. scala> ...
      scala> val args = endBy1(int, string(";\n"))
      scala> args.parse("7;\n3;\n2")
      val res0 = Failure(..)
      scala> args.parse("")
      val res1 = Failure(..)
      scala> args.parse("1;\n")
      val res2 = Success(List(1))
      scala> args.parse("1;\n2;\n")
      val res3 = Success(List(1, 2))
  45. final val endOfLine: parsley.Parsley[Char]

    This parser will parse either a line feed (LF) or a CRLF newline, returning '\n' if successful.

    This parser will parse either a line feed (LF) or a CRLF newline, returning '\n' if successful.

    Definition Classes
    character
    See also

    crlf

  46. final val eof: parsley.Parsley[Unit]

    This parser only succeeds at the end of the input.

    This parser only succeeds at the end of the input.

    Equivalent to notFollowedBy(item).

    Definition Classes
    ParsleyImpl
    Example:
    1. scala> import parsley.combinator.eof
      scala> eof.parse("a")
      val res0 = Failure(..)
      scala> eof.parse("")
      val res1 = Success(())
    Since

    4.5.0

  47. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  48. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  49. final def exactly[A](n: Int, p: parsley.Parsley[A]): parsley.Parsley[List[A]]

    This combinator parses exactly n occurrences of p, returning these n results in a list.

    This combinator parses exactly n occurrences of p, returning these n results in a list.

    Parses p repeatedly up to n times. If p fails before n is reached, then this combinator fails. It is not required for p to fail after the nth parse. The results produced by p, x1 through xn, are returned as List(x1, .., xn).

    n

    the number of times to repeat p.

    p

    the parser to repeat.

    returns

    a parser that parses p exactly n times, returning a list of the results.

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.character.item
      scala> import parsley.combinator.exactly
      scala> val p = exactly(3, item)
      scala> p.parse("ab")
      val res0 = Failure(..)
      scala> p.parse("abc")
      val res1 = Success(List('a', 'b', 'c'))
      scala> p.parse("abcd")
      val res2 = Success(List('a', 'b', 'c'))
    Since

    4.0.0

  50. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  51. final def fresh[A](x: => A): parsley.Parsley[A]

    This combinator produces a new value everytime it is parsed without having any other effect.

    This combinator produces a new value everytime it is parsed without having any other effect.

    When this combinator is ran, no input is required, nor consumed, and a new instance of the given value will always be successfully returned. It has no other effect on the state of the parser.

    This is useful primarily if mutable data is being threaded around a parser: this should not be needed for the vast majority of parsers.

    x

    the value to be returned.

    returns

    a parser which consumes no input and produces a value x.

    Definition Classes
    ParsleyImpl
    Example:
    1. scala> import parsley.Parsley.{pure, fresh}
      scala> val p = pure(new Object)
      scala> p.parse("")
      val res0 = Success(java.lang.Object@44a3ec6b)
      scala> p.parse("")
      val res1 = Success(java.lang.Object@44a3ec6b)
      scala> val q = fresh(new Object)
      scala> q.parse("")
      val res2 = Success(java.lang.Object@71623278)
      scala> q.parse("")
      val res3 = Success(java.lang.Object@768b970c)
    Since

    4.0.0

  52. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  53. final def guardS(p: parsley.Parsley[Boolean]): parsley.Parsley[Unit]

    This combinator verfies that the given parser returns true, or else fails.

    This combinator verfies that the given parser returns true, or else fails.

    First, parse p; if it succeeds then, so long at returns true, this guard(p) succeeds. Otherwise, if p either fails, or returns false, guard(p) will fail.

    p

    the parser that yields the condition value.

    Definition Classes
    combinator
    Example:
    1. guard(pure(true)) == unit
      guard(pure(false)) == empty
      when(p.map(!_), empty) == guardS(p)
  54. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  55. final val hexDigit: parsley.Parsley[Char]

    This parser tries to parse a hexadecimal digit, and returns it if successful.

    This parser tries to parse a hexadecimal digit, and returns it if successful.

    A hexadecimal digit is one of (all inclusive ranges):

    1. the digits '0' through '9'
    2. the letters 'a' through 'f'
    3. the letters 'A' through 'Z'
    Definition Classes
    character
    See also

    isHexDigit

  56. final def ifS[A](condP: parsley.Parsley[Boolean], thenP: => parsley.Parsley[A], elseP: => parsley.Parsley[A]): parsley.Parsley[A]

    This combinator parses one of thenP or elseP depending on the result of parsing condP.

    This combinator parses one of thenP or elseP depending on the result of parsing condP.

    This is a lifted if-statement. First, parse condP: if it is successful and returns true, then parse thenP; else, if it returned false, parse elseP; or, if condP failed then fail. If either of thenP or elseP fail, then this combinator also fails.

    Most useful in conjunction with Registers, as this allows for decisions to be made based on state.

    condP

    the parser that yields the condition value.

    thenP

    the parser to execute if the condition is true.

    elseP

    the parser to execute if the condition is false.

    returns

    a parser that conditionally parses thenP or elseP after condP.

    Definition Classes
    combinator
    Example:
    1. ifS(pure(true), p, _) == p
      ifS(pure(false), _, p) == p
    Since

    4.5.0

  57. final def isHexDigit(c: Char): Boolean

    This function returns true if a character is a hexadecimal digit.

    This function returns true if a character is a hexadecimal digit.

    A hexadecimal digit is one of (all inclusive ranges):

    1. the digits '0' through '9'
    2. the letters 'a' through 'f'
    3. the letters 'A' through 'Z'
    4. an equivalent from another charset
    Definition Classes
    character
    See also

    hexDigit

  58. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  59. final def isOctDigit(c: Char): Boolean

    This function returns true if a character is an octal digit.

    This function returns true if a character is an octal digit.

    An octal digit is one of '0' to '7' (inclusive).

    Definition Classes
    character
    See also

    octDigit

  60. final def isSpace(c: Char): Boolean

    This function returns true if a character is either a space or a tab character.

    This function returns true if a character is either a space or a tab character.

    Definition Classes
    character
    See also

    space

  61. final val item: parsley.Parsley[Char]

    This parser will parse any single character from the input, failing if there is no input remaining.

    This parser will parse any single character from the input, failing if there is no input remaining.

    Definition Classes
    character
    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using unicode.item.

  62. final val letter: parsley.Parsley[Char]

    This parser tries to parse a letter, and returns it if successful.

    This parser tries to parse a letter, and returns it if successful.

    A letter is any character c <= '\uffff' whose Unicode Category Type is any of the following:

    1. Uppercase Letter (Lu)
    2. Lowercase Letter (Ll)
    3. Titlecase Letter (Lt)
    4. Modifier Letter (Lm)
    5. Other Letter (Lo)

    The full list of codepoints found in a category can be found in the Unicode Character Database.

    Definition Classes
    character
  63. final val letterOrDigit: parsley.Parsley[Char]

    This parser tries to parse either a letter or a digit, and returns it if successful.

    This parser tries to parse either a letter or a digit, and returns it if successful.

    A letter or digit is anything that would parse in either letter or digit.

    Definition Classes
    character
    See also

    documentation for letter.

    documentation for digit.

  64. final def lift1[T1, R](f: (T1) => R, p1: parsley.Parsley[T1]): parsley.Parsley[R]

    This combinator allows the result of a given parser to be changed using a given function.

    This combinator allows the result of a given parser to be changed using a given function.

    Effectively alias for map, to be consistent with the other lift variants.

    f

    the function to map across the given parser

    returns

    a parser that applies the function f to the result of the given parser.

    Definition Classes
    lift
  65. final def lift10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity ten.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  66. final def lift11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity eleven.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  67. final def lift12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity twelve.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  68. final def lift13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity thirteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  69. final def lift14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity fourteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  70. final def lift15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity fifteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  71. final def lift16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity sixteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  72. final def lift17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity seventeen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  73. final def lift18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity eighteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  74. final def lift19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18], p19: => parsley.Parsley[T19]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity nineteen.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  75. final def lift2[T1, T2, R](f: (T1, T2) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity two.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  76. final def lift20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18], p19: => parsley.Parsley[T19], p20: => parsley.Parsley[T20]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity twenty.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  77. final def lift21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18], p19: => parsley.Parsley[T19], p20: => parsley.Parsley[T20], p21: => parsley.Parsley[T21]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity twenty-one.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  78. final def lift22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9], p10: => parsley.Parsley[T10], p11: => parsley.Parsley[T11], p12: => parsley.Parsley[T12], p13: => parsley.Parsley[T13], p14: => parsley.Parsley[T14], p15: => parsley.Parsley[T15], p16: => parsley.Parsley[T16], p17: => parsley.Parsley[T17], p18: => parsley.Parsley[T18], p19: => parsley.Parsley[T19], p20: => parsley.Parsley[T20], p21: => parsley.Parsley[T21], p22: => parsley.Parsley[T22]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity twenty-two.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  79. final def lift3[T1, T2, T3, R](f: (T1, T2, T3) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity three.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  80. final def lift4[T1, T2, T3, T4, R](f: (T1, T2, T3, T4) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity four.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  81. final def lift5[T1, T2, T3, T4, T5, R](f: (T1, T2, T3, T4, T5) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity five.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  82. final def lift6[T1, T2, T3, T4, T5, T6, R](f: (T1, T2, T3, T4, T5, T6) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity six.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  83. final def lift7[T1, T2, T3, T4, T5, T6, T7, R](f: (T1, T2, T3, T4, T5, T6, T7) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity seven.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  84. final def lift8[T1, T2, T3, T4, T5, T6, T7, T8, R](f: (T1, T2, T3, T4, T5, T6, T7, T8) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity eight.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  85. final def lift9[T1, T2, T3, T4, T5, T6, T7, T8, T9, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9) => R, p1: parsley.Parsley[T1], p2: => parsley.Parsley[T2], p3: => parsley.Parsley[T3], p4: => parsley.Parsley[T4], p5: => parsley.Parsley[T5], p6: => parsley.Parsley[T6], p7: => parsley.Parsley[T7], p8: => parsley.Parsley[T8], p9: => parsley.Parsley[T9]): parsley.Parsley[R]

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    This combinator applies the given parsers in sequence and then applies the given function f of to all of the results.

    Firstly, each parser is parsed in turn, each producing a result. So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f to all the arguments. If any of the parsers fails, the entire combinator fails.

    f

    a function to apply to the results of the parsers with arity nine.

    returns

    a parser that parses all of the given parsers in order, and then combines their results with f.

    Definition Classes
    lift
  86. final val line: parsley.Parsley[Int]

    This parser returns the current line number (starting at 1) of the input without having any other effect.

    This parser returns the current line number (starting at 1) of the input without having any other effect.

    When this combinator is ran, no input is required, nor consumed, and the current line number will always be successfully returned. It has no other effect on the state of the parser.

    returns

    a parser that returns the line number the parser is currently at.

    Definition Classes
    position
    Example:
    1. scala> import parsley.position.line, parsley.character.char
      scala> line.parse("")
      val res0 = Success(1)
      scala> (char('a') *> line).parse("a")
      val res0 = Success(1)
      scala> (char('\n') *> line).parse("\n")
      val res0 = Success(2)
  87. final def lookAhead[A](p: parsley.Parsley[A]): parsley.Parsley[A]

    This combinator parses its argument p, but does not consume input if it succeeds.

    This combinator parses its argument p, but does not consume input if it succeeds.

    If the parser p succeeds, then lookAhead(p) will roll back any input consumed whilst parsing p. If p fails, however, then the whole combinator fails and any input consumed remains consumed. If this behaviour is not desirable, consider pairing lookAhead with atomic.

    p

    the parser to execute, if it succeeds, it will not have consumed input.

    returns

    a parser that parses p and never consumes input if it succeeds.

    Definition Classes
    ParsleyImpl
    Example:
    1. scala> import parsley.Parsley.lookAhead, parsley.character.string
      scala> (lookAhead(string("aaa")) *> string("aaa")).parse("aaa")
      val res0 = Success("aaa")
      scala> (lookAhead(string("abc")) <|> string("abd")).parse("abd")
      val res1 = Failure(..) // lookAhead does not roll back input consumed on failure
  88. final val lower: parsley.Parsley[Char]

    This parser tries to parse a lowercase letter, and returns it if successful.

    This parser tries to parse a lowercase letter, and returns it if successful.

    A lowercase letter is any character c <= '\uffff' whose Unicode Category Type is Lowercase Letter (Ll). Examples of characters within this category include:

    • the Latin letters 'a' through 'z'
    • Latin special character such as 'é', 'ß', 'ð'
    • Cryillic letters
    • Greek letters
    • Coptic letters

    The full list of codepoints found in a category can be found in the Unicode Character Database.

    Definition Classes
    character
  89. final def many[A](p: parsley.Parsley[A]): parsley.Parsley[List[A]]

    This combinator repeatedly parses a given parser zero or more times, collecting the results into a list.

    This combinator repeatedly parses a given parser zero or more times, collecting the results into a list.

    Parses a given parser, p, repeatedly until it fails. If p failed having consumed input, this combinator fails. Otherwise when p fails without consuming input, this combinator will return all of the results, x1 through xn (with n >= 0), in a list: List(x1, .., xn). If p was never successful, the empty list is returned.

    p

    the parser to execute multiple times.

    returns

    a parser that parses p until it fails, returning the list of all the successful results.

    Definition Classes
    ParsleyImpl
    Example:
    1. scala> import parsley.character.string
      scala> import parsley.Parsley.many
      scala> val p = many(string("ab"))
      scala> p.parse("")
      val res0 = Success(Nil)
      scala> p.parse("ab")
      val res1 = Success(List("ab"))
      scala> p.parse("abababab")
      val res2 = Success(List("ab", "ab", "ab", "ab"))
      scala> p.parse("aba")
      val res3 = Failure(..)
    Since

    4.5.0

  90. final def manyN[A](n: Int, p: parsley.Parsley[A]): parsley.Parsley[List[A]]

    This combinator repeatedly parses a given parser n or more times, collecting the results into a list.

    This combinator repeatedly parses a given parser n or more times, collecting the results into a list.

    Parses a given parser, p, repeatedly until it fails. If p failed having consumed input, this combinator fails. Otherwise when p fails without consuming input, this combinator will return all of the results, x1 through xm (with m >= n), in a list: List(x1, .., xm). If p was not successful at least n times, this combinator fails.

    n

    the minimum number of ps required.

    p

    the parser to execute multiple times.

    returns

    a parser that parses p until it fails, returning the list of all the successful results.

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.character.string
      scala> import parsley.combinator.manyN
      scala> val p = manyN(2, string("ab"))
      scala> p.parse("")
      val res0 = Failure(..)
      scala> p.parse("ab")
      val res1 = Failure(..)
      scala> p.parse("abababab")
      val res2 = Success(List("ab", "ab", "ab", "ab"))
      scala> p.parse("aba")
      val res3 = Failure(..)
    Note

    many(p) == many(0, p) and some(p) == many(1, p).

  91. final def manyTill[A](p: parsley.Parsley[A], end: parsley.Parsley[_]): parsley.Parsley[List[A]]

    This combinator repeatedly parses a given parser zero or more times, until the end parser succeeds, collecting the results into a list.

    This combinator repeatedly parses a given parser zero or more times, until the end parser succeeds, collecting the results into a list.

    First tries to parse end, if it fails without consuming input, then parses p, which must succeed. This repeats until end succeeds. When end does succeed, this combinator will return all of the results generated by p, x1 through xn (with n >= 0), in a list: List(x1, .., xn). If end could be parsed immediately, the empty list is returned.

    p

    the parser to execute multiple times.

    end

    the parser that stops the parsing of p.

    returns

    a parser that parses p until end succeeds, returning the list of all the successful results.

    Definition Classes
    combinator
    Example:
    1. This can be useful for scanning comments:

      scala> import parsley.character.{string, item, endOfLine}
      scala> import parsley.combinator.manyTill
      scala> val comment = string("//") *> manyTill(item, endOfLine)
      scala> p.parse("//hello world")
      val res0 = Failure(..)
      scala> p.parse("//hello world\n")
      val res1 = Success(List('h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'))
      scala> p.parse("//\n")
      val res2 = Success(Nil)
    Since

    4.5.0

  92. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  93. final val newline: parsley.Parsley[Char]

    This parser tries to parse a line feed newline ('\n') character, and returns it if successful.

    This parser tries to parse a line feed newline ('\n') character, and returns it if successful.

    This parser will not accept a carriage return (CR) character or CRLF.

    Definition Classes
    character
  94. final def noneOf(cs: NumericRange[Char]): parsley.Parsley[Char]

    This combinator tries to parse any character not from supplied set of characters cs, returning it if successful.

    This combinator tries to parse any character not from supplied set of characters cs, returning it if successful.

    If the next character in the input is outside of the range of characters cs, it is consumed and returned. Otherwise, no input is consumed and the combinator fails.

    cs

    the range of characters to check.

    returns

    a parser that parses a character outside the range cs.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.noneOf
      scala> val p = noneOf('a' to 'c')
      scala> p.parse("a")
      val res0 = Failure(..)
      scala> p.parse("b")
      val res1 = Failure(..)
      scala> p.parse("c")
      val res1 = Failure(..)
      scala> p.parse("xb")
      val res2 = Success('x')
      scala> p.parse("")
      val res3 = Failure(..)
    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using unicode.noneOf.

    See also

    satisfy

  95. final def noneOf(cs: Char*): parsley.Parsley[Char]

    This combinator tries to parse any character not from supplied set of characters cs, returning it if successful.

    This combinator tries to parse any character not from supplied set of characters cs, returning it if successful.

    If the next character in the input is not an element of the list of characters cs, it is consumed and returned. Otherwise, no input is consumed and the combinator fails.

    cs

    the set of characters to check.

    returns

    a parser that parses one character that is not an element of cs.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.noneOf
      scala> val p = noneOf('a', 'b', 'c')
      scala> p.parse("a")
      val res0 = Failure(..)
      scala> p.parse("c")
      val res1 = Failure(..)
      scala> p.parse("xb")
      val res2 = Success('x')
      scala> p.parse("")
      val res3 = Failure(..)
    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using unicode.noneOf.

    See also

    satisfy

  96. final def noneOf(cs: Set[Char]): parsley.Parsley[Char]

    This combinator tries to parse any character not from supplied set of characters cs, returning it if successful.

    This combinator tries to parse any character not from supplied set of characters cs, returning it if successful.

    If the next character in the input is not a member of the set cs, it is consumed and returned. Otherwise, no input is consumed and the combinator fails.

    cs

    the set of characters to check.

    returns

    a parser that parses one character that is not a member of the set cs.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.noneOf
      scala> val p = noneOf(Set('a', 'b', 'c'))
      scala> p.parse("a")
      val res0 = Failure(..)
      scala> p.parse("c")
      val res1 = Failure(..)
      scala> p.parse("xb")
      val res2 = Success('x')
      scala> p.parse("")
      val res3 = Failure(..)
    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using unicode.noneOf.

    See also

    satisfy

  97. final def notFollowedBy(p: parsley.Parsley[_]): parsley.Parsley[Unit]

    This combinator parses its argument p, and succeeds when p fails and vice-versa, never consuming input.

    This combinator parses its argument p, and succeeds when p fails and vice-versa, never consuming input.

    If the parser p succeeds, then notFollowedBy(p) will fail, consuming no input. Otherwise, should p fail, then notFollowedBy(p) will succeed, consuming no input and returning ().

    p

    the parser to execute, it should fail in order for this combinator to succeed.

    returns

    a parser which fails when p succeeds and succeeds otherwise, never consuming input.

    Definition Classes
    ParsleyImpl
    Example:
    1. one use for this combinator is to allow for "longest-match" behaviour. For instance, keywords are normally only considered keywords if they are not part of some larger valid identifier (i.e. the keyword "if" should not parse successfully given "ifp"). This can be accomplished as follows:

      import parsley.character.{string, letterOrDigit}
      import parsley.Parsley.notFollowedBy
      def keyword(kw: String): Parsley[Unit] = atomic {
          string(kw) *> notFollowedBy(letterOrDigit)
      }
  98. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  99. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  100. final val octDigit: parsley.Parsley[Char]

    This parser tries to parse an octal digit, and returns it if successful.

    This parser tries to parse an octal digit, and returns it if successful.

    An octal digit is one of '0' to '7' (inclusive).

    Definition Classes
    character
    See also

    isOctDigit

  101. final val offset: parsley.Parsley[Int]

    This parser returns the current offset into the input (starting at 0) without having any other effect.

    This parser returns the current offset into the input (starting at 0) without having any other effect.

    When this combinator is ran, no input is required, nor consumed, and the current offset into the input will always be successfully returned. It has no other effect on the state of the parser.

    returns

    a parser that returns the offset the parser is currently at.

    Definition Classes
    position
    Example:
    1. scala> import parsley.position.offset, parsley.character.char
      scala> offset.parse("")
      val res0 = Success(0)
      scala> (char('a') *> offset).parse("a")
      val res0 = Success(1)
      scala> (char('\n') *> offset).parse("\n")
      val res0 = Success(1)
    Note

    offset does not take wide unicode codepoints into account.

  102. final def oneOf(cs: NumericRange[Char]): parsley.Parsley[Char]

    This combinator tries to parse any character from supplied set of characters cs, returning it if successful.

    This combinator tries to parse any character from supplied set of characters cs, returning it if successful.

    If the next character in the input is within the range of characters cs, it is consumed and returned. Otherwise, no input is consumed and the combinator fails.

    cs

    the range of characters to check.

    returns

    a parser that parses a character within the range cs.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.oneOf
      scala> val p = oneOf('a' to 'c')
      scala> p.parse("a")
      val res0 = Success('a')
      scala> p.parse("b")
      val res1 = Success('b')
      scala> p.parse("c")
      val res1 = Success('c')
      scala> p.parse("xb")
      val res2 = Failure(..)
    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using unicode.oneOf.

    See also

    satisfy

  103. final def oneOf(cs: Char*): parsley.Parsley[Char]

    This combinator tries to parse any character from supplied set of characters cs, returning it if successful.

    This combinator tries to parse any character from supplied set of characters cs, returning it if successful.

    If the next character in the input is an element of the list of characters cs, it is consumed and returned. Otherwise, no input is consumed and the combinator fails.

    cs

    the characters to check.

    returns

    a parser that parses one of the elements of cs.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.oneOf
      scala> val p = oneOf('a', 'b', 'c')
      scala> p.parse("a")
      val res0 = Success('a')
      scala> p.parse("c")
      val res1 = Success('c')
      scala> p.parse("xb")
      val res2 = Failure(..)
    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using unicode.oneOf.

    See also

    satisfy

  104. final def oneOf(cs: Set[Char]): parsley.Parsley[Char]

    This combinator tries to parse any character from supplied set of characters cs, returning it if successful.

    This combinator tries to parse any character from supplied set of characters cs, returning it if successful.

    If the next character in the input is a member of the set cs, it is consumed and returned. Otherwise, no input is consumed and the combinator fails.

    cs

    the set of characters to check.

    returns

    a parser that parses one of the member of the set cs.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.oneOf
      scala> val p = oneOf(Set('a', 'b', 'c'))
      scala> p.parse("a")
      val res0 = Success('a')
      scala> p.parse("c")
      val res1 = Success('c')
      scala> p.parse("xb")
      val res2 = Failure(..)
    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using unicode.oneOf.

    See also

    satisfy

  105. final def option[A](p: parsley.Parsley[A]): parsley.Parsley[Option[A]]

    This combinator tries to parse p, wrapping its result in a Some if it succeeds, or returns None if it fails.

    This combinator tries to parse p, wrapping its result in a Some if it succeeds, or returns None if it fails.

    Tries to parse p. If p succeeded, producing x, then Some(x) is returned. Otherwise, if p failed without consuming input, then None is returned instead.

    p

    the parser to try to parse.

    returns

    a parser that tries to parse p, but can still succeed with None if that was not possible.

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.combinator.option
      scala> import parsley.character.string
      scala> val p = option(string("abc"))
      scala> p.parse("")
      val res0 = Success(None)
      scala> p.parse("abc")
      val res1 = Success(Some("abc"))
      scala> p.parse("ab")
      val res2 = Failure(..)
  106. final def optional(p: parsley.Parsley[_]): parsley.Parsley[Unit]

    This combinator will parse p if possible, otherwise will do nothing.

    This combinator will parse p if possible, otherwise will do nothing.

    Tries to parse p. If p succeeds, or fails without consuming input then this combinator is successful. Otherwise, if p failed having consumed input, this combinator fails.

    p

    the parser to try to parse.

    returns

    a parser that tries to parse p.

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.combinator.optional
      scala> import parsley.character.string
      scala> val p = optional(string("abc"))
      scala> p.parse("")
      val res0 = Success(())
      scala> p.parse("abc")
      val res1 = Success(())
      scala> p.parse("ab")
      val res2 = Failure(..)
    Note

    equivalent to optionalAs(p, ()).

  107. final def optionalAs[A](p: parsley.Parsley[_], x: A): parsley.Parsley[A]

    This combinator will parse p if possible, otherwise will do nothing.

    This combinator will parse p if possible, otherwise will do nothing.

    Tries to parse p. If p succeeds, or fails without consuming input then this combinator is successful and returns x. Otherwise, if p failed having consumed input, this combinator fails.

    p

    the parser to try to parse.

    x

    the value to return regardless of how p performs.

    returns

    a parser that tries to parse p, returning x regardless of success or failure.

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.combinator.optionalAs
      scala> import parsley.character.string
      scala> val p = optionalAs(string("abc"), 7)
      scala> p.parse("")
      val res0 = Success(7)
      scala> p.parse("abc")
      val res1 = Success(7)
      scala> p.parse("ab")
      val res2 = Failure(..)
  108. final val pos: parsley.Parsley[(Int, Int)]

    This parser returns the current line and column numbers (starting at 1) of the input without having any other effect.

    This parser returns the current line and column numbers (starting at 1) of the input without having any other effect.

    When this combinator is ran, no input is required, nor consumed, and the current line and column number will always be successfully returned. It has no other effect on the state of the parser.

    returns

    a parser that returns the line and column number the parser is currently at.

    Definition Classes
    position
    Example:
    1. scala> import parsley.position.pos, parsley.character.char
      scala> pos.parse("")
      val res0 = Success((1, 1))
      scala> (char('a') *> pos).parse("a")
      val res0 = Success((1, 2))
      scala> (char('\n') *> pos).parse("\n")
      val res0 = Success((2, 1))
    Note

    in the presence of wide unicode characters, the column value returned may be inaccurate.

  109. final def pure[A](x: A): parsley.Parsley[A]

    This combinator produces a value without having any other effect.

    This combinator produces a value without having any other effect.

    When this combinator is ran, no input is required, nor consumed, and the given value will always be successfully returned. It has no other effect on the state of the parser.

    x

    the value to be returned.

    returns

    a parser which consumes no input and produces a value x.

    Definition Classes
    ParsleyImpl
    Example:
    1. scala> import parsley.Parsley.pure
      scala> pure(7).parse("")
      val res0 = Success(7)
      scala> pure("hello!").parse("a")
      val res1 = Success("hello!")
  110. final def range[A](min: Int, max: Int)(p: parsley.Parsley[A]): parsley.Parsley[List[A]]

    This combinator parses between min and max occurrences of p, returning these n results in a list.

    This combinator parses between min and max occurrences of p, returning these n results in a list.

    Parses p repeatedly a minimum of min times and up to max times both inclusive. If p fails before min is reached, then this combinator fails. It is not required for p to fail after the maxth parse. The results produced by p, xmin through xmax, are returned as List(xmin, .., xmax).

    min

    the minimum number of times to repeat p, inclusive.

    max

    the maximum number of times to repeat p, inclusive.

    p

    the parser to repeat.

    returns

    the results of the successful parses of p.

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.character.item
      scala> import parsley.combinator.range
      scala> val p = range(min=3, max=5)(item)
      scala> p.parse("ab")
      val res0 = Failure(..)
      scala> p.parse("abc")
      val res1 = Success(List('a', 'b', 'c'))
      scala> p.parse("abcd")
      val res2 = Success(List('a', 'b', 'c', 'd'))
      scala> p.parse("abcde")
      val res2 = Success(List('a', 'b', 'c', 'd', 'e'))
      scala> p.parse("abcdef")
      val res2 = Success(List('a', 'b', 'c', 'd', 'e'))
    Since

    4.4.0

  111. final def satisfy(pred: (Char) => Boolean): parsley.Parsley[Char]

    This combinator tries to parse a single character from the input that matches the given predicate.

    This combinator tries to parse a single character from the input that matches the given predicate.

    Attempts to read a character from the input and tests it against the predicate pred. If a character c can be read and pred(c) is true, then c is consumed and returned. Otherwise, no input is consumed and this combinator will fail.

    pred

    the predicate to test the next character against, should one exist.

    returns

    a parser that tries to read a single character c, such that pred(c) is true, or fails.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.satisfy
      scala> satisfy(_.isDigit).parse("")
      val res0 = Failure(..)
      scala> satisfy(_.isDigit).parse("7")
      val res1 = Success('7')
      scala> satisfy(_.isDigit).parse("a5")
      val res2 = Failure(..)
      scala> def char(c: Char): Parsley[Char] = satisfy(_ == c)
    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using unicode.satisfy.

  112. final def satisfyMap[A](f: PartialFunction[Char, A]): parsley.Parsley[A]

    This combinator tries to parse and process a character from the input if it is defined for the given function.

    This combinator tries to parse and process a character from the input if it is defined for the given function.

    Attempts to read a character from the input and tests to see if it is in the domain of f. If a character c can be read and f(c) is defined, then c is consumed and f(c) is returned. Otherwise, no input is consumed and this combinator will fail.

    f

    the function to test the next character against and transform it with, should one exist.

    returns

    a parser that tries to read a single character c, such that f(c) is defined, and returns f(c) if so, or fails.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.satisfyMap
      scala> val digit = satisfyMap {
        case c if c.isDigit => c.asDigit
      }
      scala> digit.parse("")
      val res0 = Failure(..)
      scala> digit.parse("7")
      val res1 = Success(7)
      scala> digit.parse("a5")
      val res2 = Failure(..)
    Since

    4.4.0

    Note

    this combinator can only handle 16-bit characters: for larger codepoints, consider using unicode.satisfyMap.

  113. final def select[A, B](p: parsley.Parsley[Either[A, B]], q: => parsley.Parsley[(A) => B]): parsley.Parsley[B]

    This combinator parses its first argument p, then parses q only if p returns a Left.

    This combinator parses its first argument p, then parses q only if p returns a Left.

    First, select(p, q) parses p, which, if successful, will produce either a Left(x) or a Right(y). If a Left(x) is produced, then the parser q is executed to produce a function f, and f(x) is returned. Otherwise, if a Right(y) is produced, y is returned unmodified and q is not parsed. If either p or q fails, the entire combinator fails. This is a special case of branch where the right branch is pure(identity[B]).

    First introduced in Selective Applicative Functors (Mokhov et al. 2019).

    p

    the first parser to execute, its result decides whether q is executed or not.

    q

    a parser to execute when p returns a Left.

    returns

    a parser that will parse p then possibly parse q to transform p's result into a B.

    Definition Classes
    ParsleyImpl
    Example:
    1. def filter(pred: A => Boolean): Parsley[A] = {
          val p = this.map(x => if (pred(x)) Right(x) else Left(()))
          select(p, empty)
      }
  114. final def sepBy[A](p: parsley.Parsley[A], sep: => parsley.Parsley[_]): parsley.Parsley[List[A]]

    This combinator parses zero or more occurrences of p, separated by sep.

    This combinator parses zero or more occurrences of p, separated by sep.

    Behaves just like sepBy1, except does not require an initial p, returning the empty list instead.

    p

    the parser whose results are collected into a list.

    sep

    the delimiter that must be parsed between every p.

    returns

    a parser that parses p delimited by sep, returning the list of p's results.

    Definition Classes
    combinator
    Example:
    1. scala> ...
      scala> val args = sepBy(int, string(", "))
      scala> args.parse("7, 3, 2")
      val res0 = Success(List(7, 3, 2))
      scala> args.parse("")
      val res1 = Success(Nil)
      scala> args.parse("1")
      val res2 = Success(List(1))
      scala> args.parse("1, 2, ")
      val res3 = Failure(..) // no trailing comma allowed
  115. final def sepBy1[A](p: parsley.Parsley[A], sep: => parsley.Parsley[_]): parsley.Parsley[List[A]]

    This combinator parses one or more occurrences of p, separated by sep.

    This combinator parses one or more occurrences of p, separated by sep.

    First parses a p. Then parses sep followed by p until there are no more seps. The results of the p's, x1 through xn, are returned as List(x1, .., xn). If p or sep fails having consumed input, the whole parser fails. Requires at least one p to have been parsed.

    p

    the parser whose results are collected into a list.

    sep

    the delimiter that must be parsed between every p.

    returns

    a parser that parses p delimited by sep, returning the list of p's results.

    Definition Classes
    combinator
    Example:
    1. scala> ...
      scala> val args = sepBy1(int, string(", "))
      scala> args.parse("7, 3, 2")
      val res0 = Success(List(7, 3, 2))
      scala> args.parse("")
      val res1 = Failure(..)
      scala> args.parse("1")
      val res2 = Success(List(1))
      scala> args.parse("1, 2, ")
      val res3 = Failure(..) // no trailing comma allowed
  116. final def sepEndBy[A](p: parsley.Parsley[A], sep: => parsley.Parsley[_]): parsley.Parsley[List[A]]

    This combinator parses zero or more occurrences of p, separated and optionally ended by sep.

    This combinator parses zero or more occurrences of p, separated and optionally ended by sep.

    Behaves just like sepEndBy1, except does not require an initial p, returning the empty list instead.

    p

    the parser whose results are collected into a list.

    sep

    the delimiter that must be parsed between every p.

    returns

    a parser that parses p delimited by sep, returning the list of p's results.

    Definition Classes
    combinator
    Example:
    1. scala> ...
      scala> val args = sepEndBy(int, string(";\n"))
      scala> args.parse("7;\n3;\n2")
      val res0 = Success(List(7, 3, 2))
      scala> args.parse("")
      val res1 = Success(Nil)
      scala> args.parse("1")
      val res2 = Success(List(1))
      scala> args.parse("1;\n2;\n")
      val res3 = Success(List(1, 2))
  117. final def sepEndBy1[A](p: parsley.Parsley[A], sep: => parsley.Parsley[_]): parsley.Parsley[List[A]]

    This combinator parses one or more occurrences of p, separated and optionally ended by sep.

    This combinator parses one or more occurrences of p, separated and optionally ended by sep.

    First parses a p. Then parses sep followed by p until there are no more: if a final sep exists, this is parsed. The results of the p's, x1 through xn, are returned as List(x1, .., xn). If p or sep fails having consumed input, the whole parser fails. Requires at least one p to have been parsed.

    p

    the parser whose results are collected into a list.

    sep

    the delimiter that must be parsed between every p.

    returns

    a parser that parses p delimited by sep, returning the list of p's results.

    Definition Classes
    combinator
    Example:
    1. scala> ...
      scala> val args = sepEndBy1(int, string(";\n"))
      scala> args.parse("7;\n3;\n2")
      val res0 = Success(List(7, 3, 2))
      scala> args.parse("")
      val res1 = Failure(..)
      scala> args.parse("1")
      val res2 = Success(List(1))
      scala> args.parse("1;\n2;\n")
      val res3 = Success(List(1, 2))
  118. final def sequence[A](p0: parsley.Parsley[A], ps: parsley.Parsley[A]*): parsley.Parsley[List[A]]

    This combinator will parse each of ps in order, collecting the results.

    This combinator will parse each of ps in order, collecting the results.

    Given the parsers ps, consisting of p1 through pn, parses each in order. If they all succeed, producing the results x1 through xn, then List(x1, .., xn) is returned. If any of the parsers fail, then the whole combinator fails.

    p0

    the first parser to be sequenced

    ps

    parsers to be sequenced.

    returns

    a parser that parses each of ps, returning the results in a list

    Definition Classes
    combinator
    Example:
    1. scala> import parsley.combinator.sequence
      scala> import parsley.character.{char, item}
      scala> val p = sequence(char('a'), item, char('c'))
      scala> p.parse("abc")
      val res0 = Success(List('a', 'b', 'c'))
      scala> p.parse("ab")
      val res1 = Failure(..)
    Since

    4.0.0

    Note

    be aware that all of the arguments to this combinator are in strict positions.

    See also

    <::>

  119. final def some[A](p: parsley.Parsley[A]): parsley.Parsley[List[A]]

    This combinator repeatedly parses a given parser one or more times, collecting the results into a list.

    This combinator repeatedly parses a given parser one or more times, collecting the results into a list.

    Parses a given parser, p, repeatedly until it fails. If p failed having consumed input, this combinator fails. Otherwise when p fails without consuming input, this combinator will return all of the results, x1 through xn (with n >= 1), in a list: List(x1, .., xn). If p was not successful at least one time, this combinator fails.

    p

    the parser to execute multiple times.

    returns

    a parser that parses p until it fails, returning the list of all the successful results.

    Definition Classes
    ParsleyImpl
    Example:
    1. scala> import parsley.character.string
      scala> import parsley.Parsley.some
      scala> val p = some(string("ab"))
      scala> p.parse("")
      val res0 = Failure(..)
      scala> p.parse("ab")
      val res1 = Success(List("ab"))
      scala> p.parse("abababab")
      val res2 = Success(List("ab", "ab", "ab", "ab"))
      scala> p.parse("aba")
      val res3 = Failure(..)
    Since

    4.5.0

  120. final def someTill[A](p: parsley.Parsley[A], end: parsley.Parsley[_]): parsley.Parsley[List[A]]

    This combinator repeatedly parses a given parser one or more times, until the end parser succeeds, collecting the results into a list.

    This combinator repeatedly parses a given parser one or more times, until the end parser succeeds, collecting the results into a list.

    First ensures that trying to parse end fails, then tries to parse p. If it succeed then it will repeatedly: try to parse end, if it fails without consuming input, then parses p, which must succeed. When end does succeed, this combinator will return all of the results generated by p, x1 through xn (with n >= 1), in a list: List(x1, .., xn). The parser p must succeed at least once before end succeeds.

    p

    the parser to execute multiple times.

    end

    the parser that stops the parsing of p.

    returns

    a parser that parses p until end succeeds, returning the list of all the successful results.

    Definition Classes
    combinator
    Example:
    1. This can be useful for scanning comments:

      scala> import parsley.character.{string, item, endOfLine}
      scala> import parsley.combinator.someUntil
      scala> val comment = string("//") *> someUntil(item, endOfLine)
      scala> p.parse("//hello world")
      val res0 = Failure(..)
      scala> p.parse("//hello world\n")
      val res1 = Success(List('h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'))
      scala> p.parse("//\n")
      val res2 = Failure(..)
      scala> p.parse("//a\n")
      val res3 = Success(List('a'))
    Since

    4.5.0

  121. final val space: parsley.Parsley[Char]

    This parser tries to parse a space or tab character, and returns it if successful.

    This parser tries to parse a space or tab character, and returns it if successful.

    Definition Classes
    character
    See also

    isSpace

  122. final val spaces: parsley.Parsley[Unit]

    This parser skips zero or more space characters using space.

    This parser skips zero or more space characters using space.

    Definition Classes
    character
  123. final def string(s: String): parsley.Parsley[String]

    This combinator attempts to parse a given string from the input, and fails otherwise.

    This combinator attempts to parse a given string from the input, and fails otherwise.

    Attempts to read the given string completely from the input at the current position. If the string is present, then the parser succeeds, and the entire string is consumed from the input. Otherwise, if the input has too few characters remaining, or not all the characters matched, the parser fails. On failure, all the characters that were matched are consumed from the input.

    s

    the string to be parsed from the input

    returns

    a parser that either parses the string s or fails at the first mismatched character.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.string
      scala> string("abc").parse("")
      val res0 = Failure(..)
      scala> string("abc").parse("abcd")
      val res1 = Success("abc")
      scala> string("abc").parse("xabc")
      val res2 = Failure(..)
    Note

    the error messages generated by string do not reflect how far into the input it managed to get: this is because the error being positioned at the start of the string is more natural. However, input will still be consumed for purposes of backtracking.

  124. final def stringOfMany(pred: (Char) => Boolean): parsley.Parsley[String]

    This combinator parses characters matching the given predicate zero or more times, collecting the results into a string.

    This combinator parses characters matching the given predicate zero or more times, collecting the results into a string.

    Repeatly reads characters that satisfy the given predicate pred. When no more characters can be successfully read, the results are stitched together into a String and returned. This combinator can never fail, since satisfy can never fail having consumed input.

    pred

    the predicate to test characters against.

    returns

    a parser that returns the span of characters satisfying pred

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.{letter, stringOfMany}
      scala> import parsley.syntax.zipped._
      scala> val ident = (letter, stringOfMany(_.isLetterOrDigit)).zipped((c, s) => s"$c$s")
      scala> ident.parse("abdc9d")
      val res0 = Success("abdc9d")
      scala> ident.parse("a")
      val res1 = Success("a")
      scala> ident.parse("9")
      val res2 = Failure(..)
    Since

    4.4.0

    Note

    this acts exactly like stringOfMany(satisfy(pred)), but may be more efficient.

    ,

    analogous to the megaparsec takeWhileP combinator.

  125. final def stringOfMany(pc: parsley.Parsley[Char]): parsley.Parsley[String]

    This combinator parses pc zero or more times, collecting its results into a string.

    This combinator parses pc zero or more times, collecting its results into a string.

    Parses pc repeatedly until it fails. The resulting characters are placed into a string, which is then returned. This is morally equivalent to many(pc).map(_.mkString), but it uses StringBuilder, which makes it much more efficient.

    pc

    the parser whose results make up the string

    returns

    a parser that parses a string whose letters consist of results from pc.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.{letter, letterOrDigit, stringOfMany}
      scala> import parsley.syntax.zipped._
      scala> val ident = (letter, stringOfMany(letterOrDigit)).zipped((c, s) => s"$c$s")
      scala> ident.parse("abdc9d")
      val res0 = Success("abdc9d")
      scala> ident.parse("a")
      val res1 = Success("a")
      scala> ident.parse("9")
      val res2 = Failure(..)
    Since

    4.0.0

  126. final def stringOfSome(pred: (Char) => Boolean): parsley.Parsley[String]

    This combinator parses characters matching the given predicate one or more times, collecting the results into a string.

    This combinator parses characters matching the given predicate one or more times, collecting the results into a string.

    Repeatly reads characters that satisfy the given predicate pred. When no more characters can be successfully read, the results are stitched together into a String and returned. This combinator can never fail having consumed input, since satisfy can never fail having consumed input.

    pred

    the predicate to test characters against.

    returns

    a parser that returns the span of characters satisfying pred

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.{stringOfSome}
      scala> val ident = stringOfSome(_.isLetter)
      scala> ident.parse("abdc9d")
      val res0 = Success("abdc")
      scala> ident.parse("")
      val res1 = Failure(..)
    Since

    4.4.0

    Note

    this acts exactly like stringOfSome(satisfy(pred)), but may be more efficient.

    ,

    analogous to the megaparsec takeWhile1P combinator.

  127. final def stringOfSome(pc: parsley.Parsley[Char]): parsley.Parsley[String]

    This combinator parses pc one or more times, collecting its results into a string.

    This combinator parses pc one or more times, collecting its results into a string.

    Parses pc repeatedly until it fails. The resulting characters are placed into a string, which is then returned. This is morally equivalent to many(pc).map(_.mkString), but it uses StringBuilder, which makes it much more efficient. The result string must have at least one character in it.

    pc

    the parser whose results make up the string

    returns

    a parser that parses a string whose letters consist of results from pc.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.{letter, stringOfSome}
      scala> val ident = stringOfSome(letter)
      scala> ident.parse("abdc9d")
      val res0 = Success("abdc")
      scala> ident.parse("")
      val res1 = Failure(..)
    Since

    4.0.0

  128. final def strings[A](kv0: (String, parsley.Parsley[A]), kvs: (String, parsley.Parsley[A])*): parsley.Parsley[A]

    This combinator tries to parse each of the key-value pairs kvs (and kv0), until one of them succeeds.

    This combinator tries to parse each of the key-value pairs kvs (and kv0), until one of them succeeds.

    Each argument to this combinator is a pair of a string and a parser to perform if that string can be parsed. strings(s0 -> p0, ...) can be thought of as atomicChoice(string(s0) *> p0, ...), however, the given ordering of key-value pairs does not dictate the order in which the parses are tried. In particular, it will avoid keys that are the prefix of another key first, so that it has Longest Match semantics. It will try to minimise backtracking too, making it a much more efficient option than atomicChoice.

    kv0

    the first key-value pair to try to parse.

    kvs

    the remaining key-value pairs to try to parse.

    returns

    a parser that tries to parse all the given key-value pairs, returning the (possibly failing) result of the value that corresponds to the longest matching key.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.strings
      scala> val p = strings("hell" -> pure(4), "hello" -> pure(5), "goodbye" -> pure(7), "g" -> pure(1), "abc" -> pure(3))
      scala> p.parse("hell")
      val res0 = Success(4)
      scala> p.parse("hello")
      val res1 = Success(5)
      scala> p.parse("good")
      val res2 = Success(1)
      scala> p.parse("goodbye")
      val res3 = Success(7)
      scala> p.parse("a")
      val res4 = Failure(..)
    Since

    4.0.0

    Note

    the scope of any backtracking performed is isolated to the key itself, as it is assumed that once a key parses correctly, the branch has been committed to. Putting an atomic around the values will not affect this behaviour.

  129. final def strings(str0: String, strs: String*): parsley.Parsley[String]

    This combinator tries to parse each of the strings strs (and str0), until one of them succeeds.

    This combinator tries to parse each of the strings strs (and str0), until one of them succeeds.

    Unlike choice, or more accurately atomicChoice, this combinator will not necessarily parse the strings in the order provided. It will avoid strings that have another string as a prefix first, so that it has Longest Match semantics. It will try to minimise backtracking too, making it a much more efficient option than atomicChoice.

    The longest succeeding string will be returned. If no strings match then the combinator fails.

    str0

    the first string to try to parse.

    strs

    the remaining strings to try to parse.

    returns

    a parser that tries to parse all the given strings returning the longest one that matches.

    Definition Classes
    character
    Example:
    1. scala> import parsley.character.strings
      scala> val p = strings("hell", "hello", "goodbye", "g", "abc")
      scala> p.parse("hell")
      val res0 = Success("hell")
      scala> p.parse("hello")
      val res1 = Success("hello")
      scala> p.parse("good")
      val res2 = Success("g")
      scala> p.parse("goodbye")
      val res3 = Success("goodbye")
      scala> p.parse("a")
      val res4 = Failure(..)
    Since

    4.0.0

  130. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  131. final val tab: parsley.Parsley[Char]

    This parser tries to parse a tab ('\t') character, and returns it if successful.

    This parser tries to parse a tab ('\t') character, and returns it if successful.

    This parser does not recognise vertical tabs, only horizontal ones.

    Definition Classes
    character
  132. def toString(): String
    Definition Classes
    AnyRef → Any
  133. final def traverse[A, B](x0: A, xs: A*)(f: (A) => parsley.Parsley[B]): parsley.Parsley[List[B]]

    This combinator will parse each of the parsers generated by applying f to xs, in order, collecting the results.

    This combinator will parse each of the parsers generated by applying f to xs, in order, collecting the results.

    Given the values xs, consisting of x1 through xn, first creates the parses f(x1) through f(xn) and then called sequence on them.

    x0

    the first value to turn into a parser and sequence.

    xs

    the values to turn into parsers and sequence.

    f

    the function used to generate parsers for each values

    returns

    a parser that sequences the parsers generated from applying f to each of xs.

    Definition Classes
    combinator
    Example:
    1. // this is an OK implementation for `string`, which is common in Haskell.
      def string(str: String) = {
          traverse(str:  _*)(char).span
      }
    Since

    4.0.0

    Note

    be aware that all of the arguments to this combinator are in strict positions.

    See also

    sequence

  134. final val unit: parsley.Parsley[Unit]

    This parser produces () without having any other effect.

    This parser produces () without having any other effect.

    When this parser is ran, no input is required, nor consumed, and the given value will always be successfully returned. It has no other effect on the state of the parser.

    returns

    a parser which consumes no input and produces ().

    Definition Classes
    ParsleyImpl
    Example:
    1. scala> import parsley.Parsley.unit
      scala> unit.parse("")
      val res0 = Success(())
      scala> unit.parse("a")
      val res0 = Success(())
    Note

    defined as pure(()) as a simple convenience.

  135. final val upper: parsley.Parsley[Char]

    This parser tries to parse an uppercase letter, and returns it if successful.

    This parser tries to parse an uppercase letter, and returns it if successful.

    An uppercase letter is any character c <= '\uffff' whose Unicode Category Type is Uppercase Letter (Lu). Examples of characters within this category include:

    • the Latin letters 'A' through 'Z'
    • Latin special character such as 'Å', 'Ç', 'Õ'
    • Cryillic letters
    • Greek letters
    • Coptic letters

    The full list of codepoints found in a category can be found in the Unicode Character Database.

    Definition Classes
    character
  136. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  137. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  138. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  139. final def whenS(condP: parsley.Parsley[Boolean])(thenP: => parsley.Parsley[Unit]): parsley.Parsley[Unit]

    This combinator conditionally parses thenP depending on the result of parsing condP.

    This combinator conditionally parses thenP depending on the result of parsing condP.

    This is a lifted if-statement. First, parse condP: if it is successful and returns true, then parse thenP; else, if it returned false do nothing; or, if condP failed then fail. If thenP fails, then this combinator also fails.

    Most useful in conjunction with Registers, as this allows for decisions to be made based on state.

    condP

    the parser that yields the condition value.

    thenP

    the parser to execute if the condition is true.

    returns

    a parser that conditionally parses thenP after condP.

    Definition Classes
    combinator
    Example:
    1. whenS(pure(true), p) == p
      whenS(pure(false), _) == unit
  140. final def whileS(p: parsley.Parsley[Boolean]): parsley.Parsley[Unit]

    This combinator repeatedly parses p so long as it returns true.

    This combinator repeatedly parses p so long as it returns true.

    This is a lifted while-loop. First, parse p: if it is successful and returns true, then repeat; else if it returned false stop; or, if it failed then this combinator fails.

    Most useful in conjunction with Registers, as this allows for decisions to be made based on state. In particular, this can be used to define the forP combinator.

    p

    the parser to repeatedly parse.

    returns

    a parser that continues to parse p until it returns false.

    Definition Classes
    combinator
    Example:
    1. def forP[A](init: Parsley[A], cond: =>Parsley[A => Boolean], step: =>Parsley[A => A])(body: =>Parsley[_]): Parsley[Unit] = {
          val reg = Reg.make[A]
          lazy val _cond = reg.gets(cond)
          lazy val _step = reg.modify(step)
          reg.put(init) *> whenS(_cond, whileS(body *> _step *> _cond))
      }
  141. final val whitespace: parsley.Parsley[Char]

    This parser tries to parse a whitespace character, and returns it if successful.

    This parser tries to parse a whitespace character, and returns it if successful.

    A whitespace character is one of:

    1. a space (' ')
    2. a tab ('\t')
    3. a line feed ('\n')
    4. a carriage return ('\r')
    5. a form feed ('\f')
    6. a vertical tab ('\u000B')
    Definition Classes
    character
  142. final val whitespaces: parsley.Parsley[Unit]

    This parser skips zero or more space characters using whitespace.

    This parser skips zero or more space characters using whitespace.

    Definition Classes
    character
  143. final def withWidth[A](p: parsley.Parsley[A]): parsley.Parsley[(A, Int)]

    This combinator returns the result of a given parser and the number of characters it consumed.

    This combinator returns the result of a given parser and the number of characters it consumed.

    First records the initial offset on entry to given parser p, then executes p. If p succeeds, then the offset is taken again, and the two values are subtracted to give width w. The result of p, x is returned along with w as (x, w). If p fails, this combinator will also fail.

    p

    the parser to compute the width for

    returns

    a parser that pairs the result of the parser p with the number of characters it consumed

    Definition Classes
    position
    Example:
    1. scala> import parsley.position.withWidth, parsley.character.string
      scala> withWidth(string("abc")).parse("abc")
      val res0 = Success(("abc", 3))
    Since

    4.4.0

    Note

    the value returned is the number of 16-bit characters consumed, not unicode codepoints.

Inherited from ap

Inherited from lift

Inherited from position

Inherited from character

Inherited from combinator

Inherited from ParsleyImpl

Inherited from AnyRef

Inherited from Any

condComp

Core Combinators and Parsers

These are the most primitive combinators for consuming input capable of any input reading tasks.

Primitive Combinators

These combinators are specific to parser combinators. In one way or another, they influence how a parser consumes input, or under what conditions a parser does or does not fail. These are really important for most practical parsing considerations, although lookAhead is much less well used.

Consumptionless Parsers

These combinators and parsers do not consume input: they are the most primitive ways of producing successes and failures with the minimal possible effect on the parse. They are, however, reasonably useful; in particular, pure and unit can be put to good use in injecting results into a parser without needing to consume anything, or mapping another parser.

Iterative Combinators

These combinators all execute a given parser an unbounded number of times, until either it fails, or another parser succeeds, depending on the combinator. All of the results produced by the repeated execution of the parser are returned in a List. These are almost essential for any practical parsing task.

Input Query Combinators

These combinators do not consume input, but they allow for querying of the input stream - specifically checking whether or not there is more input that can be consumed or not. In particular, most parsers should be making use of eof to ensure that the parser consumes all the input available at the end of the parse.

Character Class Combinators

These combinators allow for working with character classes. This means that a set, or range, of characters can be specified, and the combinator will return a parser that matches one of those characters (or conversely, any character that is not in that set). The parsed character is always returned.

Optional Parsing Combinators

These combinators allow for the possible parsing of some parser. If the parser succeeds, that is ok so long as it did not consume input. Be aware that the result of the success may be replaced with these combinators, with the exception of option, which still preserves the result.

String Combinators

These combinators allow for working with, or building, strings. This means that they can parse specific strings, specific sets of strings, or can read characters repeatedly to generate strings. They are united in all returning String as their result.

Conditional Combinators

These combinators will decide which branch to take next based on the result of another parser. This differs from combinators like <|> which make decisions based on the success/failure of a parser: here the result of a successful parse will direct which option is done. These are sometimes known as "selective" combinators.

Separated Values Combinators

These combinators are concerned with delimited parsing, where one parser is repeated but delimited by another one. In each of these cases p is the parser of interest and sep is the delimeter. These combinators mainly differ in either the number of ps they require, or exactly where the delimeters are allowed (only between, always trailing, or either). In all cases, they return the list of results generated by the repeated parses of p.

Specific Character Parsers

These parsers are special cases of satisfy or char. They are worth using, as they are given special error labelling, producing nicer error messages than their primitive counterparts. This documentation assumes JDK 17. JDK 17 is compliant with Unicode® Specification 13.0. As such, the descriptions of the parsers in this section are accurate with respect to Unicode® Specification 13.0: using a different JDK may affect the precise definitions of the parsers below. If in doubt, check the documentation for java.lang.Character to see which Unicode version is supported by your JVM. A table of the Unicode versions up to JDK 17 can be found here. These parsers are only able to parse unicode characters in the range '\u0000' to '\uffff', known as the Basic Multilingual Plane (BMP). Unicode characters wider than a single 16-bit character should be parsed using multi-character combinators such as string, or, alternatively, combinators found in unicode.

Multiple Branching/Sequencing Combinators

These combinators allow for testing or sequencing a large number of parsers in one go. Be careful, however, these are variadic combinators and are necessarily (for compatibility with Scala 2) not lazy. In such a case where laziness is desired without resorting to the other lazier combinators, there is a neat trick: unroll the first iteration of the combinator, and use the corresponding regular combinator to do that (i.e. <::> or *>): since these will have a lazy right-hand side, the remaining variadic arguments will be kept lazily suspended until later. Alternatively, it is possible to use the prefix ~ combinator to make any individual arguments lazy as required, for example skip(p, ~q, r).

Range Combinators

These combinators allow for the parsing of a specific parser either a specific number of times, or between a certain amount of times.

Whitespace Skipping Parsers

These parsers are designed to skip chunks of whitespace, for very rudimentary lexing tasks. It is probably better to use the functionality of parsley.token.

Character Predicates

These are useful for providing to the sub-descriptions of a token.descriptions.LexicalDesc to specify behaviour for the lexer. Other than that, they aren't particularly useful.

Ungrouped