A version of scanToNextBreak that reads to a slice.

This commit is contained in:
Ferdinand Majerech 2014-07-26 02:27:11 +02:00
parent 6dbe9ad4ae
commit e38120c6db

View file

@ -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.
* *