Class BufferReader

This reader is used to read from a buffer instead of a string, which is useful for reading from files, or for better performance as buffer indexes are loaded lazily.

In most cases, you would want to use the regular parse function, which uses a dynamic reader from the input.

If you still want to create a buffer reader, you can do so by using the BufferReader class.

Example

const reader = new BufferReader(Buffer.from('(apple OR orange) AND (drink OR juice)'))
const lexer = new Lexer(reader)
const parser = new Parser(lexer)
const tokens = parser.parse()

Hierarchy

  • BufferReader

Implements

Constructors

Properties

Methods

Constructors

Properties

index: number

The current index of the input stream

Methods

  • Peek at the next character in the input stream

    Parameters

    • n: number = 0

    Returns string

  • Consume the next character in the input stream

    Parameters

    • n: number = 0

    Returns string

  • Check if the input stream is at the end of the file

    Returns boolean

Generated using TypeDoc