scanYAMLDirectiveNumber now scans to slice.
This commit is contained in:
parent
e055506b29
commit
58b42750aa
|
@ -999,7 +999,7 @@ final class Scanner
|
||||||
{
|
{
|
||||||
findNextNonSpace();
|
findNextNonSpace();
|
||||||
|
|
||||||
reader_.sliceBuilder.write(scanYAMLDirectiveNumber(startMark));
|
scanYAMLDirectiveNumberToSlice(startMark);
|
||||||
enforce(reader_.peek() == '.',
|
enforce(reader_.peek() == '.',
|
||||||
new Error("While scanning a directive", startMark,
|
new Error("While scanning a directive", startMark,
|
||||||
"expected a digit or '.', but found: "
|
"expected a digit or '.', but found: "
|
||||||
|
@ -1008,7 +1008,7 @@ final class Scanner
|
||||||
reader_.forward();
|
reader_.forward();
|
||||||
|
|
||||||
reader_.sliceBuilder.write('.');
|
reader_.sliceBuilder.write('.');
|
||||||
reader_.sliceBuilder.write(scanYAMLDirectiveNumber(startMark));
|
scanYAMLDirectiveNumberToSlice(startMark);
|
||||||
enforce(" \0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()),
|
enforce(" \0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()),
|
||||||
new Error("While scanning a directive", startMark,
|
new Error("While scanning a directive", startMark,
|
||||||
"expected a digit or '.', but found: "
|
"expected a digit or '.', but found: "
|
||||||
|
@ -1016,7 +1016,10 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Scan a number from a YAML directive.
|
/// Scan a number from a YAML directive.
|
||||||
dchar[] scanYAMLDirectiveNumber(const Mark startMark) @safe pure
|
///
|
||||||
|
/// Assumes that the caller is building a slice in Reader, and puts the scanned
|
||||||
|
/// characters into that slice.
|
||||||
|
void scanYAMLDirectiveNumberToSlice(const Mark startMark) @system pure
|
||||||
{
|
{
|
||||||
enforce(isDigit(reader_.peek()),
|
enforce(isDigit(reader_.peek()),
|
||||||
new Error("While scanning a directive", startMark,
|
new Error("While scanning a directive", startMark,
|
||||||
|
@ -1027,7 +1030,7 @@ final class Scanner
|
||||||
uint length = 1;
|
uint length = 1;
|
||||||
while(isDigit(reader_.peek(length))) { ++length; }
|
while(isDigit(reader_.peek(length))) { ++length; }
|
||||||
|
|
||||||
return reader_.get(length);
|
reader_.sliceBuilder.write(reader_.get(length));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Scan value of a tag directive.
|
/// Scan value of a tag directive.
|
||||||
|
|
Loading…
Reference in a new issue