PHP-Yacc
PHP-Yacc copied to clipboard
PHP7 example: invalid PHP code
The code generated from the yacc file in the example directory for php7 is not valid. All the class instantiations have square brackets instead of normal ones.
It seems that it‘s the same template copied over from the php parser. There the square brackets get replaced during parser generation.
What‘s the correct thing to do now? Add a feature to this lib to convert the square brackets or fix the yacc file in the example dir?
Fix this lib to convert the square brackets or fix the yacc file in the example dir?
Fix the yacc file.
@nikic alright. Should I fix it in the php parser repo and adjust the parser generation behavior there to be ready for this lib?
Or is there e specific reason why you chose square brackets over normal ones in your php parser?
Right now the square brackets only add a new and an attributes argument (https://github.com/nikic/PHP-Parser/blob/master/grammar/rebuildParsers.php#L103), though this used to be a larger transformation previously.
In any case, for the purpose of the example in this repository, we simply need to include the generated tmp_parser.y
file instead of the original one.