Packages

  • package root

    This is the documentation for Parsley.

    This is the documentation for Parsley.

    Package structure

    The parsley package contains the Parsley class, as well as the Result, Success, and Failure types. In addition to these, it also contains the following packages and "modules" (a module is defined as being an object which mocks a package):

    • parsley.Parsley contains the bulk of the core "function-style" combinators.
    • parsley.combinator contains many helpful combinators that simplify some common parser patterns.
    • parsley.character contains the combinators needed to read characters and strings, as well as combinators to match specific sub-sets of characters.
    • parsley.debug contains debugging combinators, helpful for identifying faults in parsers.
    • parsley.extension contains syntactic sugar combinators exposed as implicit classes.
    • parsley.io contains extension methods to run parsers with input sourced from IO sources.
    • parsley.expr contains the following sub modules:
      • parsley.expr.chain contains combinators used in expression parsing
      • parsley.expr.precedence is a builder for expression parsers built on a precedence table.
      • parsley.expr.infix contains combinators used in expression parsing, but with more permissive types than their equivalents in chain.
      • parsley.expr.mixed contains combinators that can be used for expression parsing, but where different fixities may be mixed on the same level: this is rare in practice.
    • parsley.implicits contains several implicits to add syntactic sugar to the combinators. These are sub-categorised into the following sub modules:
      • parsley.implicits.character contains implicits to allow you to use character and string literals as parsers.
      • parsley.implicits.combinator contains implicits related to combinators, such as the ability to make any parser into a Parsley[Unit] automatically.
      • parsley.implicits.lift enables postfix application of the lift combinator onto a function (or value).
      • parsley.implicits.zipped enables boths a reversed form of lift where the function appears on the right and is applied on a tuple (useful when type inference has failed) as well as a .zipped method for building tuples out of several combinators.
    • parsley.errors contains modules to deal with error messages, their refinement and generation.
    • parsley.lift contains functions which lift functions that work on regular types to those which now combine the results of parsers returning those same types. these are ubiquitous.
    • parsley.ap contains functions which allow for the application of a parser returning a function to several parsers returning each of the argument types.
    • parsley.registers contains combinators that interact with the context-sensitive functionality in the form of registers.
    • parsley.token contains the Lexer class that provides a host of helpful lexing combinators when provided with the description of a language.
    • parsley.position contains parsers for extracting position information.
    • parsley.genericbridges contains some basic implementations of the Parser Bridge pattern (see Design Patterns for Parser Combinators in Scala, or the parsley wiki): these can be used before more specialised generic bridge traits can be constructed.
    Definition Classes
    root
  • package parsley
    Definition Classes
    root
  • package 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
  • package implicits

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

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

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

    Definition Classes
    parsley
  • 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
  • Failure
  • Parsley
  • Result
  • Success
  • ap
  • character
  • combinator
  • debug
  • extension
  • genericbridges
  • io
  • lift
  • position
  • registers
o

parsley

character

object character

This module contains many parsers to do with reading one or more characters. Almost every parser will need something from this module.

In particular, this module contains: combinators that can read specific characters; combinators that represent character classes and their negations; combinators for reading specific strings; as well as a selection of pre-made parsers to parse specific kinds of character, like digits and letters.

Source
character.scala
Since

2.2.0

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

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. val bit: Parsley[Char]

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

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

    A bit (binary digit) is either '0' or '1'.

  6. def char(c: Char): 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.

    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.

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. val crlf: 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 attempt.

  9. val digit: 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.

  10. val endOfLine: 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.

    See also

    crlf

  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. val hexDigit: 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'
    See also

    isHexDigit

  17. 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'
    See also

    hexDigit

  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. 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).

    See also

    octDigit

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

    See also

    space

  21. def isWhitespace(c: Char): Boolean

    This function returns true if a character is a whitespace character.

    This function returns true if a character is a whitespace character.

    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')
    See also

    whitespace

  22. val item: 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.

    Note

    this combinator can only handle 16-bit characters.

  23. val letter: 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.

  24. val letterOrDigit: 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.

    See also

    documentation for letter.

    documentation for digit.

  25. val lower: 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.

  26. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. val newline: 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.

  28. def noneOf(cs: NumericRange[Char]): 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.

    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.

    See also

    satisfy

  29. def noneOf(cs: Char*): 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.

    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.

    See also

    satisfy

  30. def noneOf(cs: Set[Char]): 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.

    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.

    See also

    satisfy

  31. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  32. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  33. val octDigit: 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).

    See also

    isOctDigit

  34. def oneOf(cs: NumericRange[Char]): 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.

    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.

    See also

    satisfy

  35. def oneOf(cs: Char*): 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.

    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.

    See also

    satisfy

  36. def oneOf(cs: Set[Char]): 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.

    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.

    See also

    satisfy

  37. def satisfy(pred: (Char) => Boolean): 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.

    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.

  38. val space: 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

    See also

    isSpace

  39. val spaces: Parsley[Unit]

    This parser skips zero or more space characters using space.

    This parser skips zero or more space characters using space.

    See also

    combinator.skipMany

  40. def string(s: String): 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.

    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.

  41. def stringOfMany(pc: Parsley[Char]): 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.

    Example:
    1. scala> import parsley.character.{letter, letterOrDigit, stringOfMany}
      scala> import parsley.implicits.zipped.Zipped2
      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

  42. def stringOfSome(pc: Parsley[Char]): 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.

    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

  43. def strings[A](kv0: (String, Parsley[A]), kvs: (String, Parsley[A])*): 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 attemptChoice(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 favour 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 attemptChoice.

    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.

    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 attempt around the values will not affect this behaviour.

  44. def strings(str0: String, strs: String*): 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 attemptChoice, this combinator will not necessarily parse the strings in the order provided. It will favour 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 attemptChoice.

    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.

    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

  45. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  46. val tab: 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.

  47. def toString(): String
    Definition Classes
    AnyRef → Any
  48. val upper: 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.

  49. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  50. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  51. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  52. val whitespace: 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')
    See also

    isWhitespace

  53. val whitespaces: Parsley[Unit]

    This parser skips zero or more space characters using whitespace.

    This parser skips zero or more space characters using whitespace.

    See also

    combinator.skipMany

Inherited from AnyRef

Inherited from Any

Core Combinators and Parsers

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

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.

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.

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, satisfyUtf16 or charUtf16.

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