dyaml.reader

Types 2

aliasisBreak = among!('\n', '\u0085', '\u2028', '\u2029')
structReader

Provides an API to read characters from a UTF-8 buffer.

Fields
private char[] buffer_
private size_t bufferOffset_
private size_t charIndex_
private size_t characterCount_
private string name_
private uint line_
private uint column_
private Encoding encoding_
private size_t upcomingASCII_
private size_t lastDecodedBufferOffset_
private size_t lastDecodedCharOffset_
Methods
dchar peek(const size_t index) @safe pureGet character at specified index relative to current position.
dchar peek() @safe pureOptimized version of peek() for the case where peek index is 0.
char peekByte(const size_t index) @safe pure nothrow @nogcGet byte at specified index relative to current position.
char peekByte() @safe pure nothrow @nogcOptimized version of peekByte() for the case where peek byte index is 0.
char[] prefix(const size_t length) @safe pureGet specified number of characters starting at current position.
char[] prefixBytes(const size_t length) @safe pure nothrow @nogcGet specified number of bytes, not code points, starting at current position.
char[] slice(const size_t end) @safe pureGet a slice view of the internal buffer, starting at the current position.
dchar get() @safe pureGet the next character, moving buffer position beyond it.
char[] get(const size_t length) @safe pureGet specified number of characters, moving buffer position beyond them.
void forward(size_t length) @safe pureMove current position forward.
void forward() @safe pureMove current position forward by one character.
Mark mark() const pure nothrow @nogc @safeGet filename, line and column of current position.
Mark mark(size_t advance) const pure @safeGet filename, line and column of current position + some number of chars
inout(string) name() ref inout @safe return pure nothrow @nogcGet file name.
uint line() const @safe pure nothrow @nogcGet current line number.
uint column() const @safe pure nothrow @nogcGet current column number.
size_t charIndex() const @safe pure nothrow @nogcGet index of the current character in the buffer.
Encoding encoding() const @safe pure nothrow @nogcGet encoding of the input buffer.
private void checkASCII() @safe pure nothrow @nogc
private dchar decodeNext() @safe pure
Constructors
this(ubyte[] buffer, string name = "<unknown>")Construct a Reader.

Functions 7

private fnauto toUTF8(ubyte[] input, const UTFEncoding encoding) @safe pure nothrow
private fnbool isPrintableValidUTF8(const char[] chars) @safe pureDetermine if all characters (code points, not bytes) in a string are printable.
private fnsize_t countASCII(const(char)[] buffer) @safe pure nothrow @nogcCounts the number of ASCII characters in buffer until the first UTF-8 sequence.
private fnvoid testEndian(R)()
private fnvoid testPeekPrefixForward(R)()
private fnvoid testUTF(R)()
private fnvoid test1Byte(R)()