scanBlockScalarIgnoredLine is now nothrow @nogc.

This commit is contained in:
Ferdinand Majerech 2014-07-25 21:22:44 +02:00
parent b5bbd2a03b
commit 3cf56c8061

View file

@ -1161,6 +1161,7 @@ final class Scanner
const chomping = indicators[0]; const chomping = indicators[0];
const increment = indicators[1]; const increment = indicators[1];
scanBlockScalarIgnoredLine(startMark); scanBlockScalarIgnoredLine(startMark);
throwIfError();
//Determine the indentation level and go to the first non-empty line. //Determine the indentation level and go to the first non-empty line.
Mark endMark; Mark endMark;
@ -1292,6 +1293,8 @@ final class Scanner
/// the next character in the Reader. /// the next character in the Reader.
/// increment = Write the increment value here, if detected. /// increment = Write the increment value here, if detected.
/// startMark = Mark for error messages. /// startMark = Mark for error messages.
///
/// In case of an error, error_ is set. Use throwIfError() to handle this.
bool getIncrement(ref dchar c, ref int increment, const Mark startMark) bool getIncrement(ref dchar c, ref int increment, const Mark startMark)
@safe pure nothrow @nogc @safe pure nothrow @nogc
{ {
@ -1312,15 +1315,20 @@ final class Scanner
} }
/// Scan (and ignore) ignored line in a block scalar. /// Scan (and ignore) ignored line in a block scalar.
void scanBlockScalarIgnoredLine(const Mark startMark) @safe pure ///
/// In case of an error, error_ is set. Use throwIfError() to handle this.
void scanBlockScalarIgnoredLine(const Mark startMark) @safe pure nothrow @nogc
{ {
findNextNonSpace(); findNextNonSpace();
if(reader_.peek()== '#') { scanToNextBreak(); } if(reader_.peek()== '#') { scanToNextBreak(); }
enforce("\0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()), if(!"\0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()))
new Error("While scanning a block scalar", startMark, {
"expected a comment or a line break, but found " setError("While scanning a block scalar", startMark,
~ to!string(reader_.peek()), reader_.mark)); buildMsg("expected comment or line break, but found ", reader_.peek()),
reader_.mark);
return;
}
scanLineBreak(); scanLineBreak();
} }