diff --git a/src/Parser.php b/src/Parser.php index ffa43786..a78f5aa2 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -197,6 +197,7 @@ private function parseList($parentNode, int $listParseContext) { while (!$this->isListTerminator($listParseContext)) { if ($this->isValidListElement($listParseContext, $this->getCurrentToken())) { $element = $parseListElementFn($parentNode); + $nodeArray[] = $element; if ($element instanceof Node) { $element->parent = $parentNode; if ($element instanceof InlineHtml && $element->echoStatement && $listParseContext === ParseContext::SourceElements) { @@ -205,7 +206,6 @@ private function parseList($parentNode, int $listParseContext) { $element->echoStatement = null; } } - $nodeArray[] = $element; continue; } diff --git a/tests/cases/parser/multipleInlineHtml.php b/tests/cases/parser/multipleInlineHtml.php new file mode 100644 index 00000000..ac18489d --- /dev/null +++ b/tests/cases/parser/multipleInlineHtml.php @@ -0,0 +1,2 @@ + + diff --git a/tests/cases/parser/multipleInlineHtml.php.diag b/tests/cases/parser/multipleInlineHtml.php.diag new file mode 100644 index 00000000..0637a088 --- /dev/null +++ b/tests/cases/parser/multipleInlineHtml.php.diag @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/cases/parser/multipleInlineHtml.php.tree b/tests/cases/parser/multipleInlineHtml.php.tree new file mode 100644 index 00000000..4032ab5d --- /dev/null +++ b/tests/cases/parser/multipleInlineHtml.php.tree @@ -0,0 +1,102 @@ +{ + "SourceFileNode": { + "statementList": [ + { + "InlineHtml": { + "scriptSectionEndTag": null, + "text": { + "kind": "InlineHtml", + "textLength": 6 + }, + "scriptSectionStartTag": { + "kind": "ScriptSectionStartWithEchoTag", + "textLength": 3 + } + } + }, + { + "ExpressionStatement": { + "expression": { + "EchoExpression": { + "echoKeyword": null, + "expressions": { + "ExpressionList": { + "children": [ + { + "Variable": { + "dollar": null, + "name": { + "kind": "VariableName", + "textLength": 5 + } + } + } + ] + } + } + } + }, + "semicolon": null + } + }, + { + "InlineHtml": { + "scriptSectionEndTag": { + "kind": "ScriptSectionEndTag", + "textLength": 2 + }, + "text": { + "kind": "InlineHtml", + "textLength": 14 + }, + "scriptSectionStartTag": { + "kind": "ScriptSectionStartWithEchoTag", + "textLength": 3 + } + } + }, + { + "ExpressionStatement": { + "expression": { + "EchoExpression": { + "echoKeyword": null, + "expressions": { + "ExpressionList": { + "children": [ + { + "Variable": { + "dollar": null, + "name": { + "kind": "VariableName", + "textLength": 5 + } + } + } + ] + } + } + } + }, + "semicolon": null + } + }, + { + "InlineHtml": { + "scriptSectionEndTag": { + "kind": "ScriptSectionEndTag", + "textLength": 2 + }, + "text": { + "kind": "InlineHtml", + "textLength": 8 + }, + "scriptSectionStartTag": null + } + } + ], + "endOfFileToken": { + "kind": "EndOfFileToken", + "textLength": 0 + } + } +} \ No newline at end of file