1
- /*! php-parser - BSD3 License - 2018-03-25 */
1
+ /*! php-parser - BSD3 License - 2018-03-26 */
2
2
3
3
require = ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( require , module , exports ) {
4
4
/*!
@@ -5515,7 +5515,7 @@ module.exports = {
5515
5515
read_comment : function read_comment ( ) {
5516
5516
var text = this . text ( ) ;
5517
5517
var result = this . ast . prepare ( text . substring ( 0 , 2 ) === "/*" ? "commentblock" : "commentline" , null , this ) ;
5518
- this . token = this . lexer . lex ( ) || this . EOF ;
5518
+ this . lex ( ) ;
5519
5519
return result ( text ) ;
5520
5520
} ,
5521
5521
/**
@@ -5524,7 +5524,7 @@ module.exports = {
5524
5524
read_doc_comment : function read_doc_comment ( ) {
5525
5525
var result = this . ast . prepare ( "commentblock" , null , this ) ;
5526
5526
var text = this . text ( ) ;
5527
- this . token = this . lexer . lex ( ) || this . EOF ;
5527
+ this . lex ( ) ;
5528
5528
return result ( text ) ;
5529
5529
}
5530
5530
} ;
@@ -5620,18 +5620,7 @@ module.exports = {
5620
5620
var node = this . node ( "parenthesis" ) ;
5621
5621
expr = this . next ( ) . read_expr ( ) ;
5622
5622
this . expect ( ")" ) && this . next ( ) ;
5623
- expr = node ( expr ) ;
5624
- // handle dereferencable
5625
- if ( this . token === this . tok . T_OBJECT_OPERATOR ) {
5626
- return this . recursive_variable_chain_scan ( expr , false ) ;
5627
- } else if ( this . token === this . tok . T_CURLY_OPEN || this . token === "[" ) {
5628
- return this . read_dereferencable ( expr ) ;
5629
- } else if ( this . token === "(" ) {
5630
- // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1118
5631
- return this . node ( "call" ) ( expr , this . read_function_argument_list ( ) ) ;
5632
- } else {
5633
- return expr ;
5634
- }
5623
+ return this . handleDereferencable ( node ( expr ) ) ;
5635
5624
}
5636
5625
5637
5626
if ( this . token === "`" ) {
@@ -5681,6 +5670,15 @@ module.exports = {
5681
5670
}
5682
5671
}
5683
5672
5673
+ if ( this . token === "[" ) {
5674
+ expr = this . read_array ( ) ;
5675
+ if ( this . token === "=" ) {
5676
+ return this . node ( "assign" ) ( expr , this . next ( ) . read_expr ( ) , "=" ) ;
5677
+ } else {
5678
+ return this . handleDereferencable ( expr ) ;
5679
+ }
5680
+ }
5681
+
5684
5682
if ( this . token === this . tok . T_CLONE ) return this . node ( "clone" ) ( this . next ( ) . read_expr ( ) ) ;
5685
5683
5686
5684
switch ( this . token ) {
@@ -5910,19 +5908,7 @@ module.exports = {
5910
5908
}
5911
5909
} else if ( this . is ( "SCALAR" ) ) {
5912
5910
expr = this . read_scalar ( ) ;
5913
- // handle dereferencable
5914
- while ( this . token !== this . EOF ) {
5915
- if ( this . token === this . tok . T_OBJECT_OPERATOR ) {
5916
- expr = this . recursive_variable_chain_scan ( expr , false ) ;
5917
- } else if ( this . token === this . tok . T_CURLY_OPEN || this . token === "[" ) {
5918
- expr = this . read_dereferencable ( expr ) ;
5919
- } else if ( this . token === "(" ) {
5920
- // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1118
5921
- expr = this . node ( "call" ) ( expr , this . read_function_argument_list ( ) ) ;
5922
- } else {
5923
- return expr ;
5924
- }
5925
- }
5911
+ return this . handleDereferencable ( expr ) ;
5926
5912
} else {
5927
5913
this . error ( "EXPR" ) ;
5928
5914
this . next ( ) ;
@@ -6007,6 +5993,22 @@ module.exports = {
6007
5993
result = [ "key" , result , this . next ( ) . read_expr_item ( ) ] ;
6008
5994
}
6009
5995
return result ;
5996
+ } ,
5997
+
5998
+ handleDereferencable : function handleDereferencable ( expr ) {
5999
+ while ( this . token !== this . EOF ) {
6000
+ if ( this . token === this . tok . T_OBJECT_OPERATOR ) {
6001
+ expr = this . recursive_variable_chain_scan ( expr , false ) ;
6002
+ } else if ( this . token === this . tok . T_CURLY_OPEN || this . token === "[" ) {
6003
+ expr = this . read_dereferencable ( expr ) ;
6004
+ } else if ( this . token === "(" ) {
6005
+ // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1118
6006
+ expr = this . node ( "call" ) ( expr , this . read_function_argument_list ( ) ) ;
6007
+ } else {
6008
+ return expr ;
6009
+ }
6010
+ }
6011
+ return expr ;
6010
6012
}
6011
6013
} ;
6012
6014
0 commit comments