fix lexing inline sequences/mappings with trailing whitespaces
This commit is contained in:
parent
b562a54e53
commit
66bc898f61
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -2683,7 +2683,7 @@ YAML;
|
|||
$this->parser->parse($yaml)
|
||||
);
|
||||
|
||||
$yaml = "\nfoo:\n bar: {}\n";
|
||||
$yaml = "\nfoo:\n bar: {} \n";
|
||||
$this->assertSame(
|
||||
[
|
||||
'foo' => [
|
||||
|
|
Reference in New Issue