TysonAndre / php-parser-to-php-ast

Abandoned. Supports only PHPParser 3. convert PHPParser\Node to \ast\Node. See https://github.com/TysonAndre/tolerant-php-parser-to-php-ast/ for better error tolerance.
MIT License
1 stars 2 forks source link

Switch from returning null to throwing `IncompleteExpressionException` #15

Open TysonAndre opened 7 years ago

TysonAndre commented 7 years ago

If PHP code is syntactically invalid, this currently returns null. Parent nodes may or may not be able to handle that, leading to uncaught Error/Exception or callers getting invalid parse trees

Ideally the returned results would be identical to the parse tree for some other syntactically valid code. Catch this exception at the level of statements in statement lists, or possibly earlier (e.g. convert $a + to $a, [$a, to [$a]

Same as https://github.com/TysonAndre/tolerant-php-parser-to-php-ast/issues/3

TysonAndre commented 7 years ago

Implemented, chose the name of IncompleteNodeExpression instead