This reader is used to read from a string. This is usually worse for performance than reading
from a buffer, as buffer indexes are loaded lazily, but for most cases it is good enough.
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 string reader, you can do so by using the StringReader class.
Example
constreader = newStringReader('(apple OR orange) AND (drink OR juice)') constlexer = newLexer(reader) constparser = newParser(lexer) consttokens = parser.parse()
This reader is used to read from a string. This is usually worse for performance than reading from a buffer, as buffer indexes are loaded lazily, but for most cases it is good enough.
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 string reader, you can do so by using the
StringReader
class.Example