scanTagDirectiveValue returns handle length with return value, not ref param

This commit is contained in:
Ferdinand Majerech 2014-07-26 18:19:26 +02:00
parent 271eca053a
commit f11fbf3b36

View file

@ -949,7 +949,7 @@ final class Scanner
// 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"d) { scanYAMLDirectiveValueToSlice(startMark); }
else if(name == "TAG"d) { scanTagDirectiveValueToSlice(startMark, tagHandleEnd); } else if(name == "TAG"d) { tagHandleEnd = scanTagDirectiveValueToSlice(startMark); }
throwIfError(); throwIfError();
const value = reader_.sliceBuilder.finish(); const value = reader_.sliceBuilder.finish();
@ -1051,17 +1051,21 @@ final class Scanner
/// Assumes that the caller is building a slice in Reader, and puts the scanned /// Assumes that the caller is building a slice in Reader, and puts the scanned
/// characters into that slice. /// characters into that slice.
/// ///
/// Returns: Length of tag handle (which is before tag prefix) in scanned data
///
/// 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 scanTagDirectiveValueToSlice(const Mark startMark, ref uint handleLength) uint scanTagDirectiveValueToSlice(const Mark startMark)
@system pure nothrow @system pure nothrow
{ {
findNextNonSpace(); findNextNonSpace();
const startLength = reader_.sliceBuilder.length; const startLength = reader_.sliceBuilder.length;
scanTagDirectiveHandleToSlice(startMark); scanTagDirectiveHandleToSlice(startMark);
if(error_) { return; } if(error_) { return uint.max; }
handleLength = cast(uint)(reader_.sliceBuilder.length - startLength); const handleLength = cast(uint)(reader_.sliceBuilder.length - startLength);
findNextNonSpace(); findNextNonSpace();
scanTagDirectivePrefixToSlice(startMark); scanTagDirectivePrefixToSlice(startMark);
return handleLength;
} }
/// Scan handle of a tag directive. /// Scan handle of a tag directive.