Nikita Popov

Results 517 comments of Nikita Popov

> Could you link where the implementation with native properties would be problematic ("initial construction")? The initial construction is https://github.com/nikic/PHP-Parser/blob/master/lib/PhpParser/NodeAbstract.php#L15. This would require copying all the attributes into the dynamic...

@felixfbecker This happens in generated code. Something like `Node\Const_[$1, $3]` in the grammar expands to `new Node\Const_(..., ..., $this->startAttributesStack[...] + $this->endAttributes)`. The attribute arrays come from the lexer. The generating...

Btw, another potential complication with using dynamic properties is that you can no longer have a subnode and attribute with the same name, which is currently supported. (Personally not particularly...

What percentage of the time is it though?

Can you please provide an example of what this means? I don't understand what "add" would do if the parent is not an array.

@theofidry Isn't this the same as using the array return value in `leaveNode()`? Is the feature request here to also allow this in `enterNode()`, or does `NullNode` provide some different/additional...

I still don't understand what this is about. The ability to return arrays already exists and the example in https://github.com/nikic/PHP-Parser/issues/507#issuecomment-395967805 would already work with it for leaveNode. Is this about...

If this is about enterNode, then yeah I'm fine with that in principle. One tricky issue is how this will interact, in particular will the newly inserted nodes be visited...

Implemented in https://github.com/nikic/PHP-Parser/commit/a3b0541c71cf439526beffcfe72d6e1aaeae9a3a. Both array return and REMOVE_NODE are now supported from enterNode().

Even the non-emulative lexer has to perform some baseline-level of emulation to work around PHP bugs. In particular, emulation of T_BAD_CHARACTER is a requirement for having accurate token positioning. T_NAME_*...