-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Support for PHP 7 #2908
Comments
I've been staring really hard at https://github.com/ajaxorg/ace/blob/36e6744a5f40df0da52ff22b3bc729657c056e09/lib/ace/mode/php/php.js, but I cannot figure out how to add support for various php7 features. |
that file was taken from https://github.com/niklasvh/php.js, which seems to not be maintained anymore. |
PHP.js hasn't been actively maintained. It was created as a proof-of-concept. But the maintainer does merge pull requests for those looking to contribute. |
I also noticed niklasvh/php.js#69, but ACE only needs the parser; not the actual implementation. It seems the parser is 'simply' a converted yacc parser, but I cannot find the instructions to redo this with a the new parser from php7 |
I tried to find other JavaScript parser for PHP, but with no results... |
Uses kmyacc
From: |
I installed kmyacc on my mac, but when I try to run rebuildParser.php I got some Exception, because zend_language_parser.y - https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y - has got different structure than previous one so script throws Exception: Unknown macro "sizeof" :/ |
presumably we need another if statement in resolveMacros: |
The php.js parser is based on https://github.com/nikic/PHP-Parser. To make it work with PHP 7 one would have to update it to use (a modified version of) the grammar definition at https://github.com/nikic/PHP-Parser/blob/master/grammar/php7.y. As the grammar in php.js contains changes and the PHP-Parser has diverged quite a bit in the last 4 years, this will probably not be a simple update. |
From a quick look it seems like ace does not actually need any of the AST construction logic -- it uses the parser only for syntax checking. If all the semantic actions from the grammar are simply discarded, generating a new parser would probably be much simpler. |
PR up at #3107. |
@nikic awesome work; I've used your branch to create a new worker & mode which I've deployed on https://3v4l.org and it works great. Thanks! |
Hi,
Editor didn't understand php 7 constructs and mark it as incorrect;
show message: Syntax error, unexpected '=', expecting ')'
show message: Syntax error, unexpected ':', expecting '{'
show message: show message: Syntax error, unexpected ':', expecting T_VARIABLE
show message: show message: Syntax error, unexpected '?'
show message: show message: Syntax error, unexpected '>'
show message: show message: Syntax error, unexpected T_CLASS, expecting ')'
http://php.net/manual/en/migration70.new-features.php
The text was updated successfully, but these errors were encountered: