PrefixCharacters
A variant of the Characters type that can be used as a stable prefix for an optimized
span parser as it is always non-empty. It's created by the oneOf
method in TextParsers
and usually not used directly.
Value members
Concrete methods
Creates and returns a new parser that does not produce a string result, but instead
only the number of characters successfully parsed as an Int
.
Creates and returns a new parser that does not produce a string result, but instead
only the number of characters successfully parsed as an Int
.
- Definition Classes
Creates and returns a new parser that consumes at most the specified maximum number of characters. Always succeeds, unless a minimum number of matches is also specified.
Creates and returns a new parser that consumes at most the specified maximum number of characters. Always succeeds, unless a minimum number of matches is also specified.
Creates and returns a new parser that fails if it does not consume the specified minimum number of characters. It may still consume more characters in case of further matches.
Creates and returns a new parser that fails if it does not consume the specified minimum number of characters. It may still consume more characters in case of further matches.
Creates and returns a new parser that consumes exactly the specified number of characters.
Fails if there are less matches, but succeeds in case there are more matches, simply ignoring them.
Calling take 3
for example is equivalent to calling min 3 max 3
.
Creates and returns a new parser that consumes exactly the specified number of characters.
Fails if there are less matches, but succeeds in case there are more matches, simply ignoring them.
Calling take 3
for example is equivalent to calling min 3 max 3
.
Inherited methods
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. It will always succeed, potentially with an empty list as the result.
- Inherited from:
- Parser
Returns a parser that repeatedly applies this parser (at least once).
Returns a parser that repeatedly applies this parser (at least once).
- Inherited from:
- Parser
Returns a parser that optionally parses what this parser parses.
Returns a parser that optionally parses what this parser parses.
- Inherited from:
- Parser
Handle any error, potentially recovering from it, by mapping it to a new parser that will be applied at the same starting position than the failing parser.
Handle any error, potentially recovering from it, by mapping it to a new parser that will be applied at the same starting position than the failing parser.
This is similar to the orElse
or |
method, but allows the alternative
parser to inspect the error of the preceding one.
- See also:
recoverWith to recover from only certain errors.
- Inherited from:
- 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.
This is a specialized variant of the orElse
method of the
base trait that preserves the nature of the PrefixedParser
if both original parsers implement this trait.
- Inherited from:
- PrefixedParser
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.
In case both parsers fail, the Failure
instance will
be from the parser with the most successfully read characters.
In the case of multiple failures having the same number of characters,
the one with the highest precedence (this parser) will be chosen.
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.
- Inherited from:
- Parser
Parses the specified string and returns the result.
Parses the specified string and returns the result.
- Inherited from:
- Parser
Handle certain errors, potentially recovering from it, by mapping them to a new parser that will be applied at the same starting position than the failing parser.
Handle certain errors, potentially recovering from it, by mapping them to a new parser that will be applied at the same starting position than the failing parser.
- See also:
handleErrorWith to handle any/all errors.
- Inherited from:
- Parser
Returns a parser that repeatedly applies this parser with the specified separator string between those invocations.
Returns a parser that repeatedly applies this parser with the specified separator string between those invocations.
p.rep(sep).min(1)
is equivalent to (p ~ (sep ~> p).rep).concat
.
The returned parser offers an API to specify further constraints
like min
or max
.
- Inherited from:
- Parser
Returns a parser that repeatedly applies this parser with the specified separator parser between those invocations.
Returns a parser that repeatedly applies this parser with the specified separator parser between those invocations.
p.rep(sep).min(1)
is equivalent to (p ~ (sep ~> p).rep).concat
.
The returned parser offers an API to specify further constraints
like min
or max
.
- Inherited from:
- 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 repeatedly applies this parser.
The returned parser offers an API to specify further constraints
like min
or max
.
- Inherited from:
- Parser
Returns a parser that repeatedly applies this parser until either this parser fails or the specified end condition is met. The end condition will be applied after each successful invocation of this parser.
Returns a parser that repeatedly applies this parser until either this parser fails or the specified end condition is met. The end condition will be applied after each successful invocation of this parser.
The result of the returned parser is a tuple consisting of the list containing the
result of the invocations of this parser plus the result of the end condition.
The latter is returned as an Option
as it might be empty when the parsing finished because of this parser failing.
Note that it is more convenient to include the end condition in the repeating parser itself and use
the simpler rep
method.
This combinator is an alternative if you need to know the result of the end condition.
- Inherited from:
- Parser
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.
- Inherited from:
- Parser
Changes the failure message produced by a parser.
Changes the failure message produced by a parser.
- Inherited from:
- 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.
This is a specialized variant of the |
method of the
base trait that preserves the nature of the PrefixedParser
if both original parsers implement this trait.
- Inherited from:
- PrefixedParser
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.
- Inherited from:
- Parser