fix issue #258
This commit is contained in:
parent
fb6d30e50e
commit
bd549ca017
|
@ -385,3 +385,11 @@ struct Loader
|
||||||
|
|
||||||
auto rootNode = loader.load();
|
auto rootNode = loader.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Issue #258 - https://github.com/dlang-community/D-YAML/issues/258
|
||||||
|
@safe unittest
|
||||||
|
{
|
||||||
|
auto yaml = "{\n\"root\": {\n\t\"key\": \"value\"\n }\n}";
|
||||||
|
auto doc = Loader.fromString(yaml).load();
|
||||||
|
assert(doc.isValid);
|
||||||
|
}
|
||||||
|
|
|
@ -57,6 +57,8 @@ alias isBreakOrSpace = among!(' ', '\0', '\n', '\r', '\u0085', '\u2028', '\u2029
|
||||||
|
|
||||||
alias isWhiteSpace = among!(' ', '\t', '\0', '\n', '\r', '\u0085', '\u2028', '\u2029');
|
alias isWhiteSpace = among!(' ', '\t', '\0', '\n', '\r', '\u0085', '\u2028', '\u2029');
|
||||||
|
|
||||||
|
alias isNonLinebreakWhitespace = among!(' ', '\t');
|
||||||
|
|
||||||
alias isNonScalarStartCharacter = among!('-', '?', ':', ',', '[', ']', '{', '}',
|
alias isNonScalarStartCharacter = among!('-', '?', ':', ',', '[', ']', '{', '}',
|
||||||
'#', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`', ' ', '\t', '\0', '\n',
|
'#', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`', ' ', '\t', '\0', '\n',
|
||||||
'\r', '\u0085', '\u2028', '\u2029');
|
'\r', '\u0085', '\u2028', '\u2029');
|
||||||
|
@ -799,9 +801,17 @@ struct Scanner
|
||||||
// Scanners for block, flow, and plain scalars need to be modified.
|
// Scanners for block, flow, and plain scalars need to be modified.
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
|
{
|
||||||
|
//All whitespace in flow context is ignored, even whitespace
|
||||||
|
// not allowed in other contexts
|
||||||
|
if (flowLevel_ > 0)
|
||||||
|
{
|
||||||
|
while(reader_.peekByte().isNonLinebreakWhitespace) { reader_.forward(); }
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
findNextNonSpace();
|
findNextNonSpace();
|
||||||
|
}
|
||||||
if(reader_.peekByte() == '#') { scanToNextBreak(); }
|
if(reader_.peekByte() == '#') { scanToNextBreak(); }
|
||||||
if(scanLineBreak() != '\0')
|
if(scanLineBreak() != '\0')
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue