Package de.scravy.bedrock
Interface CharParser<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface CharParser<T>
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCharParser.Result<E> -
Method Summary
Modifier and Type Method Description static CharParser<Character>anyOf(String string)static <S, T, U> CharParser<T>between(CharParser<S> s, CharParser<T> t, CharParser<U> u)static CharParser<Character>character(char character)static <S, T extends S, U extends S>
CharParser<S>choice(CharParser<T> leftParser, CharParser<U> rightParser)static <T, U> CharParser<Either<T,U>>either(CharParser<T> leftParser, CharParser<U> rightParser)static <T, U> CharParser<T>left(CharParser<T> leftParser, CharParser<U> rightParser)Creates a parser that parses leftParser and then rightParser but returns the result of leftParser (the left one).static <T> CharParser<Seq<T>>many(CharParser<T> parser)static <T> CharParser<Seq<T>>many1(CharParser<T> parser)default <U> CharParser<U>map(Function<T,U> function)static CharParser<Character>noneOf(String string)static <T> CharParser<T>oneOf(CharParser<? extends T>... parsers)static <T> CharParser<T>option(T fallback, CharParser<T> parser)static <T> CharParser<Optional<T>>optional(CharParser<T> parser)static <T> CharParser<T>optionOrGet(Supplier<T> fallbackSupplier, CharParser<T> parser)CharParser.Result<T>parse(Seq<Character> seq)default CharParser.Result<T>parse(String string)static CharParser<Character>range(char lower, char upper)static <T> CharParser<T>recursive(Supplier<CharParser<T>> supplier)Creates a parser that is constructed at first invocation for recursive invocation of the parser.static <T, U> CharParser<U>right(CharParser<T> leftParser, CharParser<U> rightParser)Creates a parser that parses leftParser and then rightParser but returns the result of rightParser (the right one).static CharParser<Character>satisfies(Predicate<Character> predicate)static <U> CharParser<U>satisfies2(Function<Character,Optional<U>> function)static <T, U> CharParser<Seq<T>>sepBy(CharParser<T> parser, CharParser<U> sep)static <T, U> CharParser<Seq<T>>sepBy1(CharParser<T> parser, CharParser<U> sep)static <T, U> CharParser<Pair<T,U>>seq(CharParser<T> p1, CharParser<U> p2)static <T, U, V> CharParser<Triple<T,U,V>>seq(CharParser<T> p1, CharParser<U> p2, CharParser<V> p3)static <T, U, V, W> CharParser<Quadruple<T,U,V,W>>seq(CharParser<T> p1, CharParser<U> p2, CharParser<V> p3, CharParser<W> p4)static <T> CharParser<Seq<T>>sequence(CharParser<T>... parsers)static <T> CharParser<Seq<T>>sequence(Iterable<CharParser<T>> parsers)static <T> CharParser<Void>skipMany(CharParser<T> parser)static CharParser<String>string(String string)static <T> CharParser<Seq<T>>times(int n, CharParser<T> parser)
-
Method Details
-
parse
-
parse
-
map
-
left
@Nonnull static <T, U> CharParser<T> left(@Nonnull CharParser<T> leftParser, @Nonnull CharParser<U> rightParser)Creates a parser that parses leftParser and then rightParser but returns the result of leftParser (the left one).- Type Parameters:
T- The type parsed by the left parser.U- The type parsed by the right parser.- Parameters:
leftParser- The left parser.rightParser- The right parser.- Returns:
- A parser that parses leftParser and then rightParser but returns the result of leftParser (the left one).
-
right
@Nonnull static <T, U> CharParser<U> right(@Nonnull CharParser<T> leftParser, @Nonnull CharParser<U> rightParser)Creates a parser that parses leftParser and then rightParser but returns the result of rightParser (the right one).- Type Parameters:
T- The type parsed by the left parser.U- The type parsed by the right parser.- Parameters:
leftParser- The left parser.rightParser- The right parser.- Returns:
- A parser that parses leftParser and then rightParser but returns the result of rightParser (the right one).
-
choice
@Nonnull static <S, T extends S, U extends S> CharParser<S> choice(@Nonnull CharParser<T> leftParser, @Nonnull CharParser<U> rightParser) -
either
@Nonnull static <T, U> CharParser<Either<T,U>> either(@Nonnull CharParser<T> leftParser, @Nonnull CharParser<U> rightParser) -
oneOf
-
anyOf
-
noneOf
-
character
-
range
-
string
-
satisfies
-
satisfies2
-
optional
-
option
-
optionOrGet
@Nonnull static <T> CharParser<T> optionOrGet(@Nonnull Supplier<T> fallbackSupplier, @Nonnull CharParser<T> parser) -
sequence
-
sequence
-
times
-
seq
@Nonnull static <T, U> CharParser<Pair<T,U>> seq(@Nonnull CharParser<T> p1, @Nonnull CharParser<U> p2) -
seq
@Nonnull static <T, U, V> CharParser<Triple<T,U,V>> seq(@Nonnull CharParser<T> p1, @Nonnull CharParser<U> p2, @Nonnull CharParser<V> p3) -
seq
@Nonnull static <T, U, V, W> CharParser<Quadruple<T,U,V,W>> seq(@Nonnull CharParser<T> p1, @Nonnull CharParser<U> p2, @Nonnull CharParser<V> p3, @Nonnull CharParser<W> p4) -
many
-
many1
-
skipMany
-
sepBy
@Nonnull static <T, U> CharParser<Seq<T>> sepBy(@Nonnull CharParser<T> parser, @Nonnull CharParser<U> sep) -
sepBy1
@Nonnull static <T, U> CharParser<Seq<T>> sepBy1(@Nonnull CharParser<T> parser, @Nonnull CharParser<U> sep) -
between
@Nonnull static <S, T, U> CharParser<T> between(@Nonnull CharParser<S> s, @Nonnull CharParser<T> t, @Nonnull CharParser<U> u) -
recursive
Creates a parser that is constructed at first invocation for recursive invocation of the parser.
-