Using buildMsg to simplify error messages.
This commit is contained in:
parent
1b5eea58bf
commit
4e3619cf6a
|
@ -1433,10 +1433,9 @@ final class Scanner
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto msg = msgBuffer_.printNoGC("found unsupported escape "
|
|
||||||
"character", c);
|
|
||||||
setError("While scanning a double quoted scalar", startMark,
|
setError("While scanning a double quoted scalar", startMark,
|
||||||
cast(string)msg, reader_.mark);
|
buildMsg("found unsupported escape " "character", c),
|
||||||
|
reader_.mark);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1597,7 +1596,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
spacesTransaction.__dtor();
|
spacesTransaction.__dtor();
|
||||||
dstring slice = reader_.sliceBuilder.finish();
|
const slice = reader_.sliceBuilder.finish();
|
||||||
|
|
||||||
return scalarToken(startMark, endMark, slice.utf32To8, ScalarStyle.Plain);
|
return scalarToken(startMark, endMark, slice.utf32To8, ScalarStyle.Plain);
|
||||||
}
|
}
|
||||||
|
@ -1687,8 +1686,8 @@ final class Scanner
|
||||||
enum contextMsg = "While scanning a " ~ name;
|
enum contextMsg = "While scanning a " ~ name;
|
||||||
if(c != '!')
|
if(c != '!')
|
||||||
{
|
{
|
||||||
auto msg = msgBuffer_.printNoGC("expected a '!', but found: ", c);
|
setError(contextMsg, startMark,
|
||||||
setError(contextMsg, startMark, cast(string)msg, reader_.mark);
|
buildMsg("expected a '!', but found: ", c), reader_.mark);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1704,8 +1703,8 @@ final class Scanner
|
||||||
if(c != '!')
|
if(c != '!')
|
||||||
{
|
{
|
||||||
reader_.forward(length);
|
reader_.forward(length);
|
||||||
auto msg = msgBuffer_.printNoGC("expected a '!', but found: ", c);
|
setError(contextMsg, startMark,
|
||||||
setError(contextMsg, startMark, cast(string)msg, reader_.mark);
|
buildMsg("expected a '!', but found: ", c), reader_.mark);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
++length;
|
++length;
|
||||||
|
@ -1752,8 +1751,7 @@ final class Scanner
|
||||||
if(anyChars) { return; }
|
if(anyChars) { return; }
|
||||||
|
|
||||||
enum contextMsg = "While parsing a " ~ name;
|
enum contextMsg = "While parsing a " ~ name;
|
||||||
setError(contextMsg, startMark,
|
setError(contextMsg, startMark, buildMsg("expected URI, but found: ", c),
|
||||||
cast(string)msgBuffer_.printNoGC("expected URI, but found: ", c),
|
|
||||||
reader_.mark);
|
reader_.mark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1815,11 +1813,9 @@ final class Scanner
|
||||||
const dchar c = reader_.peek(k);
|
const dchar c = reader_.peek(k);
|
||||||
if(!c.isHexDigit)
|
if(!c.isHexDigit)
|
||||||
{
|
{
|
||||||
auto msg = msgBuffer_.printNoGC(
|
auto msg = buildMsg("expected URI escape sequence of 2 "
|
||||||
"expected URI escape sequence of 2 hexadecimal "
|
"hexadecimal numbers, but found: ", c);
|
||||||
"numbers, but found: ", c);
|
setError(contextMsg, startMark, msg, reader_.mark);
|
||||||
setError(contextMsg, startMark, cast(string)msg,
|
|
||||||
reader_.mark);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue