Returns a parser that repeatedly applies this parser.
Returns a parser that repeatedly applies this parser. It will always succeed, potentially with an empty list as the result.
Returns a parser that repeatedly applies this parser (at least once).
Returns a parser that repeatedly applies this parser (at least once).
Applies the specified parser to the input left over by this parser, but only keeps the left result.
Applies the specified parser to the input left over by this parser, but only keeps the left result.
a <~ b
only succeeds if both parsers succeed.
Operator synonym for flatMap
.
Operator synonym for flatMap
.
Returns a parser that optionally parses what this parser parses.
Returns a parser that optionally parses what this parser parses.
Returns a parser that applies a partial function to the result of this parser.
Returns a parser that applies a partial function to the result of this parser.
p ^? f
succeeds if
p succeeds and
f is defined at the result of
p,
In that case it returns
f applied to the result of
p.
a partial function that will be applied to this parser's result.
an optional function that takes the same argument as f
and produces an error message.
A synonym for map
, allowing the grammar to be declared in a concise way.
A synonym for map
, allowing the grammar to be declared in a concise way.
Returns a parser that applies a function to the result of this parser producing an Either
where Left
is interpreted as failure.
Returns a parser that applies a function to the result of this parser producing an Either
where Left
is interpreted as failure. It is an alternative to ^?
for scenarios
where the conditional check cannot be easily performed in a pattern match.
p ^^? f
succeeds if
p succeeds and
f returns a
Right when applied to the result
of
p.
Returns a parser that ignores the result of this parser (if it succeeds) and returns the specified result instead.
Returns a parser that ignores the result of this parser (if it succeeds) and returns the specified result instead.
Subclasses may override this method to avoid any expensive result processing.
Builds a new parser by applying the specified function to the result of this parser and subsequently applying the parser returned by that function to the input left over by this parser.
Builds a new parser by applying the specified function to the result of this parser and subsequently applying the parser returned by that function to the input left over by this parser.
Builds a new parser by applying the specified function to the result of this parser.
Builds a new parser by applying the specified function to the result of this parser.
Applies the specified parser when this parser fails.
Applies the specified parser when this parser fails.
a orElse b
succeeds if either of the parsers succeeds.
Implementation note: The parameter is by-name to allow the definition of recursive parsers. In contrast to the former SDK parser combinators this is the only place where a parser with a by-name parameter is used whereas in all other places the additional cost is avoided.
Parses the string content in the specified context and returns the result.
Parses the specified string and returns the result.
Parses the specified string and returns the result.
Returns a parser that repeatedly applies this parser.
Returns a parser that repeatedly applies this parser.
The returned parser offers an API to specify further constraints
like min
or max
.
Returns a parser that invokes the specified function repeatedly, passing the result of this parser if it succeeds, to produce new parsers that get applied until one of them fails.
Returns a parser that invokes the specified function repeatedly, passing the result of this parser if it succeeds, to produce new parsers that get applied until one of them fails.
The result of the returned parser is a list containing the result of this parser (if it succeeds) plus the results of successful invocations of the parsers returned by the specified function.
Changes the failure message produced by a parser.
Changes the failure message produced by a parser.
Applies the specified parser when this parser fails.
Applies the specified parser when this parser fails.
a | b
succeeds if either of the parsers succeeds.
Implementation note: The parameter is by-name to allow the definition of recursive parsers. In contrast to the former SDK parser combinators this is the only place where a parser with a by-name parameter is used whereas in all other places the additional cost is avoided.
Applies the specified parser to the input left over by this parser and combines the two results.
Applies the specified parser to the input left over by this parser and combines the two results.
a ~ b
only succeeds if both parsers succeed, with the results
in a wrapper class named ~
for convenient pattern matching:
a ~ b ~ c ^^ { case a ~ b ~ c => processResult(a, b, c) }
Applies the specified parser to the input left over by this parser, but only keeps the right result.
Applies the specified parser to the input left over by this parser, but only keeps the right result.
a ~> b
only succeeds if both parsers succeed.
A parser that matches a literal string.