implicit final class EagerOps[T] extends AnyVal
- Alphabetic
- By Inheritance
- EagerOps
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
macro
def
!(implicit ctx: P[Any]): P[String]
Capture operator; makes the parser return the span of input it parsed as a String, which can then be processed further using ~, map or flatMapX
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
macro
def
/(implicit ctx: P[_]): P[T]
Plain cut operator.
Plain cut operator. Runs the parser, and if it succeeds, backtracking past that point is now prohibited
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
macro
def
?[V](implicit optioner: Optioner[T, V], ctx: P[Any]): P[V]
Optional operator.
Optional operator. Parses the given input to wrap it in a
Some, but if parsing fails backtracks and returnsNone -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
macro
def
collect[V](f: PartialFunction[T, V]): P[V]
Transforms the result of this parser using the given partial function, failing the parse if the partial function is not defined on the result of the current parser.
Transforms the result of this parser using the given partial function, failing the parse if the partial function is not defined on the result of the current parser. This is eqivalent to
.filter(f.isDefinedAt).map(f.apply) -
macro
def
filter(f: (T) ⇒ Boolean)(implicit ctx: P[Any]): P[T]
Tests the output of the parser with a given predicate, failing the parse if the predicate returns false.
Tests the output of the parser with a given predicate, failing the parse if the predicate returns false. Useful for doing local validation on bits and pieces of your parsed output
-
macro
def
flatMap[V](f: (T) ⇒ P[V])(implicit whitespace: Whitespace): P[V]
Transforms the result of this parser using the given function into a new parser which is applied (after whitespace).
Transforms the result of this parser using the given function into a new parser which is applied (after whitespace). Useful for doing dependent parsing, e.g. when parsing JSON you may first parse a character to see if it's a
[,{, or", and then deciding whether you next want to parse an array, dictionary or string. -
macro
def
flatMapX[V](f: (T) ⇒ P[V]): P[V]
Transforms the result of this parser using the given function into a new parser which is applied (without consuming whitespace).
Transforms the result of this parser using the given function into a new parser which is applied (without consuming whitespace). Useful for doing dependent parsing, e.g. when parsing JSON you may first parse a character to see if it's a
[,{, or", and then deciding whether you next want to parse an array, dictionary or string. -
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
macro
def
map[V](f: (T) ⇒ V): P[V]
Transforms the result of this parser using the given function.
Transforms the result of this parser using the given function. Useful for turning the Strings captured by ! and the tuples built by ~ into your own case classes or data structure
- val parse0: P[T]
-
def
toString(): String
- Definition Classes
- Any
-
macro
def
|[V >: T](other: P[V])(implicit ctx: P[Any]): P[V]
Either-or operator: tries to parse the left-hand-side, and if that fails it backtracks and tries to pass the right-hand-side.
Either-or operator: tries to parse the left-hand-side, and if that fails it backtracks and tries to pass the right-hand-side. Can be chained more than once to parse larger numbers of alternatives.
-
macro
def
~[V, R](other: P[V])(implicit s: Sequencer[T, V, R], whitespace: Whitespace, ctx: P[_]): P[R]
Sequence operator.
Sequence operator. Runs two parsers one after the other, with optional whitespace in between.If both parsers return a value, this returns a tuple.
-
macro
def
~/[V, R](other: P[V])(implicit s: Sequencer[T, V, R], whitespace: Whitespace, ctx: P[_]): P[R]
Sequence-with-cut operator.
Sequence-with-cut operator. Runs two parsers one after the other, with optional whitespace in between. If the first parser completes successfully, backtracking is now prohibited. If both parsers return a value, this returns a tuple.
-
macro
def
~~[V, R](other: P[V])(implicit s: Sequencer[T, V, R], ctx: P[_]): P[R]
Raw sequence operator.
Raw sequence operator. Runs two parsers one after the other, *without* whitespace in between. If both parsers return a value, this returns a tuple.
-
macro
def
~~/[V, R](other: P[V])(implicit s: Sequencer[T, V, R], ctx: P[_]): P[R]
Raw sequence-with-cut operator.
Raw sequence-with-cut operator. Runs two parsers one after the other, *without* whitespace in between. If the first parser completes successfully, backtracking is no longer prohibited. If both parsers return a value, this returns a tuple.