Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete PHP support #58

Closed
31 of 32 tasks
cfroystad opened this issue Apr 6, 2021 · 4 comments
Closed
31 of 32 tasks

Complete PHP support #58

cfroystad opened this issue Apr 6, 2021 · 4 comments

Comments

@cfroystad
Copy link
Collaborator

cfroystad commented Apr 6, 2021

After seeing discussions about bumping parsers to 1.0 after tree-sitter 1.0 is released, I figured it'd be good to list what remains to be done before having full support for parsing PHP using tree-sitter. I guess most of these should be solved before tree-sitter-php is bumped to 1.0 - at least if a 1.0 release means committing to not changing the AST.

This list is compiled from testing the code of PHP release announcements (from 7.0). Thus, I might have missed something. Feel free to add it if that's the case.

Pre 7.0

7.1

  • Symmetric array destructuring (rfc)
  • Multi catch exception handling (rfc)

7.4

8.0

8.1

In addition, there should be some house cleaning ensuring proper names on AST nodes. E.g. class_modifier is used for both classes and functions.

I'll try to get to these over time, but will not be able to get through all of them in the near future. So if anyone else wants to grab an item, I won't complain 😄

@maxbrunsfeld
Copy link
Contributor

Thanks for writing this up.

@cfroystad
Copy link
Collaborator Author

The remaining items i'll try to get to after the current PRs been reviewed and potentially merged. Don't stress about it - I understand there are other priorities in life and at work 🙂

@cfroystad
Copy link
Collaborator Author

With the last commits, we're at full compatibility all the way to PHP 8.1

I'm sure there's some bugs I've yet to identify. I've been playing with an idea of creating a test system with AST translation between tree-sitter-php and the "official" php-ast to ensure we're complete and correct. Though this is still on the "eventually" list...

I hope we'll be fully compatible with PHP 8.2 before its release (though I'll be careful with promises, because life).

Note: There's still one unchecked box on this list due to the ternary operator being left-assosiative before PHP 8. I've opted to leave this as a TODO in the code until the moment we decide to only support PHP8 and upwards (however, in the case of the concatenation precedence we currently favor PHP8 and leaves to the next layer to translate it back to the PHP7 interpretation if required). Let me know if you'd like me to handle this differently

@unansweredocd
Copy link

Folks, thank you so much for all the work that you're doing. Making it that much easier to work on php!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants