public class ChoiceParser<U,T> extends ParserProxy<U,T>
MATCHING_ALL
Constructor and Description |
---|
ChoiceParser(java.util.function.Supplier<Parser<U>> component,
java.util.function.Function<? super U,? extends T> transform,
Parser<? extends T> onFailure) |
ChoiceParser(java.util.function.Supplier<Parser<U>> component,
Parser<? extends U> onFailure,
java.util.function.Function<? super U,? extends T> transform) |
Modifier and Type | Method and Description |
---|---|
ParseResult<T> |
parseSubstringImpl(ParseState state) |
<V> Parser<V> |
transform(java.util.function.Function<? super T,? extends V> transform)
Derive a new
Parser instance from the receiving instance. |
getComponent, getTransform, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
appendTransform, appendTransform, orElse, orElse, parse, parseSubstring, prependTransform, prependTransform, tryAppendTransform, tryPrependTransform
public ChoiceParser(java.util.function.Supplier<Parser<U>> component, Parser<? extends U> onFailure, java.util.function.Function<? super U,? extends T> transform)
public ParseResult<T> parseSubstringImpl(ParseState state)
parseSubstringImpl
in interface AbstractParser<T>
parseSubstringImpl
in class ParserProxy<U,T>
public <V> Parser<V> transform(java.util.function.Function<? super T,? extends V> transform)
Parser
Parser
instance from the receiving instance.
The new parser will match the same text as the given parser, but the object
parsed will be transformed by the given Function
.
transform
in interface AbstractParser<T>
transform
in interface Parser<T>
transform
in class ParserProxy<U,T>
V
- the type of the object of the new parser, post-transformationtransform
- the transformation to apply to the object given by application of
this parserParser
instance which applies the given
transformation