diff --git a/source/dyaml/reader.d b/source/dyaml/reader.d index 83a8d62..4073635 100644 --- a/source/dyaml/reader.d +++ b/source/dyaml/reader.d @@ -121,6 +121,8 @@ final class Reader while(!noZeros.empty && noZeros.back == '\0') { noZeros.popBack(); } enforce(printable(noZeros[]), new ReaderException("Special unicode characters are not allowed")); + + this.sliceBuilder = SliceBuilder(this); } /// Get character at specified index relative to current position. @@ -226,6 +228,9 @@ final class Reader } } + /// Used to build slices of read data in Reader; to avoid allocations. + SliceBuilder sliceBuilder; + /// Get a string describing current buffer position, used for error messages. final Mark mark() @safe pure nothrow const @nogc { return Mark(line_, column_); }