Reader

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

Constructors

this
this(ubyte[] buffer, string name)

Construct a Reader.

Members

Functions

charIndex
size_t charIndex()

Get index of the current character in the buffer.

column
uint column()

Get current column number.

encoding
Encoding encoding()

Get encoding of the input buffer.

forward
void forward(size_t length)

Move current position forward.

forward
void forward()

Move current position forward by one character.

get
dchar get()

Get the next character, moving buffer position beyond it.

get
char[] get(size_t length)

Get specified number of characters, moving buffer position beyond them.

line
uint line()

Get current line number.

mark
Mark mark()

Get filename, line and column of current position.

mark
Mark mark(size_t advance)

Get filename, line and column of current position + some number of chars

name
inout(string) name()

Get file name.

peek
dchar peek(size_t index)

Get character at specified index relative to current position.

peek
dchar peek()

Optimized version of peek() for the case where peek index is 0.

peekByte
char peekByte(size_t index)

Get byte at specified index relative to current position.

peekByte
char peekByte()

Optimized version of peekByte() for the case where peek byte index is 0.

prefix
char[] prefix(size_t length)

Get specified number of characters starting at current position.

prefixBytes
char[] prefixBytes(size_t length)

Get specified number of bytes, not code points, starting at current position.

slice
char[] slice(size_t end)

Get a slice view of the internal buffer, starting at the current position.

Meta