/** * # Parser Input * * Parsers input is a stream of data of type `S`. The input is represented by * an abstract interface which provides the `next()` method to iterate through * the stream. */ export interface ParserInput { /** * Position in the input stream is represented by a number. The number has * to increase as input is consumed, but not necessarily linearly. * Backtracking is done by setting the `position` explicitly. */ position: number; /** * Return the next item in the stream. Note that there is no explicit * flag that tells when we have gone past the last item. Instead, the input * implementations add a special `EOF` item at the end. Parsers should * recognize it and terminate before the stream is exhausted. */ next(): S; /** * The latest item read from the stream is cached for efficiency. */ readonly current: S; /** * User-managed state can be carried along the parsing. State is needed * especially with context-sensitive grammars. The input stores a reference * to `any` data that can be modified by special combinators: `getState`, * `setState`, `mutateState`, etc. */ state: any; } /** * ## Exported Functions * * Create a ParserInput wrapper for an array. */ export declare function arrayInput(array: S[], eof: S): ParserInput;