parsley
Members list
Packages
Type members
Classlikes
This class is used for a parser failure, and contains the error message.
This class is used for a parser failure, and contains the error message.
Type parameters
- Err
-
the type of the error message generated by the failing parse.
Value parameters
- _msg
-
the error message reported by the parser (passed lazily).
Attributes
- Companion
- object
- Source
- Result.scala
- Supertypes
Attributes
- Companion
- class
- Source
- Result.scala
- Supertypes
- Self type
-
Failure.type
This is the class that encapsulates the act of parsing and running an object of this class with parse
will parse the string given as input to parse
.
This is the class that encapsulates the act of parsing and running an object of this class with parse
will parse the string given as input to parse
.
Attributes
- Version
-
4.0.0
- Note
-
In order to construct an object of this class you must use the combinators; the class itself is opaque.
- Companion
- object
- Source
- Parsley.scala
- Supertypes
-
class AnyValtrait Matchableclass Any
This object contains the core "function-style" combinators: all parsers will likely require something from within!
This object contains the core "function-style" combinators: all parsers will likely require something from within!
In particular, it contains combinators for: controlling how input is consumed; injecting values into the parser, or failing; extracting position information from the parser; conditional execution of parsers; and more.
Attributes
- Companion
- class
- Source
- Parsley.scala
- Supertypes
- Self type
-
Parsley.type
This trait represents the result of a parser.
This trait represents the result of a parser.
Either a Success[A]
or a Failure
.
Type parameters
- A
-
the type of expected success result.
Attributes
- Source
- Result.scala
- Supertypes
- Known subtypes
This class is used for when a parser succeeds, and contains its result.
This class is used for when a parser succeeds, and contains its result.
Type parameters
- A
-
the type of expected success result.
Value parameters
- x
-
the result value of the successful parse.
Attributes
- Source
- Result.scala
- Supertypes
This module contains ap1
through ap22
, which allow for the application of a parser returning a function of arity N
to N
parsers.
This module contains ap1
through ap22
, which allow for the application of a parser returning a function of arity N
to N
parsers.
The combinators contained in this module all sequence a number of parsers together, but are capable of combining the results generated by these parsers into a single value with a function of the correct arity produced by the first parser. This is a clean way of putting together multiple parsers and getting a meaningful result out.
Attributes
- Since
-
4.0.0
- Example
-
scala> import parsley.character.char scala> import parsley.ap.{ap2, ap3} scala> case class Add(x: Int, y: Int) scala> val p = ap2(pure(Add), char('a').as(4), char('b').as(5)) scala> p.parse("ab") val res0 = Success(Add(4, 5)) scala> val q = ap3(pure((x: Int, y: Int, z: Int) => x * y + z), char('a').as(3), char('b').as(2), char('c').as(5)) scala> q.parse("abc") val res1 = Success(11) scala> q.parse("ab") val res2 = Failure(..)
- Source
- ap.scala
- Supertypes
- Self type
-
ap.type
This module contains many parsers to do with reading one or more characters.
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.
Attributes
- Since
-
2.2.0
- Source
- character.scala
- Supertypes
- Self type
-
character.type
This module contains a huge number of pre-made combinators that are very useful for a variety of purposes.
This module contains a huge number of pre-made combinators that are very useful for a variety of purposes.
In particular, it contains combinators for: performing a parser iteratively, collecting all the results; querying whether or not any input is left; optionally performing parsers; parsing delimited constructions; handling multiple possible alternatives or parsers to sequence; handling more complex conditional execution; and more.
Attributes
- Since
-
2.2.0
- Source
- combinator.scala
- Supertypes
- Self type
-
combinator.type
This module contains the very useful debugging combinator, as well as breakpoints.
This module contains the very useful debugging combinator, as well as breakpoints.
Attributes
- Source
- debug.scala
- Supertypes
- Self type
-
debug.type
These implicit classes can be used to extend the core combinator set of Parsley.
These implicit classes can be used to extend the core combinator set of Parsley.
This may mean that importing them enables combinators that can be used on non-Parsley
types, or might enable some syntactic sugar that is not part of the core combinator "style".
Attributes
- Source
- extension.scala
- Supertypes
- Self type
-
extension.type
This module contains the definition of 23 basic generic parser bridge traits, which are used to implement the Parser Bridge pattern for types that do not require metadata.
This module contains the definition of 23 basic generic parser bridge traits, which are used to implement the Parser Bridge pattern for types that do not require metadata.
The traits within are designed to be extended by the companion object of some case class that is produced as the result of a parser: by using these traits, it enables a new apply
method that makes it appear like the constructor is applied to the parsers themselves. This can be very useful for performing extra verification on the produced results, or to incorporate metadata into the result. Specifically, these traits are designed to be the bare-minimum functionaity, and do not interact with any metadata.
Attributes
- Since
-
4.0.0
- Source
- genericbridges.scala
- Supertypes
- Self type
-
genericbridges.type
This module contains utilities to have parsers interact with IO, including the very useful parseFromFile
method (exposed by ParseFromIO
)
This module contains lift1
through lift22
, which allow for the application of a function of arity N
to N
parsers.
This module contains lift1
through lift22
, which allow for the application of a function of arity N
to N
parsers.
The combinators contained in this module all sequence a number of parsers together, but are capable of combining the results generated by these parsers into a single value with a given function of the correct arity. This is a clean way of putting together multiple parsers and getting a meaningful result out.
Attributes
- Since
-
2.2.0
- Example
-
scala> import parsley.character.char scala> import parsley.lift.{lift2, lift3} scala> case class Add(x: Int, y: Int) scala> val p = lift2(Add, char('a').as(4), char('b').as(5)) scala> p.parse("ab") val res0 = Success(Add(4, 5)) scala> val q = lift3((x: Int, y: Int, z: Int) => x * y + z, char('a').as(3), char('b').as(2), char('c').as(5)) scala> q.parse("abc") val res1 = Success(11) scala> q.parse("ab") val res2 = Failure(..) scala> val q2 = lift3[Int, Int, Int, Int](_ * _ + _, char('a').as(3), char('b').as(2), char('c').as(5))
- Source
- lift.scala
- Supertypes
- Self type
-
lift.type
This module contains parsers that provide a way to extract position information during a parse.
This module contains parsers that provide a way to extract position information during a parse.
Position parsers can be important for when the final result of the parser needs to encode position information for later consumption: this is particularly useful for abstract syntax trees. Offset is also exposed by this interface, which may be useful for establishing a caret size in specialised error messages.
Attributes
- Since
-
4.2.0
- Source
- position.scala
- Supertypes
- Self type
-
position.type
This module contains all the functionality and operations for using and manipulating registers.
This module contains all the functionality and operations for using and manipulating registers.
These often have a role in performing context-sensitive parsing tasks, where a Turing-powerful system is required. While flatMap
is capable of such parsing, it is much less efficient than the use of registers, though slightly more flexible. In particular, the persist
combinator enabled by RegisterMethods
can serve as a drop-in replacement for flatMap
in many scenarios.
Attributes
- Since
-
2.2.0
- Source
- registers.scala
- Supertypes
- Self type
-
registers.type
This module contains many parsers to do with reading one or more characters.
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.
Attributes
- Since
-
4.4.0
- Source
- unicode.scala
- Supertypes
- Self type
-
unicode.type