Scanner doc/style fixes.

This commit is contained in:
Ferdinand Majerech 2014-07-23 02:17:19 +02:00
parent ae7331c710
commit 9671da901e

View file

@ -710,7 +710,7 @@ final class Scanner
/// Check if the next token is DOCUMENT-START: ^ '---' (' '|'\n')
bool checkDocumentStart() @safe
{
//Check one char first, then all 3, to prevent reading outside stream.
// Check one char first, then all 3, to prevent reading outside the buffer.
return reader_.column == 0 &&
reader_.peek() == '-' &&
reader_.prefix(3) == "---" &&
@ -720,7 +720,7 @@ final class Scanner
/// Check if the next token is DOCUMENT-END: ^ '...' (' '|'\n')
bool checkDocumentEnd() @safe
{
//Check one char first, then all 3, to prevent reading outside stream.
// Check one char first, then all 3, to prevent reading outside the buffer.
return reader_.column == 0 &&
reader_.peek() == '.' &&
reader_.prefix(3) == "..." &&
@ -1348,6 +1348,7 @@ final class Scanner
/// Scan space characters in a flow scalar.
void scanFlowScalarSpaces(const Mark startMark) @system
{
// Increase length as long as we see whitespace.
uint length = 0;
while(" \t"d.canFind(reader_.peek(length))) { ++length; }
const whitespaces = reader_.prefix(length + 1);
@ -1466,8 +1467,8 @@ final class Scanner
/// Scan spaces in a plain scalar.
dstring scanPlainSpaces(const Mark startMark) @system
{
///The specification is really confusing about tabs in plain scalars.
///We just forbid them completely. Do not use tabs in YAML!
// The specification is really confusing about tabs in plain scalars.
// We just forbid them completely. Do not use tabs in YAML!
auto appender = appender!dstring();
uint length = 0;
@ -1619,18 +1620,16 @@ final class Scanner
}
/**
* Scan a line break, if any.
*
* Transforms:
* '\r\n' : '\n'
* '\r' : '\n'
* '\n' : '\n'
* '\u0085' : '\n'
* '\u2028' : '\u2028'
* '\u2029 : '\u2029'
* no break : '\0'
*/
/// Scan a line break, if any.
///
/// Transforms:
/// '\r\n' : '\n'
/// '\r' : '\n'
/// '\n' : '\n'
/// '\u0085' : '\n'
/// '\u2028' : '\u2028'
/// '\u2029 : '\u2029'
/// no break : '\0'
dchar scanLineBreak() @safe
{
const c = reader_.peek();