A version of scanToNextBreak that reads to a slice.
This commit is contained in:
parent
6dbe9ad4ae
commit
e38120c6db
|
@ -866,6 +866,20 @@ final class Scanner
|
||||||
return reader_.get(length);
|
return reader_.get(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Scan all characters until next line break.
|
||||||
|
///
|
||||||
|
/// Assumes that the caller is building a slice in Reader, and puts the scanned
|
||||||
|
/// characters into that slice.
|
||||||
|
void scanToNextBreakToSlice() @system pure nothrow @nogc
|
||||||
|
{
|
||||||
|
uint length = 0;
|
||||||
|
while(!"\0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek(length)))
|
||||||
|
{
|
||||||
|
++length;
|
||||||
|
}
|
||||||
|
reader_.sliceBuilder.write(reader_.get(length));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move to next token in the file/stream.
|
* Move to next token in the file/stream.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue