fix lexing inline sequences/mappings with trailing whitespaces

This commit is contained in:
Christian Flothmann 2020-11-30 13:47:21 +01:00
parent b562a54e53
commit 66bc898f61
2 changed files with 3 additions and 3 deletions

View File

@ -741,11 +741,11 @@ class Parser
try {
if ('' !== $value && '{' === $value[0]) {
$cursor = \strlen($this->currentLine) - \strlen($value);
$cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value));
return Inline::parse($this->lexInlineMapping($cursor), $flags, $this->refs);
} elseif ('' !== $value && '[' === $value[0]) {
$cursor = \strlen($this->currentLine) - \strlen($value);
$cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value));
return Inline::parse($this->lexInlineSequence($cursor), $flags, $this->refs);
}

View File

@ -2683,7 +2683,7 @@ YAML;
$this->parser->parse($yaml)
);
$yaml = "\nfoo:\n bar: {}\n";
$yaml = "\nfoo:\n bar: {} \n";
$this->assertSame(
[
'foo' => [