fix lexing inline sequences/mappings with trailing whitespaces
This commit is contained in:
parent
b562a54e53
commit
66bc898f61
@ -741,11 +741,11 @@ class Parser
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ('' !== $value && '{' === $value[0]) {
|
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);
|
return Inline::parse($this->lexInlineMapping($cursor), $flags, $this->refs);
|
||||||
} elseif ('' !== $value && '[' === $value[0]) {
|
} 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);
|
return Inline::parse($this->lexInlineSequence($cursor), $flags, $this->refs);
|
||||||
}
|
}
|
||||||
|
@ -2683,7 +2683,7 @@ YAML;
|
|||||||
$this->parser->parse($yaml)
|
$this->parser->parse($yaml)
|
||||||
);
|
);
|
||||||
|
|
||||||
$yaml = "\nfoo:\n bar: {}\n";
|
$yaml = "\nfoo:\n bar: {} \n";
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
[
|
[
|
||||||
'foo' => [
|
'foo' => [
|
||||||
|
Reference in New Issue
Block a user