Use of throwIfError for handling scanPlain errors.
This commit is contained in:
parent
60c3079f11
commit
45d8db08d1
|
@ -717,25 +717,21 @@ final class Scanner
|
||||||
alias fetchFlowScalar!(ScalarStyle.SingleQuoted) fetchSingle;
|
alias fetchFlowScalar!(ScalarStyle.SingleQuoted) fetchSingle;
|
||||||
alias fetchFlowScalar!(ScalarStyle.DoubleQuoted) fetchDouble;
|
alias fetchFlowScalar!(ScalarStyle.DoubleQuoted) fetchDouble;
|
||||||
|
|
||||||
///Add plain SCALAR token.
|
/// Add plain SCALAR token.
|
||||||
void fetchPlain() @trusted
|
void fetchPlain() @trusted
|
||||||
{
|
{
|
||||||
//A plain scalar could be a simple key
|
// A plain scalar could be a simple key
|
||||||
savePossibleSimpleKey();
|
savePossibleSimpleKey();
|
||||||
//No simple keys after plain scalars. But note that scanPlain() will
|
// No simple keys after plain scalars. But note that scanPlain() will
|
||||||
//change this flag if the scan is finished at the beginning of the line.
|
// change this flag if the scan is finished at the beginning of the line.
|
||||||
allowSimpleKey_ = false;
|
allowSimpleKey_ = false;
|
||||||
const plain = scanPlain();
|
const plain = scanPlain();
|
||||||
if(error_)
|
throwIfError();
|
||||||
{
|
|
||||||
error_ = false;
|
// Scan and add SCALAR. May change allowSimpleKey_
|
||||||
throw new Error(errorData_);
|
|
||||||
}
|
|
||||||
//Scan and add SCALAR. May change allowSimpleKey_
|
|
||||||
tokens_.push(plain);
|
tokens_.push(plain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///Check if the next token is DIRECTIVE: ^ '%' ...
|
///Check if the next token is DIRECTIVE: ^ '%' ...
|
||||||
bool checkDirective() @safe pure nothrow @nogc
|
bool checkDirective() @safe pure nothrow @nogc
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue