Construct this with a buffer, initial offset into the buffer and an end offset.
Input datasource.
Optional
initialOffset: numberThe initial offset in the buffer to start parsing from (will default to 0)
Optional
endOffset: numberThe (exclusive) offset to stop parsing/treat as the end of the buffer (will default to the buffer's length)
Get the current cursor address of the stream, relative the initial offset.
The cursor relative the initial offset, instead of absolute the start of the buffer.
Get the current position in the buffer this parser is at.
The cursor position in bytes.
Has this parsing buffer hit or parsed its end mark?
True if the parsing buffer has passed its end mark.
Get the current linecount for this parser.
The line count.
Has this parsing buffer hit or parsed its end mark?
True if the parsing buffer is not passed its end mark.
Try and match a single matching function, with rewind semantics. (i.e. return to the initial cursor on failure).
The matching function to run.
True if a match is found. False otherwise.
Reinitialize this with a new buffer, initial offset and end offset.
The buffer to initialize this with.
The initial offset in bytes to start the cursor at in the buffer.
The end offset of the buffer in bytes, relative to the start of the buffer.
Try and run a sequence of parsing operations, with rewind semantics (i.e. return to the initial cursor on failure).
The sequence to run.
True if all operations in the sequence return true in order. False otherwise.
Try and run a sequence of parsing operations, with rewind semantics (i.e. return to the initial cursor on failure).
Also eats whitespace before each match.
The sequence to run.
True if all operations in the sequence return true in order. False otherwise.
A parsing buffer class, note for convenience and brevity, a lot of the functions here are pre-bound using public fields, this means they can be used like C# style delegates, which is handy for constructive parsing, as well as providing easy access to nested parsing/parsing combinator style constructs.