Uses of Class
com.google.common.labs.parse.Parser
Packages that use Parser
Package
Description
A strict, i18n-compliant email address parser (requires dot-parse artifact)
Parser combinator that's free from infinite loop or accidental left recursion (requires dot-parse artifact)
-
Uses of Parser in com.google.common.labs.email
Fields in com.google.common.labs.email declared as ParserModifier and TypeFieldDescriptionstatic final Parser<EmailAddress> EmailAddress.PARSERThe parser for email address, according to RFC 5322, and supporting BMP characters. -
Uses of Parser in com.google.common.labs.parse
Subclasses of Parser in com.google.common.labs.parseModifier and TypeClassDescriptionstatic final classParser.Rule<T>A forward-declared production rule, to be used for recursive grammars.Methods in com.google.common.labs.parse that return ParserModifier and TypeMethodDescriptionstatic <T> Parser<T> Matches if any of the givenparsersmatch.Parser.anyOf(T... values) Returns a parser that matches any of the given enumvaluesby theirEnum.toString().Parser.atLeastOnce()Returns a parser that applies this parser at least once, greedily.Parser.atLeastOnce(BinaryOperator<T> reducer) Returns a parser that applies this parser at least once, greedily, and reduces the results using thereducerfunction.final <A,R> Parser <R> Parser.atLeastOnce(Collector<? super T, A, ? extends R> collector) Returns a parser that applies this parser at least once, greedily, and collects the return values usingcollector.final <A,R> Parser <R> Parser.atLeastOnceDelimitedBy(Parser<?> delimiter, Collector<? super T, A, ? extends R> collector) Returns a parser that matchesthispattern at least once, delimited by the given delimiter.Parser.atLeastOnceDelimitedBy(String delimiter) Returns a parser that matchesthispattern at least once, delimited by the given delimiter.Parser.atLeastOnceDelimitedBy(String delimiter, BinaryOperator<T> reducer) Returns a parser that matchesthispattern at least once, delimited by the given delimiter, using the givenreducerfunction to reduce the results.final <A,R> Parser <R> Parser.atLeastOnceDelimitedBy(String delimiter, Collector<? super T, A, ? extends R> collector) Returns a parser that matchesthispattern at least once, delimited by the given delimiter.Returns a parser that matchesthispattern enclosed betweenprefixandsuffix, both allowed to be empty.The current production must be enclosed betweenprefixthat may be empty andsuffixthat may not be empty.The current production must be enclosed between non-emptyprefixandsuffix.The current production must be enclosed between non-emptyprefixandsuffixthat may be empty.The current production must be enclosed between non-emptyprefixandsuffix.Parser.bmpCodeUnit()Parses a 4-digit hex BMP code unit.Builds a parser with the configured operators applied to the given operand.static Parser<?> Parser.caseInsensitive(String string) Matches a literalstringcase insensitively.static Parser<?> Parser.caseInsensitiveWord(String word) caseInsensitiveWord("or")matches "Or" and "OR", but not "orange".Parser.chars(int n) Consumes exactlynconsecutive characters.Parser.consecutive(CharacterSet characterSet) Matches one or more consecutive characters contained incharacterSet.Parser.consecutive(CharPredicate matcher, String name) Matches one or more consecutive characters as specified bymatcher.static <T> Parser<T> Defines a simple recursive grammar without needing to explicitly forward-declare aParser.Rule.Define this rule asparserand returns it.Parser.digits()One or more regex\d+characters.Returns a parser that finds the first literalstringthat may start from the current position or after any number of characters.final <R> Parser<R> Parser.flatMap(Function<? super T, ? extends Production<? extends R>> f) If this parser matches, applies functionfto get the next production rule to match in sequence.Parser.followedBy(Parser<?> suffix) Parser.followedBy(Parser<S>.OrEmpty suffix) Parser.OrEmpty.followedBy(Parser<?> suffix) Production.followedBy(Parser<?> suffix) The current production must be followed by non-emptysuffix.Production.followedBy(String suffix) The current production must be followed by non-emptysuffix.Parser.followedByOrEof(Parser<?> suffix) Specifies that the matched pattern must be either followed bysuffixor EOF.Production.immediatelyBetween(String prefix, String suffix) The current production must be immediately enclosed between non-emptyprefixandsuffix(no skippable characters as specified byparseSkipping()in between).static <T> Parser<T> Returns an equivalent parser that suppresses character skipping that's otherwise applied ifparseSkipping()orskipping()are called.final <R> Parser<R> If this parser matches, returns the result of applying the given function to the match.Parser.OrEmpty.notEmpty()Returns the otherwise equivalentParserthat will fail instead of returning the default value if empty.Parser.notFollowedBy(Parser<?> suffix, String name) A form of negative lookahead such that the match is rejected if followed bysuffix.Parser.notFollowedBy(String suffix) A form of negative lookahead such that the match is rejected if followed bysuffix.Parser.notImmediatelyFollowedBy(CharPredicate predicate, String name) A form of negative lookahead such that the match is rejected if immediately followed by (no skippable characters as specified byparseSkipping()in between) a character that matchespredicate.Parser.one(char c) Matches the given characterc.Parser.one(CharacterSet characterSet) Matches a character incharacterSet.Parser.one(CharPredicate matcher, String name) Matches a character as specified bymatcher.Parser.optionallyFollowedBy(Parser<S> suffix, BiFunction<? super T, ? super S, ? extends T> op) If this parser matches, optionally matchessuffixwith theopBiFunction to transform the current parser's result.Parser.optionallyFollowedBy(String suffix) Parser.optionallyFollowedBy(String suffix, Function<? super T, ? extends T> op) Matches ifthisorthatmatches.Parser.quotedBy(char before, char after) Matches the characters quoted bybeforeandafter, and returns the string in between.Matches the characters quoted bybeforeandafter, and returns the string in between.Parser.quotedByWithEscapes(char before, char after, Parser<? extends CharSequence> escaped) String literal quoted bybeforeandafterwith backslash escapes.Parser.quotedByWithEscapes(String before, char after, Parser<? extends CharSequence> escaped) String literal quoted bybeforeandafterwith backslash escapes.static <A,B, R> Parser <R> Parser.sequence(Parser<A>.OrEmpty left, Parser<B> right, BiFunction<? super A, ? super B, ? extends R> combiner) Sequentially matchesleft(which is allowed to be optional), thenright, and then combines the results using thecombinerfunction.static <A,B, R> Parser <R> Parser.sequence(Parser<A> left, Parser<B> right, BiFunction<? super A, ? super B, ? extends R> combiner) Sequentially matchesleftthenright, and then combines the results using thecombinerfunction.static <A,B, C, D, R>
Parser<R> Parser.sequence(Parser<A> a, Production<B> b, Production<C> c, Production<D> d, Function4<? super A, ? super B, ? super C, ? super D, ? extends R> combiner) Sequentially matchesa,b,candd, and then combines the results using thecombinerfunction.static <A,B, C, R> Parser <R> Parser.sequence(Parser<A> a, Production<B> b, Production<C> c, TriFunction<? super A, ? super B, ? super C, ? extends R> combiner) Sequentially matchesa,bandc, and then combines the results using thecombinerfunction.static <A,B, R> Parser <R> Parser.sequence(Parser<A> left, Production<B> right, BiFunction<? super A, ? super B, ? extends R> combiner) Sequentially matchesleftthenright, and then combines the results using thecombinerfunction.Parser.source()Returns a parser that matchesthispattern and returns the matched string.Matches a literalstring.If this parser matches, applies the givenconditionand disqualifies the match if the condition is false.<S> Parser<S> final <R> Parser<R> If this parser matches, applies the given optional (or zero-or-more) parser on the remaining input.final <S> Parser<S> <S> Parser<S> After matching the current production, proceed to matchsuffix.final <R> Parser<R> Parser.thenReturn(R result) If this parser matches, returns the given result.Parser.withPostfixes(Parser<? extends UnaryOperator<T>> operator) Returns a parser that after this parser succeeds, applies theoperatorparser zero or more times and applies the result unary operator function iteratively.Parser.withPostfixes(Parser<S> operator, BiFunction<? super T, ? super S, ? extends T> postfixFunction) Returns a parser that after this parser succeeds, applies theoperatorparser zero or more times and applies the result unary operator function iteratively.Parser.withPostfixes(String operator, UnaryOperator<T> postfixFunction) Returns a parser that after this parser succeeds, applies theoperatorparser zero or more times and applies the result unary operator function iteratively.Parser.withPrefixes(Parser<? extends UnaryOperator<T>> operator) Returns a parser that applies theoperatorparser zero or more times beforethisand applies the result unary operator functions iteratively.Parser.word()One or more regex\w+characters.word("or")matches "or" but not "orange".Methods in com.google.common.labs.parse that return types with arguments of type ParserModifier and TypeMethodDescriptionParser.or()Returns a collector that results in a parser that matches if any of the inputparsersmatch.Parser.or()Returns a collector that results in a parser that matches if any of the inputparsersmatch.Methods in com.google.common.labs.parse with parameters of type ParserModifier and TypeMethodDescriptionstatic <T> Parser<T> Matches if any of the givenparsersmatch.final <A,R> Parser <R> Parser.atLeastOnceDelimitedBy(Parser<?> delimiter, Collector<? super T, A, ? extends R> collector) Returns a parser that matchesthispattern at least once, delimited by the given delimiter.The current production must be enclosed betweenprefixthat may be empty andsuffixthat may not be empty.The current production must be enclosed between non-emptyprefixandsuffix.The current production must be enclosed between non-emptyprefixandsuffixthat may be empty.Builds a parser with the configured operators applied to the given operand.Define this rule asparserand returns it.Parser.followedBy(Parser<?> suffix) Parser.OrEmpty.followedBy(Parser<?> suffix) Production.followedBy(Parser<?> suffix) The current production must be followed by non-emptysuffix.Parser.followedByOrEof(Parser<?> suffix) Specifies that the matched pattern must be either followed bysuffixor EOF.OperatorTable.leftAssociative(Parser<? extends BinaryOperator<T>> operator, int precedence) Adds a left-associative infix operator with the given precedence to the table.static <T> Parser<T> Returns an equivalent parser that suppresses character skipping that's otherwise applied ifparseSkipping()orskipping()are called.OperatorTable.nonAssociative(Parser<? extends BinaryOperator<T>> operator, int precedence) Adds a non-associative infix operator (e.g.Parser.notFollowedBy(Parser<?> suffix, String name) A form of negative lookahead such that the match is rejected if followed bysuffix.Parser.optionallyFollowedBy(Parser<S> suffix, BiFunction<? super T, ? super S, ? extends T> op) If this parser matches, optionally matchessuffixwith theopBiFunction to transform the current parser's result.Parser.OrEmpty.optionallyFollowedBy(Parser<S> suffix, BiFunction<? super T, ? super S, ? extends T> op) If this parser matches, optionally matchessuffixwith theopBiFunction to transform the current parser's result.<S> Production<T> Production.optionallyFollowedBy(Parser<S> suffix, BiFunction<? super T, ? super S, ? extends T> op) If this production rule matches, optionally matchessuffixwith theopBiFunction to transform the current production's result.Matches ifthisorthatmatches.Parser.OrEmpty.parseSkipping(Parser<?> skip, String input) Parses the entire input string, ignoring patterns matched byskip, and returns the result; if there's nothing to parse except skippable content, returns the default empty value.final TParser.parseSkipping(Parser<?> skip, String input) Parsesinputwhile skipping patterns matched byskiparound atomic matches.Production.parseSkipping(Parser<?> skip, String input) Parses the entire input string, ignoring patterns matched byskip, and returns the result.OperatorTable.postfix(Parser<? extends UnaryOperator<T>> operator, int precedence) Adds a postfix operator with the given precedence to the table.<S> OperatorTable<T> OperatorTable.postfix(Parser<S> operator, BiFunction<? super T, ? super S, ? extends T> postfixFunction, int precedence) Adds a postfix operator with the given precedence to the table.OperatorTable.prefix(Parser<? extends UnaryOperator<T>> operator, int precedence) Adds a prefix operator with the given precedence to the table.Parser.quotedByWithEscapes(char before, char after, Parser<? extends CharSequence> escaped) String literal quoted bybeforeandafterwith backslash escapes.Parser.quotedByWithEscapes(String before, char after, Parser<? extends CharSequence> escaped) String literal quoted bybeforeandafterwith backslash escapes.OperatorTable.rightAssociative(Parser<? extends BinaryOperator<T>> operator, int precedence) Adds a right-associative infix operator with the given precedence to the table.static <A,B, R> Parser <R> Parser.sequence(Parser<A>.OrEmpty left, Parser<B> right, BiFunction<? super A, ? super B, ? extends R> combiner) Sequentially matchesleft(which is allowed to be optional), thenright, and then combines the results using thecombinerfunction.static <A,B, R> Parser <R> Parser.sequence(Parser<A> left, Parser<B> right, BiFunction<? super A, ? super B, ? extends R> combiner) Sequentially matchesleftthenright, and then combines the results using thecombinerfunction.static <A,B, C, D, R>
Parser<R> Parser.sequence(Parser<A> a, Production<B> b, Production<C> c, Production<D> d, Function4<? super A, ? super B, ? super C, ? super D, ? extends R> combiner) Sequentially matchesa,b,candd, and then combines the results using thecombinerfunction.static <A,B, C, R> Parser <R> Parser.sequence(Parser<A> a, Production<B> b, Production<C> c, TriFunction<? super A, ? super B, ? super C, ? extends R> combiner) Sequentially matchesa,bandc, and then combines the results using thecombinerfunction.static <A,B, R> Parser <R> Parser.sequence(Parser<A> left, Production<B> right, BiFunction<? super A, ? super B, ? extends R> combiner) Sequentially matchesleftthenright, and then combines the results using thecombinerfunction.Starts a fluent chain for parsing inputs while skipping patterns matched byskip.<S> Parser<S> final <S> Parser<S> <S> Parser<S> After matching the current production, proceed to matchsuffix.Parser.withPostfixes(Parser<? extends UnaryOperator<T>> operator) Returns a parser that after this parser succeeds, applies theoperatorparser zero or more times and applies the result unary operator function iteratively.Parser.withPostfixes(Parser<S> operator, BiFunction<? super T, ? super S, ? extends T> postfixFunction) Returns a parser that after this parser succeeds, applies theoperatorparser zero or more times and applies the result unary operator function iteratively.Parser.withPrefixes(Parser<? extends UnaryOperator<T>> operator) Returns a parser that applies theoperatorparser zero or more times beforethisand applies the result unary operator functions iteratively.Parser.zeroOrMoreDelimited(Parser<A> first, Production<B> second, String delimiter, BiCollector<? super A, ? super B, R> collector) Appliesfirstand the optionalsecondpattern in order, for zero or more times, collecting the results using the providedBiCollector.Parser.zeroOrMoreDelimitedBy(Parser<?> delimiter, Collector<? super T, A, ? extends R> collector) Starts a fluent chain for matching the current parser zero or more times, delimited bydelimiter.Method parameters in com.google.common.labs.parse with type arguments of type ParserModifier and TypeMethodDescriptionstatic <T> Parser<T> Defines a simple recursive grammar without needing to explicitly forward-declare aParser.Rule.static <T> Parser<T> Defines a simple recursive grammar without needing to explicitly forward-declare aParser.Rule.