lift
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
- Graph
-
- Supertypes
- Self type
-
lift.type
Members list
Value members
Concrete methods
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.
Value parameters
- f
-
the function to map across the given parser
Attributes
- Returns
-
a parser that applies the function
f
to the result of the given parser. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity ten.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity eleven.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity twelve.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity thirteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity fourteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity fifteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity sixteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity seventeen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity eighteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity nineteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity two.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity twenty.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity twenty-one.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity twenty-two.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity three.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity four.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity five.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity six.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity seven.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity eight.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala
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.
Value parameters
- f
-
a function to apply to the results of the parsers with arity nine.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- lift.scala