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
- Grouped
- Alphabetic
- By Inheritance
- quick
- ap
- lift
- position
- character
- combinator
- ParsleyImpl
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type Parsley[+A] = parsley.Parsley[A]
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
- 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 otherap
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 frompf
to the resultx
of the parserp1
.
- Definition Classes
- ap
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- 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 functionf
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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- 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, thenatomic(p)
has no effect. However, ifp
failed, then any input that it consumed is rolled back. This ensures that the parserp
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
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
Example: - 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
- 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 eitherleft
orright
depending on its result.This combinator parses its first argument
either
, and then parses eitherleft
orright
depending on its result.First,
branch(either, left, right)
parseseither
, which, if successful, will produce either aLeft(x)
or aRight(y)
. If aLeft(x)
is produced, the parserleft
is executed to produce a functionf
, andf(x)
is returned. Otherwise, if aRight(y)
is produced, the parserright
is executed to produce a functiong
, andg(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 aLeft
.- right
a parser to execute if
either
returns aRight
.- returns
a parser that will parse one of
left
orright
depending oneither
's result.
- Definition Classes
- ParsleyImpl
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)) }
Example: - 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
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
orunicode.char
.
Example: - 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
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
Example: - def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- 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
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.
Example: - final def count(min: Int, max: Int)(p: parsley.Parsley[_]): parsley.Parsley[Int]
This combinator parses between
min
andmax
occurrences ofp
, returning the number of successes.This combinator parses between
min
andmax
occurrences ofp
, returning the number of successes.Parses
p
repeatedly a minimum ofmin
times and up tomax
times both inclusive. Ifp
fails beforemin
is reached, then this combinator fails. It is not required forp
to fail after themax
th parse. The results are discarded and the number of successful parses ofp
,n
, is returned instead, such thatmin <= 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
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
Example: - 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. Ifp
failed having consumed input, this combinator fails. Otherwise whenp
fails without consuming input, this combinator will succeed. The number of timesp
succeeded is returned as the result.- p
the parser to execute multiple times.
- returns
the number of times
p
successfully parses
- Definition Classes
- combinator
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
Example: - 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. Ifp
failed having consumed input, this combinator fails. Otherwise whenp
fails without consuming input, this combinator will succeed. The parserp
must succeed at least once. The number of timesp
succeeded is returned as the result.- p
the parser to execute multiple times.
- returns
the number of times
p
successfully parses
- Definition Classes
- combinator
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
Example: - 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 usingatomic
.- Definition Classes
- character
- final def decide[A](p: parsley.Parsley[Option[A]], q: => parsley.Parsley[A]): parsley.Parsley[A]
This combinator parses
q
depending only ifp
returns aNone
.This combinator parses
q
depending only ifp
returns aNone
.First parses
p
. Ifp
returnedSome(x)
, thenx
is returned. Otherwise, ifp
returnedNone
thenq
is parsed, producingy
, andy
is returned. Ifp
orq
fails, the combinator fails.- p
the first parser, which returns an
Option
to eliminate.- q
a parser to execute when
p
returnsNone
, to provide a value of typeA
.- returns
a parser that either just parses
p
or bothp
andq
in order to return anA
.
- Definition Classes
- combinator
decide(option(p), q) = p <|> q
Example: - final def decide[A](p: parsley.Parsley[Option[A]]): parsley.Parsley[A]
This combinator can eliminate an
Option
from the result of the parserp
.This combinator can eliminate an
Option
from the result of the parserp
.First parse
p
, if it succeeds returningSome(x)
, then returnx
. However, ifp
fails, or returnedNone
, 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
decide(option(p)) = p
Example: - 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
- the Latin digits
- 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
- 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
scala> import parsley.Parsley.empty scala> empty.parse("") val res0 = Failure(..)
- Note
equivalent to
empty(0)
Example: - 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 bysep
.This combinator parses zero or more occurrences of
p
, separated and ended bysep
.Behaves just like
endBy1
, except does not require an initialp
andsep
, 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 bysep
, returning the list ofp
's results.
- Definition Classes
- combinator
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))
Example: - 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 bysep
.This combinator parses one or more occurrences of
p
, separated and ended bysep
.Parses
p
followed bysep
one or more times. The results of thep
's,x1
throughxn
, are returned asList(x1, .., xn)
. Ifp
orsep
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 bysep
, returning the list ofp
's results.
- Definition Classes
- combinator
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))
Example: - final val endOfLine: parsley.Parsley[Char]
This parser will parse either a line feed (
LF
) or aCRLF
newline, returning'\n'
if successful.This parser will parse either a line feed (
LF
) or aCRLF
newline, returning'\n'
if successful.- Definition Classes
- character
- See also
- 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
scala> import parsley.combinator.eof scala> eof.parse("a") val res0 = Failure(..) scala> eof.parse("") val res1 = Success(())
- Since
4.5.0
Example: - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def exactly[A](n: Int, p: parsley.Parsley[A]): parsley.Parsley[List[A]]
This combinator parses exactly
n
occurrences ofp
, returning thesen
results in a list.This combinator parses exactly
n
occurrences ofp
, returning thesen
results in a list.Parses
p
repeatedly up ton
times. Ifp
fails beforen
is reached, then this combinator fails. It is not required forp
to fail after then
th parse. The results produced byp
,x1
throughxn
, are returned asList(x1, .., xn)
.- n
the number of times to repeat
p
.- p
the parser to repeat.
- returns
a parser that parses
p
exactlyn
times, returning a list of the results.
- Definition Classes
- combinator
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
Example: - def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- 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
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
Example: - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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 returnstrue
, thisguard(p)
succeeds. Otherwise, ifp
either fails, or returnsfalse
,guard(p)
will fail.- p
the parser that yields the condition value.
- Definition Classes
- combinator
guard(pure(true)) == unit guard(pure(false)) == empty when(p.map(!_), empty) == guardS(p)
Example: - def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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):
- the digits
'0'
through'9'
- the letters
'a'
through'f'
- the letters
'A'
through'Z'
- Definition Classes
- character
- See also
- the digits
- 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
orelseP
depending on the result of parsingcondP
.This combinator parses one of
thenP
orelseP
depending on the result of parsingcondP
.This is a lifted
if
-statement. First, parsecondP
: if it is successful and returnstrue
, then parsethenP
; else, if it returnedfalse
, parseelseP
; or, ifcondP
failed then fail. If either ofthenP
orelseP
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
orelseP
aftercondP
.
- Definition Classes
- combinator
ifS(pure(true), p, _) == p ifS(pure(false), _, p) == p
- Since
4.5.0
Example: - 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):
- the digits
'0'
through'9'
- the letters
'a'
through'f'
- the letters
'A'
through'Z'
- an equivalent from another charset
- Definition Classes
- character
- See also
- the digits
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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
- 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
- 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
.
- 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:- Uppercase Letter (
Lu
) - Lowercase Letter (
Ll
) - Titlecase Letter (
Lt
) - Modifier Letter (
Lm
) - Other Letter (
Lo
)
The full list of codepoints found in a category can be found in the Unicode Character Database.
- Definition Classes
- character
- Uppercase Letter (
- final val letterOrDigit: parsley.Parsley[Char]
This parser tries to parse either a letter or a digit, and returns it if successful.
- 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 otherlift
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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
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)
Example: - 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, thenlookAhead(p)
will roll back any input consumed whilst parsingp
. Ifp
fails, however, then the whole combinator fails and any input consumed remains consumed. If this behaviour is not desirable, consider pairinglookAhead
withatomic
.- 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
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
Example: - 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
- the Latin letters
- 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. Ifp
failed having consumed input, this combinator fails. Otherwise whenp
fails without consuming input, this combinator will return all of the results,x1
throughxn
(withn >= 0
), in a list:List(x1, .., xn)
. Ifp
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
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
Example: - 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. Ifp
failed having consumed input, this combinator fails. Otherwise whenp
fails without consuming input, this combinator will return all of the results,x1
throughxm
(withm >= n
), in a list:List(x1, .., xm)
. Ifp
was not successful at leastn
times, this combinator fails.- n
the minimum number of
p
s 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
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)
andsome(p) == many(1, p)
.
Example: - 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 parsesp
, which must succeed. This repeats untilend
succeeds. Whenend
does succeed, this combinator will return all of the results generated byp
,x1
throughxn
(withn >= 0
), in a list:List(x1, .., xn)
. Ifend
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
untilend
succeeds, returning the list of all the successful results.
- Definition Classes
- combinator
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
Example: - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- 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 orCRLF
.- Definition Classes
- character
- 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
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
Example: - 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
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
Example: - 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
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
Example: - final def notFollowedBy(p: parsley.Parsley[_]): parsley.Parsley[Unit]
This combinator parses its argument
p
, and succeeds whenp
fails and vice-versa, never consuming input.This combinator parses its argument
p
, and succeeds whenp
fails and vice-versa, never consuming input.If the parser
p
succeeds, thennotFollowedBy(p)
will fail, consuming no input. Otherwise, shouldp
fail, thennotFollowedBy(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
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) }
Example: - final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- 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
- 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
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.
Example: - 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
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
Example: - 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
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
Example: - 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
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
Example: - final def option[A](p: parsley.Parsley[A]): parsley.Parsley[Option[A]]
This combinator tries to parse
p
, wrapping its result in aSome
if it succeeds, or returnsNone
if it fails.This combinator tries to parse
p
, wrapping its result in aSome
if it succeeds, or returnsNone
if it fails.Tries to parse
p
. Ifp
succeeded, producingx
, thenSome(x)
is returned. Otherwise, ifp
failed without consuming input, thenNone
is returned instead.- p
the parser to try to parse.
- returns
a parser that tries to parse
p
, but can still succeed withNone
if that was not possible.
- Definition Classes
- combinator
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(..)
Example: - 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
. Ifp
succeeds, or fails without consuming input then this combinator is successful. Otherwise, ifp
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
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, ())
.
Example: - 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
. Ifp
succeeds, or fails without consuming input then this combinator is successful and returnsx
. Otherwise, ifp
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
, returningx
regardless of success or failure.
- Definition Classes
- combinator
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(..)
Example: - 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
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.
Example: - 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
scala> import parsley.Parsley.pure scala> pure(7).parse("") val res0 = Success(7) scala> pure("hello!").parse("a") val res1 = Success("hello!")
Example: - final def range[A](min: Int, max: Int)(p: parsley.Parsley[A]): parsley.Parsley[List[A]]
This combinator parses between
min
andmax
occurrences ofp
, returning thesen
results in a list.This combinator parses between
min
andmax
occurrences ofp
, returning thesen
results in a list.Parses
p
repeatedly a minimum ofmin
times and up tomax
times both inclusive. Ifp
fails beforemin
is reached, then this combinator fails. It is not required forp
to fail after themax
th parse. The results produced byp
,xmin
throughxmax
, are returned asList(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
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
Example: - 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 characterc
can be read andpred(c)
is true, thenc
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 thatpred(c)
is true, or fails.
- Definition Classes
- character
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
.
Example: - 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 characterc
can be read andf(c)
is defined, thenc
is consumed andf(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 thatf(c)
is defined, and returnsf(c)
if so, or fails.
- Definition Classes
- character
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
.
Example: - 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 parsesq
only ifp
returns aLeft
.This combinator parses its first argument
p
, then parsesq
only ifp
returns aLeft
.First,
select(p, q)
parsesp
, which, if successful, will produce either aLeft(x)
or aRight(y)
. If aLeft(x)
is produced, then the parserq
is executed to produce a functionf
, andf(x)
is returned. Otherwise, if aRight(y)
is produced,y
is returned unmodified andq
is not parsed. If eitherp
orq
fails, the entire combinator fails. This is a special case ofbranch
where the right branch ispure(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 aLeft
.- returns
a parser that will parse
p
then possibly parseq
to transformp
's result into aB
.
- Definition Classes
- ParsleyImpl
def filter(pred: A => Boolean): Parsley[A] = { val p = this.map(x => if (pred(x)) Right(x) else Left(())) select(p, empty) }
Example: - 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 bysep
.This combinator parses zero or more occurrences of
p
, separated bysep
.Behaves just like
sepBy1
, except does not require an initialp
, 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 bysep
, returning the list ofp
's results.
- Definition Classes
- combinator
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
Example: - 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 bysep
.This combinator parses one or more occurrences of
p
, separated bysep
.First parses a
p
. Then parsessep
followed byp
until there are no moresep
s. The results of thep
's,x1
throughxn
, are returned asList(x1, .., xn)
. Ifp
orsep
fails having consumed input, the whole parser fails. Requires at least onep
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 bysep
, returning the list ofp
's results.
- Definition Classes
- combinator
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
Example: - 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 bysep
.This combinator parses zero or more occurrences of
p
, separated and optionally ended bysep
.Behaves just like
sepEndBy1
, except does not require an initialp
, 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 bysep
, returning the list ofp
's results.
- Definition Classes
- combinator
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))
Example: - 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 bysep
.This combinator parses one or more occurrences of
p
, separated and optionally ended bysep
.First parses a
p
. Then parsessep
followed byp
until there are no more: if a finalsep
exists, this is parsed. The results of thep
's,x1
throughxn
, are returned asList(x1, .., xn)
. Ifp
orsep
fails having consumed input, the whole parser fails. Requires at least onep
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 bysep
, returning the list ofp
's results.
- Definition Classes
- combinator
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))
Example: - 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 ofp1
throughpn
, parses each in order. If they all succeed, producing the resultsx1
throughxn
, thenList(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
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
Example: - 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. Ifp
failed having consumed input, this combinator fails. Otherwise whenp
fails without consuming input, this combinator will return all of the results,x1
throughxn
(withn >= 1
), in a list:List(x1, .., xn)
. Ifp
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
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
Example: - 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 parsep
. If it succeed then it will repeatedly: try to parseend
, if it fails without consuming input, then parsesp
, which must succeed. Whenend
does succeed, this combinator will return all of the results generated byp
,x1
throughxn
(withn >= 1
), in a list:List(x1, .., xn)
. The parserp
must succeed at least once beforeend
succeeds.- p
the parser to execute multiple times.
- end
the parser that stops the parsing of
p
.- returns
a parser that parses
p
untilend
succeeds, returning the list of all the successful results.
- Definition Classes
- combinator
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
Example: - 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
- 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
- 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
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.
Example: - 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 aString
and returned. This combinator can never fail, sincesatisfy
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
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.
Example: - 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 tomany(pc).map(_.mkString)
, but it usesStringBuilder
, 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
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
Example: - 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 aString
and returned. This combinator can never fail having consumed input, sincesatisfy
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
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.
Example: - 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 tomany(pc).map(_.mkString)
, but it usesStringBuilder
, 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
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
Example: - 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
(andkv0
), until one of them succeeds.This combinator tries to parse each of the key-value pairs
kvs
(andkv0
), 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 asatomicChoice(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 thanatomicChoice
.- 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
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.
Example: - final def strings(str0: String, strs: String*): parsley.Parsley[String]
This combinator tries to parse each of the strings
strs
(andstr0
), until one of them succeeds.This combinator tries to parse each of the strings
strs
(andstr0
), until one of them succeeds.Unlike
choice
, or more accuratelyatomicChoice
, 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 thanatomicChoice
.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
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
Example: - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- 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
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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
toxs
, in order, collecting the results.This combinator will parse each of the parsers generated by applying
f
toxs
, in order, collecting the results.Given the values
xs
, consisting ofx1
throughxn
, first creates the parsesf(x1)
throughf(xn)
and then calledsequence
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 ofxs
.
- Definition Classes
- combinator
// 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
Example: - 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
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.
Example: - 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
- the Latin letters
- 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()
- final def whenS(condP: parsley.Parsley[Boolean])(thenP: => parsley.Parsley[Unit]): parsley.Parsley[Unit]
This combinator conditionally parses
thenP
depending on the result of parsingcondP
.This combinator conditionally parses
thenP
depending on the result of parsingcondP
.This is a lifted
if
-statement. First, parsecondP
: if it is successful and returnstrue
, then parsethenP
; else, if it returnedfalse
do nothing; or, ifcondP
failed then fail. IfthenP
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
aftercondP
.
- Definition Classes
- combinator
whenS(pure(true), p) == p whenS(pure(false), _) == unit
Example: - final def whileS(p: parsley.Parsley[Boolean]): parsley.Parsley[Unit]
This combinator repeatedly parses
p
so long as it returnstrue
.This combinator repeatedly parses
p
so long as it returnstrue
.This is a lifted
while
-loop. First, parsep
: if it is successful and returnstrue
, then repeat; else if it returnedfalse
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 returnsfalse
.
- Definition Classes
- combinator
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)) }
Example: - 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:
- a space (
' '
) - a tab (
'\t'
) - a line feed (
'\n'
) - a carriage return (
'\r'
) - a form feed (
'\f'
) - a vertical tab (
'\u000B'
)
- Definition Classes
- character
- a space (
- 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
- 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 parserp
, then executesp
. Ifp
succeeds, then theoffset
is taken again, and the two values are subtracted to give widthw
. The result ofp
,x
is returned along withw
as(x, w)
. Ifp
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
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.
Example:
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 p
s 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.
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.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 parsingparsley.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 inchain
.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.errors.combinator
provides combinators that can be used to either produce more detailed errors as well as refine existing errors.parsley.errors.tokenextractors
provides mixins for common token extraction strategies during error message generation: these can be used to avoid implementingunexpectedToken
in theErrorBuilder
.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 theLexer
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.