StringParser
Configurable base parser for string literals.
Value members
Concrete methods
Embeds the specified parsers for child spans inside a character literal.
Embeds the specified parsers for child spans inside a character literal.
This is usually used for allowing escape sequences or substitution expressions inside the literal.
Applies the specified category to the result.
Applies the specified category to the result.
Useful where the logic of the string literal parser needs to be used with a span that should not be classified as a string literal.
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
Merges the parsers of this collection with those of the specified other collection. The order of parsers is relevant, since they will be applied in the specified order. If any parser successfully produces a result, the subsequent parsers will not be invoked
Merges the parsers of this collection with those of the specified other collection. The order of parsers is relevant, since they will be applied in the specified order. If any parser successfully produces a result, the subsequent parsers will not be invoked
- Inherited from:
- CodeSpanParser
Returns a parser that optionally parses what this parser parses.
Returns a parser that optionally parses what this parser parses.
- Inherited from:
- Parser
- Definition Classes
- Inherited from:
- PrefixedParser
Returns a parser that produces the number of characters consumed by this parser while discarding the original result.
Returns a parser that produces the number of characters consumed by this parser while discarding the original result.
- 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
Discards the result of a successful parser.
Discards the result of a successful parser.
- 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