Skip to content

Commit bb2c494

Browse files
committed
unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_OBJECT_OPERATOR
fixes #45
1 parent 920b7e5 commit bb2c494

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

PHP.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7088,9 +7088,9 @@ PHP.Lexer = function( src, ini ) {
70887088

70897089
var re;
70907090
if ( curlyOpen > 0) {
7091-
re = /^([^\\\$"{}\]]|\\.)+/g;
7091+
re = /^([^\\\$"{}\]\)\->]|\\.)+/g;
70927092
} else {
7093-
re = /^([^\\\$"{]|\\.|{[^\$])+/g;
7093+
re = /^([^\\\$"{]|\\.|{[^\$]|\$(?=[^a-zA-Z_\x7f-\uffff]))+/g;
70947094
}
70957095

70967096
while(( match = result.match( re )) !== null ) {
@@ -7103,7 +7103,7 @@ PHP.Lexer = function( src, ini ) {
71037103

71047104

71057105
results.push([
7106-
parseInt(( curlyOpen > 0 ) ? PHP.Constants.T_CONSTANT_ENCAPSED_STRING : PHP.Constants.T_ENCAPSED_AND_WHITESPACE, 10),
7106+
parseInt(( curlyOpen > 0 ) ? PHP.Constants.T_STRING : PHP.Constants.T_ENCAPSED_AND_WHITESPACE, 10),
71077107
match[ 0 ].replace(/\n/g,"\\n").replace(/\r/g,""),
71087108
line
71097109
]);
@@ -7114,6 +7114,15 @@ PHP.Lexer = function( src, ini ) {
71147114

71157115
}
71167116

7117+
if( curlyOpen > 0 && result.match(/^\->/) !== null ) {
7118+
results.push([
7119+
parseInt(PHP.Constants.T_OBJECT_OPERATOR, 10),
7120+
'->',
7121+
line
7122+
]);
7123+
result = result.substring( 2 );
7124+
}
7125+
71177126
if( result.match(/^{\$/) !== null ) {
71187127

71197128
results.push([

0 commit comments

Comments
 (0)