empty lines don't count for indent detection
This commit is contained in:
parent
50644d0d58
commit
eb073fa349
@ -543,8 +543,8 @@ class Parser
|
||||
do {
|
||||
$EOF = false;
|
||||
|
||||
// comment-like lines do not influence the indentation depth
|
||||
if ($this->isCurrentLineComment()) {
|
||||
// empty and comment-like lines do not influence the indentation depth
|
||||
if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
|
||||
$EOF = !$this->moveToNextLine();
|
||||
|
||||
if (!$EOF) {
|
||||
@ -571,7 +571,7 @@ class Parser
|
||||
$data = array();
|
||||
if ($this->getCurrentLineIndentation() >= $newIndent) {
|
||||
$data[] = substr($this->currentLine, $newIndent);
|
||||
} elseif ($this->isCurrentLineComment()) {
|
||||
} elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
|
||||
$data[] = $this->currentLine;
|
||||
} else {
|
||||
$this->moveToPreviousLine();
|
||||
|
@ -2073,6 +2073,18 @@ YAML;
|
||||
);
|
||||
$tests['mapping in sequence starting on a new line'] = array($yaml, $expected);
|
||||
|
||||
$yaml = <<<YAML
|
||||
foo:
|
||||
|
||||
bar: baz
|
||||
YAML;
|
||||
$expected = array(
|
||||
'foo' => array(
|
||||
'bar' => 'baz',
|
||||
),
|
||||
);
|
||||
$tests['blank line at the beginning of an indented mapping value'] = array($yaml, $expected);
|
||||
|
||||
return $tests;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user