object character
This module contains many parsers to do with reading one or more characters. Almost every parser will need something from this module.
- Since
2.2.0
- Alphabetic
- By Inheritance
- character
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val alphaNum: Parsley[Char]
Parses a letter or digit.
Parses a letter or digit. Returns the parsed character.
- val anyChar: Parsley[Char]
The parser
anyChar
accepts any kind of character.The parser
anyChar
accepts any kind of character. Returns the accepted character. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def char(c: Char): Parsley[Char]
Reads a character from the input stream and returns it, else fails if the character is not found at the head of the stream.
Reads a character from the input stream and returns it, else fails if the character is not found at the head of the stream.
- c
The character to search for
- returns
c
if it can be found at the head of the input
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- val crlf: Parsley[Char]
Parses a carriage return character '\r' followed by a newline character '\n', returns the newline character.
- val digit: Parsley[Char]
Parses a digit.
Parses a digit. Returns the parsed character.
- val endOfLine: Parsley[Char]
Parses a CRLF or LF end-of-line.
Parses a CRLF or LF end-of-line. Returns a newline character ('\n').
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val hexDigit: Parsley[Char]
Parses a hexadecimal digit.
Parses a hexadecimal digit. Returns the parsed character.
- def isHexDigit(c: Char): Boolean
Helper function, equivalent to the predicate used by hexDigit.
Helper function, equivalent to the predicate used by hexDigit. Useful for providing to LanguageDef
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isOctDigit(c: Char): Boolean
Helper function, equivalent to the predicate used by octDigit.
Helper function, equivalent to the predicate used by octDigit. Useful for providing to LanguageDef
- def isSpace(c: Char): Boolean
Helper function, equivalent to the predicate used by space.
Helper function, equivalent to the predicate used by space. Useful for providing to LanguageDef
- def isWhitespace(c: Char): Boolean
Helper function, equivalent to the predicate used by whitespace.
Helper function, equivalent to the predicate used by whitespace. Useful for providing to LanguageDef
- val letter: Parsley[Char]
Parses a letter.
Parses a letter. Returns the parsed character.
- val lower: Parsley[Char]
Parses a lower case letter.
Parses a lower case letter. Returns the parsed character.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val newline: Parsley[Char]
Parses a newline character ('\n').
Parses a newline character ('\n'). Returns a newline character.
- def noneOf(cs: Char*): Parsley[Char]
As the dual of
oneOf
,noneOf(cs)
succeeds if the current character is not in the supplied sequence of characterscs
.As the dual of
oneOf
,noneOf(cs)
succeeds if the current character is not in the supplied sequence of characterscs
. Returns the parsed character. - def noneOf(cs: Set[Char]): Parsley[Char]
As the dual of
oneOf
,noneOf(cs)
succeeds if the current character is not in the supplied set of characterscs
.As the dual of
oneOf
,noneOf(cs)
succeeds if the current character is not in the supplied set of characterscs
. Returns the parsed character. - final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val octDigit: Parsley[Char]
Parses an octal digit.
Parses an octal digit. Returns the parsed character.
- def oneOf(cs: Char*): Parsley[Char]
oneOf(cs)
succeeds if the current character is in the supplied sequence of characterscs
.oneOf(cs)
succeeds if the current character is in the supplied sequence of characterscs
. Returns the parsed character. See alsosatisfy
. - def oneOf(cs: Set[Char]): Parsley[Char]
oneOf(cs)
succeeds if the current character is in the supplied set of characterscs
.oneOf(cs)
succeeds if the current character is in the supplied set of characterscs
. Returns the parsed character. See alsosatisfy
. - def satisfy(f: (Char) => Boolean): Parsley[Char]
Reads a character from the head of the input stream if and only if it satisfies the given predicate.
Reads a character from the head of the input stream if and only if it satisfies the given predicate. Else it fails without consuming the character.
- f
The function to test the character on
- returns
c
iff(c)
is true.
- val space: Parsley[Char]
Parses a whitespace character (either ' ' or '\t').
Parses a whitespace character (either ' ' or '\t'). Returns the parsed character.
- val spaces: Parsley[Unit]
Skips zero or more whitespace characters.
Skips zero or more whitespace characters. See also
skipMany
. Uses space. - def string(s: String): Parsley[String]
Reads a string from the input stream and returns it, else fails if the string is not found at the head of the stream.
Reads a string from the input stream and returns it, else fails if the string is not found at the head of the stream.
- s
The string to match against
- returns
s
if it can be found at the head of the input
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val tab: Parsley[Char]
Parses a tab character ('\t').
Parses a tab character ('\t'). Returns a tab character.
- def toString(): String
- Definition Classes
- AnyRef → Any
- val upper: Parsley[Char]
Parses an upper case letter.
Parses an upper case letter. Returns the parsed character.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- val whitespace: Parsley[Char]
Parses a whitespace character (' ', '\t', '\n', '\r', '\f', '\v').
Parses a whitespace character (' ', '\t', '\n', '\r', '\f', '\v'). Returns the parsed character.
- val whitespaces: Parsley[Unit]
Skips zero or more whitespace characters.
Skips zero or more whitespace characters. See also
skipMany
. Uses whitespace.
This is the documentation for Parsley.
Package structure
The parsley package contains the
Parsley
class, as well as theResult
,Success
, andFailure
types. In addition to these, it also contains the following packages and "modules" (a module is defined as being an object which mocks a package):parsley.Parsley
contains the bulk of the core "function-style" combinators, as well as the implicit classes which enable the "method-style" combinators.parsley.combinator
contains many helpful combinators that simplify some common parser patterns.parsley.character
contains the combinators needed to read characters and strings, as well as combinators to match specific sub-sets of characters.parsley.debug
contains debugging combinators, helpful for identifying faults in parsers.parsley.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 parsingparsley.expr.precedence
is a builder for expression parsers built on a precedence table.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 aParsley[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.errors.combinator
provides combinators that can be used to either produce more detailed errors as well as refine existing errors.parsley.lift
contains functions which lift functions that work on regular types to those which now combine the results of parsers returning those same types. these are ubiquitous.parsley.registers
contains combinators that interact with the context-sensitive functionality in the form of registers.parsley.token
contains theLexer
class that provides a host of helpful lexing combinators when provided with the description of a language.parsley.unsafe
contains unsafe (and not thread-safe) ways of speeding up the execution of a parser.