scanBlockScalar is now nothrow.

This commit is contained in:
Ferdinand Majerech 2014-07-26 02:53:05 +02:00
parent 6e2b9a7511
commit 09b11470ac

View file

@ -709,7 +709,9 @@ final class Scanner
//A simple key may follow a block scalar. //A simple key may follow a block scalar.
allowSimpleKey_ = true; allowSimpleKey_ = true;
tokens_.push(scanBlockScalar(style)); auto blockScalar = scanBlockScalar(style);
throwIfError();
tokens_.push(blockScalar);
} }
/// Aliases to add literal or folded block scalar. /// Aliases to add literal or folded block scalar.
@ -1162,8 +1164,9 @@ final class Scanner
} }
/// Scan a block scalar token with specified style. /// Scan a block scalar token with specified style.
Token scanBlockScalar(const ScalarStyle style) ///
@trusted pure /// In case of an error, error_ is set. Use throwIfError() to handle this.
Token scanBlockScalar(const ScalarStyle style) @trusted pure nothrow
{ {
const startMark = reader_.mark; const startMark = reader_.mark;
@ -1171,12 +1174,12 @@ final class Scanner
reader_.forward(); reader_.forward();
const indicators = scanBlockScalarIndicators(startMark); const indicators = scanBlockScalarIndicators(startMark);
throwIfError(); if(error_) { return Token.init; }
const chomping = indicators[0]; const chomping = indicators[0];
const increment = indicators[1]; const increment = indicators[1];
scanBlockScalarIgnoredLine(startMark); scanBlockScalarIgnoredLine(startMark);
throwIfError(); if(error_) { return Token.init; }
// 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;