UTF-8 scanTag
This commit is contained in:
parent
de6c1aacdb
commit
b789317df8
|
@ -1156,8 +1156,8 @@ final class Scanner
|
||||||
const startMark = reader_.mark;
|
const startMark = reader_.mark;
|
||||||
dchar c = reader_.peek(1);
|
dchar c = reader_.peek(1);
|
||||||
|
|
||||||
reader_.sliceBuilder.begin();
|
reader_.sliceBuilder8.begin();
|
||||||
scope(failure) { reader_.sliceBuilder.finish(); }
|
scope(failure) { reader_.sliceBuilder8.finish(); }
|
||||||
// Index where tag handle ends and tag suffix starts in the tag value
|
// Index where tag handle ends and tag suffix starts in the tag value
|
||||||
// (slice) we will produce.
|
// (slice) we will produce.
|
||||||
uint handleEnd;
|
uint handleEnd;
|
||||||
|
@ -1167,7 +1167,7 @@ final class Scanner
|
||||||
reader_.forward(2);
|
reader_.forward(2);
|
||||||
|
|
||||||
handleEnd = 0;
|
handleEnd = 0;
|
||||||
scanTagURIToSlice!"tag"(startMark);
|
scanTagURIToSlice8!"tag"(startMark);
|
||||||
if(error_) { return Token.init; }
|
if(error_) { return Token.init; }
|
||||||
if(reader_.peek() != '>')
|
if(reader_.peek() != '>')
|
||||||
{
|
{
|
||||||
|
@ -1181,7 +1181,7 @@ final class Scanner
|
||||||
{
|
{
|
||||||
reader_.forward();
|
reader_.forward();
|
||||||
handleEnd = 0;
|
handleEnd = 0;
|
||||||
reader_.sliceBuilder.write('!');
|
reader_.sliceBuilder8.write('!');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1201,25 +1201,25 @@ final class Scanner
|
||||||
|
|
||||||
if(useHandle)
|
if(useHandle)
|
||||||
{
|
{
|
||||||
scanTagHandleToSlice!"tag"(startMark);
|
scanTagHandleToSlice8!"tag"(startMark);
|
||||||
handleEnd = cast(uint)reader_.sliceBuilder.length;
|
handleEnd = cast(uint)reader_.sliceBuilder8.length;
|
||||||
if(error_) { return Token.init; }
|
if(error_) { return Token.init; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reader_.forward();
|
reader_.forward();
|
||||||
reader_.sliceBuilder.write('!');
|
reader_.sliceBuilder8.write('!');
|
||||||
handleEnd = cast(uint)reader_.sliceBuilder.length;
|
handleEnd = cast(uint)reader_.sliceBuilder8.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
scanTagURIToSlice!"tag"(startMark);
|
scanTagURIToSlice8!"tag"(startMark);
|
||||||
if(error_) { return Token.init; }
|
if(error_) { return Token.init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(" \0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()))
|
if(" \0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()))
|
||||||
{
|
{
|
||||||
const slice = reader_.sliceBuilder.finish();
|
const slice = reader_.sliceBuilder8.finish();
|
||||||
return tagToken(startMark, reader_.mark, slice.utf32To8, handleEnd);
|
return tagToken(startMark, reader_.mark, slice, handleEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
error("While scanning a tag", startMark, expected("' '", reader_.peek()),
|
error("While scanning a tag", startMark, expected("' '", reader_.peek()),
|
||||||
|
|
Loading…
Reference in a new issue