Skip to content

Commit b147c90

Browse files
committed
feat: add exception for not properly closed child node lists
1 parent 9bfbbef commit b147c90

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/Expression/Children.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace PackageFactory\Afx\Expression;
33

4+
use PackageFactory\Afx\Exception;
45
use PackageFactory\Afx\Lexer;
56

67
class Children
@@ -9,7 +10,11 @@ public static function parse(Lexer $lexer)
910
{
1011
$contents = [];
1112
$currentText = '';
12-
while (!$lexer->isEnd()) {
13+
while (true) {
14+
if ($lexer->isEnd()) {
15+
throw new Exception('Unfinished child-list');
16+
}
17+
1318
if ($lexer->isOpeningBracket()) {
1419
$lexer->consume();
1520

@@ -56,6 +61,8 @@ public static function parse(Lexer $lexer)
5661
continue;
5762
}
5863

64+
65+
5966
$currentText .= $lexer->consume();
6067
}
6168

0 commit comments

Comments
 (0)