UTF-8 directive name scanning.
This commit is contained in:
parent
4307ccbe82
commit
ef735e280f
|
@ -927,25 +927,25 @@ final class Scanner
|
||||||
reader_.forward();
|
reader_.forward();
|
||||||
|
|
||||||
// Scan directive name
|
// Scan directive name
|
||||||
reader_.sliceBuilder.begin();
|
reader_.sliceBuilder8.begin();
|
||||||
scanDirectiveNameToSlice(startMark);
|
scanDirectiveNameToSlice8(startMark);
|
||||||
if(error_) { return Token.init; }
|
if(error_) { return Token.init; }
|
||||||
const name = reader_.sliceBuilder.finish();
|
const name = reader_.sliceBuilder8.finish();
|
||||||
|
|
||||||
reader_.sliceBuilder.begin();
|
reader_.sliceBuilder.begin();
|
||||||
|
|
||||||
// Index where tag handle ends and suffix starts in a tag directive value.
|
// Index where tag handle ends and suffix starts in a tag directive value.
|
||||||
uint tagHandleEnd = uint.max;
|
uint tagHandleEnd = uint.max;
|
||||||
if(name == "YAML"d) { scanYAMLDirectiveValueToSlice(startMark); }
|
if(name == "YAML") { scanYAMLDirectiveValueToSlice(startMark); }
|
||||||
else if(name == "TAG"d) { tagHandleEnd = scanTagDirectiveValueToSlice(startMark); }
|
else if(name == "TAG") { tagHandleEnd = scanTagDirectiveValueToSlice(startMark); }
|
||||||
if(error_) { return Token.init; }
|
if(error_) { return Token.init; }
|
||||||
const value = reader_.sliceBuilder.finish();
|
const value = reader_.sliceBuilder.finish();
|
||||||
|
|
||||||
Mark endMark = reader_.mark;
|
Mark endMark = reader_.mark;
|
||||||
|
|
||||||
DirectiveType directive;
|
DirectiveType directive;
|
||||||
if(name == "YAML"d) { directive = DirectiveType.YAML; }
|
if(name == "YAML") { directive = DirectiveType.YAML; }
|
||||||
else if(name == "TAG"d) { directive = DirectiveType.TAG; }
|
else if(name == "TAG") { directive = DirectiveType.TAG; }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
directive = DirectiveType.Reserved;
|
directive = DirectiveType.Reserved;
|
||||||
|
@ -966,10 +966,10 @@ final class Scanner
|
||||||
/// characters into that slice.
|
/// characters into that slice.
|
||||||
///
|
///
|
||||||
/// In case of an error, error_ is set. Use throwIfError() to handle this.
|
/// In case of an error, error_ is set. Use throwIfError() to handle this.
|
||||||
void scanDirectiveNameToSlice(const Mark startMark) @system pure nothrow @nogc
|
void scanDirectiveNameToSlice8(const Mark startMark) @system pure nothrow @nogc
|
||||||
{
|
{
|
||||||
// Scan directive name.
|
// Scan directive name.
|
||||||
scanAlphaNumericToSlice!"a directive"(startMark);
|
scanAlphaNumericToSlice8!"a directive"(startMark);
|
||||||
if(error_) { return; }
|
if(error_) { return; }
|
||||||
|
|
||||||
if(" \0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek())) { return; }
|
if(" \0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek())) { return; }
|
||||||
|
|
Loading…
Reference in a new issue