Fixed incorrectly marking "class" in "A::class" as a keyword. #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "php-class-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi!
There's a special class constant "::class" in PHP (https://www.php.net/manual/en/language.oop5.constants.php). If you have an expression like "$a = SomeClass::class;", the "class" is currently wrongly rendered as a keyword. This pull request fixes the behavior so that the "::class" constant would be rendered as a generic Name token.
I spent the last 5 hours figuring out the best way to tackle this problem and this solution is the best thing I can think of, given my very limited knowledge of the lezer philosophy. If you think that there's a better way to fix this, please just give me a nudge in that direction and I'll update the code.
Hi, thanks for the pull request. This is mostly the correct approach. But for consistency, and in order to support upper-case
CLASStokens, could you align the definition of the class token with the one forstatic, which has a similar issue in PHP? I.e.and then use
classwherever you now haveckw<"class">.Thanks! I didn't notice the "static"-related code before, I wish I saw it earlier. Anyway, I have updated the code.
Thanks!
I'm glad I was able to help. Thanks for your hard work!