Struct BufferedLexer

A lexer that takes an InputRange of slices from the input.

This lexer tries to merge the speed of direct slicing with the low memory requirements of ranges. Its input is a range whose elements are chunks of the input data; this lexer returns slices of the original chunks, unless the output is split between two chunks. If that's the case, a new array is allocated and returned. The various chunks may have different sizes.

The bigger the chunks are, the better is the performance and higher the memory usage, so finding the correct tradeoff is crucial for maximum performance. This lexer is suitable for very large files, which are read chunk by chunk from the file system.

Template arguments

struct BufferedLexer(T, ErrorHandler, Alloc, std.typecons.Flag!("reuseBuffer").Flag reuseBuffer)
if (isInputRange!T && isArray!(ElementType!T));

Methods

Name Description
advanceUntil See detailed documentation in std.experimental.xml.interfaces.isLexer
advanceUntilAny See detailed documentation in std.experimental.xml.interfaces.isLexer
dropWhile See detailed documentation in std.experimental.xml.interfaces.isLexer
empty See detailed documentation in std.experimental.xml.interfaces.isLexer
get See detailed documentation in std.experimental.xml.interfaces.isLexer
setSource See detailed documentation in std.experimental.xml.interfaces.isLexer
start See detailed documentation in std.experimental.xml.interfaces.isLexer
testAndAdvance See detailed documentation in std.experimental.xml.interfaces.isLexer

Aliases

Name Description
CharacterType See detailed documentation in std.experimental.xml.interfaces.isLexer
InputType See detailed documentation in std.experimental.xml.interfaces.isLexer

Parameters

NameDescription
T the InputRange to be used as input for this lexer
ErrorHandler a delegate type, used to report the impossibility to complete operations like advanceUntil or advanceUntilAny
Alloc the allocator used to manage internal buffers
reuseBuffer if set to Yes (the default) this parser will always reuse the same buffers, invalidating all previously returned slices

Authors

Lodovico Giaretta

Copyright

Copyright Lodovico Giaretta 2016 --

License

Boost License 1.0.