Class Parser.Lexical
java.lang.Object
com.google.common.labs.parse.Parser.Lexical
Fluent API for parsing while skipping patterns around lexical tokens.
For example:
Parser<JsonRecord> jsonRecord = ...;
jsonRecord.zeroOrMoreDelimitedBy(",")
.between("[", "]")
.skipping(whitespace())
.parseToStream(jsonInput)
...;
-
Method Summary
Modifier and TypeMethodDescriptionParsesinputwhile skipping the skippable patterns around lexical tokens.Parsesinputstarting fromfromIndexwhile skipping patterns around lexical tokens.parseToStream(Reader input) Parsesinputreader to a lazy stream while skipping the skippable patterns around lexical tokens.parseToStream(String input) Parsesinputto a lazy stream while skipping the skippable patterns around lexical tokens.parseToStream(String input, int fromIndex) Parsesinputstarting fromfromIndexto a lazy stream while skipping the skippable patterns around lexical tokens.Lazily and iteratively matchesinputreader, skipping the skippable patterns, until the input is exhausted or matching failed.Lazily and iteratively matchesinput, skipping the skippable patterns, until the input is exhausted or matching failed.Lazily and iteratively matchesinputstarting fromfromIndex, skipping the skippable patterns, until the input is exhausted or matching failed.
-
Method Details
-
parse
-
parse
-
parseToStream
-
parseToStream
-
parseToStream
Parsesinputreader to a lazy stream while skipping the skippable patterns around lexical tokens.UncheckedIOExceptionwill be thrown if the underlying reader throws.Characters are internally buffered, so you don't need to pass in
BufferedReader. -
probe
Lazily and iteratively matchesinput, skipping the skippable patterns, until the input is exhausted or matching failed.Note that unlike
parseToStream(), a matching failure terminates the stream without throwing exception.This allows quick probing without fully parsing it.
-
probe
Lazily and iteratively matchesinputstarting fromfromIndex, skipping the skippable patterns, until the input is exhausted or matching failed. Note that unlikeparseToStream(), a matching failure terminates the stream without throwing exception.This allows quick probing without fully parsing it.
-
probe
Lazily and iteratively matchesinputreader, skipping the skippable patterns, until the input is exhausted or matching failed.Note that unlike
parseToStream(), a matching failure terminates the stream without throwing exception.This allows quick probing without fully parsing it.
UncheckedIOExceptionwill be thrown if the underlying reader throws.Characters are internally buffered, so you don't need to pass in
BufferedReader.
-