Php-parser: Support 7.2

Created on 30 Jul 2017  路  10Comments  路  Source: glayzzle/php-parser

enhancement php7 php-langspec

All 10 comments

@ichiriac friendly ping, can we add priority to Short list syntax? Many people move to 7.1 as minimum required version

hi @evilebottnawi, if I'm remember well, short list syntax was already implemented & released from another issue. I'll take a look son in order to publish a new release

@ichiriac not fully, example [,,$c,,$e,,] = $array

@evilebottnawi, ok I'll find some time this weekend to close some issues and make a release

Hi @evilebottnawi,

It's corrected, and should work in every cases, BUT this release will break backward compatibility :

I've introduced a shortForm property on list node, before we used 脿rray nodes for that. Also I've rewrote the arrays parsing to stick with the PHP implementation, and by doing this I've simplified the array AST node items.

It will be released on 3.0.0-alpha4 as the AST structure is not yet fully stable, still remains little bugfixes on edge cases to fix on this.

@ichiriac thanks for work

Hi @evilebottnawi, it's not finished, I don't like at all how short arrays are handled. The problem here is that the grammar on PHP 7.1 is permissive and they use the same node for vars deferencing and short arrays. They do a second pass at the bytecode generation to manage grammar logic but I need to do both on a single pass.

I'll start my vacations in 2 weeks, I'll work on a serious release then.

@ichiriac It is good news :+1: We have already done a serious job with prettier-php. Perhaps in the near future we will officially release stable version, will be great support all php 7.2 features.

PHP 7.2 is ready

Remains just an edge case : it's too permissive on array syntax $a = [,,$foo,,]; - I'll let it like this because it would consume CPU to handle this after parsing the array.

This fix is now relased under 3.0.0-alpha.3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nevadascout picture nevadascout  路  3Comments

Rivendall picture Rivendall  路  6Comments

aameen951 picture aameen951  路  7Comments

alexander-akait picture alexander-akait  路  8Comments

alexander-akait picture alexander-akait  路  5Comments