tolerant-php-parser
tolerant-php-parser copied to clipboard
An early-stage PHP parser designed for IDE usage scenarios.
We should consider better ways to "squash" these constructs for common scenarios to help improve memory usage.
Cast expressions may not contain anything except spaces and tabs between the parentheses. In the following example, the parser generates a CastExpression while PHP sees it as a constant named...
A basic implementation of this would be adding a method `Node::getDescendantTokenAtPosition` (similar to `Node::getDescendantNodeAtPosition`), and because the tree is fully representative, we could simply `$rootNode->getTokenAtPosition($token->getEnd())` or `$rootNode->getTokenAtPosition($token->getFullStart()-1)`. Eventually, the method...
Some delimited lists can have empty elements, and some delimited lists cannot. However, we don't specify concrete rulesets for each of these list types, and everything gets parsed in the...
The API was somewhat haphazardly strewn together as an exploratory proof-of-concept, so it'll be good to start being more deliberate and increasing our test coverage in this area.
As discussed in [HowItWorks.md#notes](https://github.com/Microsoft/tolerant-php-parser/blob/master/docs/HowItWorks.md#notes), there are ways that we can significantly reduce memory usage by moving away from objects for Tokens. This issue tracks progress on that work.
As discussed in [HowItWorks.md#incremental-parsing](https://github.com/Microsoft/tolerant-php-parser/blob/master/docs/HowItWorks.md#incremental-parsing), the parser is currently designed such that incremental parsing is a possibility in the future. This issue tracks progress on that work.
We continually run tests on: * CodeIgniter * WordPress * cakephp * math-php * symfony We should add more frameworks to the list (and feel free to make a PR...
We are using `iterator_to_array` during some tree traversals, which is good tell-tale sign that those operations could be further optimized so we don't have to duplicate every element in memory.
This will help us detect potential issues earlier and also make it more broadly apparent what the current status of the parser is.