Interfaces, implementations, and helper functions for parsing structured text (such as code).
Packages:
Contains interfaces and sub-packages with interfaces that define input stream based parsers, parser factories, and copyable parsers.
Interfaces for reading matching characters.
Interfaces and implementations for text fragments (i.e. a sub-string with a begin and end row, column, and absolute offset within a larger source string), interfaces for text sub-string consumption and transformation.
TextParser
interface and implementations TextCharsParser
and TextIteratorParser
. Text parser can be created from char array, string(s) or PeekableIterator
Static utility functions to complement textParser package, some functions parse directly from line buffers, others parse strings.
For example, ReadRepeats
contains methods to read a repeating character(s) or range of characters from a source. Utilities include ReadIsMatching
(to peek ahead in a text parser without consuming input), ReadMatching
, ReadNumber
, ReadUnescape
, and ReadWhitespace
Split Strings into lines via Supplier<String>
and Supplier<char[]>
implementations. Equivalent to new BufferedReader(new StringReader(str)).lines();
Check the unit tests twg2.parser.test
package for some examples of the API usage.