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
constreader = newBufferReader(Buffer.from('(apple OR orange) AND (drink OR juice)')) constlexer = newLexer(reader) constparser = newParser(lexer) consttokens = parser.parse()
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