1
- /*! php-parser - BSD3 License - 2017-12-27 */
1
+ /*! php-parser - BSD3 License - 2017-12-28 */
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
/*!
@@ -3028,6 +3028,7 @@ var lexer = function(engine) {
3028
3028
this . mode_eval = false ;
3029
3029
this . asp_tags = false ;
3030
3030
this . short_tags = true ;
3031
+ this . php7 = true ;
3031
3032
this . yyprevcol = 0 ;
3032
3033
this . keywords = {
3033
3034
"__class__" : this . tok . T_CLASS_C ,
@@ -4298,7 +4299,7 @@ module.exports = {
4298
4299
var id = this . keywords [ token ] ;
4299
4300
if ( typeof id !== 'number' ) {
4300
4301
if ( token === 'yield' ) {
4301
- if ( this . tryMatch ( ' from' ) ) {
4302
+ if ( this . php7 && this . tryMatch ( ' from' ) ) {
4302
4303
this . consume ( 5 ) ;
4303
4304
id = this . tok . T_YIELD_FROM ;
4304
4305
} else {
@@ -4440,7 +4441,7 @@ module.exports = {
4440
4441
return '!' ;
4441
4442
} ,
4442
4443
'?' : function ( ) {
4443
- if ( this . _input [ this . offset ] === '?' ) {
4444
+ if ( this . php7 && this . _input [ this . offset ] === '?' ) {
4444
4445
this . input ( ) ;
4445
4446
return this . tok . T_COALESCE ;
4446
4447
}
@@ -4462,7 +4463,7 @@ module.exports = {
4462
4463
return this . tok . T_SL ;
4463
4464
} else if ( nchar === '=' ) {
4464
4465
this . input ( ) ;
4465
- if ( this . _input [ this . offset ] === '>' ) {
4466
+ if ( this . php7 && this . _input [ this . offset ] === '>' ) {
4466
4467
this . input ( ) ;
4467
4468
return this . tok . T_SPACESHIP ;
4468
4469
} else {
@@ -8572,6 +8573,13 @@ var engine = function(options) {
8572
8573
this . ast = new AST ( ) ;
8573
8574
this . parser = new parser ( this . lexer , this . ast ) ;
8574
8575
if ( options && typeof options === 'object' ) {
8576
+ // disable php7 from lexer if already disabled from parser
8577
+ if ( options . parser && options . parser . php7 === false ) {
8578
+ if ( ! options . lexer ) {
8579
+ options . lexer = { } ;
8580
+ }
8581
+ options . lexer . php7 = false ;
8582
+ }
8575
8583
combine ( options , this ) ;
8576
8584
}
8577
8585
} ;
0 commit comments