Start the Rosetta initiative for bring hlphp back up to speed #109
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greetings! If you've landed in this PR, then you've been linked to it by me, notified about it because you're watching this repo, or you're incredibly curious about what the fuck I am doing. Here's the situation:
Since the release of highlight.js v10, JSON-only language definitions were no longer possible because hljs introduced function support into language definitions. Historically, highlight.php (hlphp) has relied on JSON-only representations of language definitions but there's no way to represent functions in JSON. So does that mean the death of this project? Am I going to be manually maintaining 190+ language definitions?
Here's the crazy idea I came up with one night while being in an impaired state, why not write a translator for language definitions written in JavaScript to now be written in PHP? Are there existing projects out there at attempted this? Yes. The ones I've found are not as active or do not support modern JS syntax.
Enter, Rosetta-PhpScript. Internally, it uses Babel to generate an AST and then I parse that AST and start translating it into a valid PHP AST that nikic's php-parser can handle and then generate valid PHP.
Is there an ETA on this? Nope! My former employer has suddenly gifted me "time off", so I've got some time to kill. I'm hoping to get this project done this summer but no promises!