Skip to content

Commit 6786710

Browse files
committed
release 2.2.0
1 parent 9b9ccc6 commit 6786710

File tree

5 files changed

+30
-14
lines changed

5 files changed

+30
-14
lines changed

RELEASE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Releases
22

3+
## 2.2.0 : (2017-12-27)
4+
- Impl #108 : add an option to disable PHP7 support
5+
- Fix #107 : fix T_DOUBLE_COLON handler
6+
- Fix #106 : infinite loops from lexer (unput)
7+
- Fix #105 : T_DOLLAR_OPEN_CURLY_BRACES handles now expressions
8+
- PR #102 : Normalize the way type casts are defined
9+
- Fix #103 : Fix critical cast to null confusion
10+
311
## 2.1.0 : (2017-11-01)
412
- Impl #91 & #92 : Functions support reserved names (PHP7)
513
- Fix #89 : parsing methods can use Buffers or Strings

dist/php-parser.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! php-parser - BSD3 License - 2017-12-27 */
1+
/*! php-parser - BSD3 License - 2017-12-28 */
22

33
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){
44
/*!
@@ -3028,6 +3028,7 @@ var lexer = function(engine) {
30283028
this.mode_eval = false;
30293029
this.asp_tags = false;
30303030
this.short_tags = true;
3031+
this.php7 = true;
30313032
this.yyprevcol = 0;
30323033
this.keywords = {
30333034
"__class__": this.tok.T_CLASS_C,
@@ -4298,7 +4299,7 @@ module.exports = {
42984299
var id = this.keywords[token];
42994300
if (typeof id !== 'number') {
43004301
if (token === 'yield') {
4301-
if (this.tryMatch(' from')) {
4302+
if (this.php7 && this.tryMatch(' from')) {
43024303
this.consume(5);
43034304
id = this.tok.T_YIELD_FROM;
43044305
} else {
@@ -4440,7 +4441,7 @@ module.exports = {
44404441
return '!';
44414442
},
44424443
'?': function() {
4443-
if (this._input[this.offset] === '?') {
4444+
if (this.php7 && this._input[this.offset] === '?') {
44444445
this.input();
44454446
return this.tok.T_COALESCE;
44464447
}
@@ -4462,7 +4463,7 @@ module.exports = {
44624463
return this.tok.T_SL;
44634464
} else if (nchar === '=') {
44644465
this.input();
4465-
if (this._input[this.offset] === '>') {
4466+
if (this.php7 && this._input[this.offset] === '>') {
44664467
this.input();
44674468
return this.tok.T_SPACESHIP;
44684469
} else {
@@ -8572,6 +8573,13 @@ var engine = function(options) {
85728573
this.ast = new AST();
85738574
this.parser = new parser(this.lexer, this.ast);
85748575
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+
}
85758583
combine(options, this);
85768584
}
85778585
};

0 commit comments

Comments
 (0)