scanDirective is now nothrow and mostly @nogc.
This commit is contained in:
parent
14a8e31fa5
commit
9d480d1723
|
@ -490,16 +490,18 @@ final class Scanner
|
||||||
done_ = true;
|
done_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///Add DIRECTIVE token.
|
/// Add DIRECTIVE token.
|
||||||
void fetchDirective() @safe
|
void fetchDirective() @safe
|
||||||
{
|
{
|
||||||
//Set intendation to -1 .
|
// Set intendation to -1 .
|
||||||
unwindIndent(-1);
|
unwindIndent(-1);
|
||||||
//Reset simple keys.
|
// Reset simple keys.
|
||||||
removePossibleSimpleKey();
|
removePossibleSimpleKey();
|
||||||
allowSimpleKey_ = false;
|
allowSimpleKey_ = false;
|
||||||
|
|
||||||
tokens_.push(scanDirective());
|
const directive = scanDirective();
|
||||||
|
throwIfError();
|
||||||
|
tokens_.push(directive);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Add DOCUMENT-START or DOCUMENT-END token.
|
///Add DOCUMENT-START or DOCUMENT-END token.
|
||||||
|
@ -929,7 +931,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Scan directive token.
|
/// Scan directive token.
|
||||||
Token scanDirective() @trusted pure
|
Token scanDirective() @trusted pure nothrow
|
||||||
{
|
{
|
||||||
Mark startMark = reader_.mark;
|
Mark startMark = reader_.mark;
|
||||||
// Skip the '%'.
|
// Skip the '%'.
|
||||||
|
@ -938,7 +940,7 @@ final class Scanner
|
||||||
// Scan directive name
|
// Scan directive name
|
||||||
reader_.sliceBuilder.begin();
|
reader_.sliceBuilder.begin();
|
||||||
scanDirectiveNameToSlice(startMark);
|
scanDirectiveNameToSlice(startMark);
|
||||||
throwIfError();
|
if(error_) { return Token.init; }
|
||||||
const name = reader_.sliceBuilder.finish();
|
const name = reader_.sliceBuilder.finish();
|
||||||
|
|
||||||
reader_.sliceBuilder.begin();
|
reader_.sliceBuilder.begin();
|
||||||
|
@ -947,7 +949,7 @@ final class Scanner
|
||||||
uint tagHandleEnd = uint.max;
|
uint tagHandleEnd = uint.max;
|
||||||
if(name == "YAML"d) { scanYAMLDirectiveValueToSlice(startMark); }
|
if(name == "YAML"d) { scanYAMLDirectiveValueToSlice(startMark); }
|
||||||
else if(name == "TAG"d) { tagHandleEnd = scanTagDirectiveValueToSlice(startMark); }
|
else if(name == "TAG"d) { tagHandleEnd = scanTagDirectiveValueToSlice(startMark); }
|
||||||
throwIfError();
|
if(error_) { return Token.init; }
|
||||||
const value = reader_.sliceBuilder.finish();
|
const value = reader_.sliceBuilder.finish();
|
||||||
|
|
||||||
Mark endMark = reader_.mark;
|
Mark endMark = reader_.mark;
|
||||||
|
@ -962,7 +964,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
scanDirectiveIgnoredLine(startMark);
|
scanDirectiveIgnoredLine(startMark);
|
||||||
throwIfError();
|
if(error_) { return Token.init; }
|
||||||
|
|
||||||
//Storing directive name and value in a single string, separated by zero.
|
//Storing directive name and value in a single string, separated by zero.
|
||||||
return directiveToken(startMark, endMark, utf32To8(value),
|
return directiveToken(startMark, endMark, utf32To8(value),
|
||||||
|
|
Loading…
Reference in a new issue