php-parser icon indicating copy to clipboard operation
php-parser copied to clipboard

Question: nikic / PHP-Parser AST compatibility

Open oscarnevarezleal opened this issue 5 years ago • 3 comments

Does the AST data structure generated by this project share similarity with its counterpart on the PHP language ( nikic/PHP-Parser ) ?

I'm trying to parse as a significant amount of files and z7zmey/php-parser would be a deal-breaker for its speed, the problem is that I have several features depending on nikic/PHP-Parser mainly because of its AST Builder.

If I could share the same AST interoperability would be perfect.

oscarnevarezleal avatar Apr 05 '20 02:04 oscarnevarezleal

Same needs, looking forward to follow-up support

sohaha avatar Nov 02 '20 06:11 sohaha

hi @oscarnevarezleal and @sohaha. At 0.8 I have changed the AST structure back to be as same as possible as nikic/php-parser

Do you have any idea how AST could be transferred from Golang to PHP? I think about dumping to PHP deserializable string.

z7zmey avatar Feb 13 '21 20:02 z7zmey

Hey, @z7zmey I'll take a look at it this week.

Regarding your question, nikic/PHP-Parser contains some utilities to convert an AST into JSON and back, I'd dig into that.

oscarnevarezleal avatar Feb 18 '21 01:02 oscarnevarezleal