Merge pull request #1991 from adamjimenez/patch-28
fix "{$foo->bar}"."{$foo->bar($a)}"."{$foo->bar(&$a, $b)}";
This commit is contained in:
commit
ce3076b4e5
1 changed files with 29 additions and 11 deletions
|
|
@ -717,34 +717,52 @@ PHP.Lexer = function( src, ini ) {
|
||||||
|
|
||||||
var re;
|
var re;
|
||||||
if ( curlyOpen > 0) {
|
if ( curlyOpen > 0) {
|
||||||
re = /^([^\\\$"{}\]\)]|\\.)+/g;
|
re = /^([^\\\$"{}\]\(\)\->]|\\.)+/g;
|
||||||
} else {
|
} else {
|
||||||
re = /^([^\\\$"{]|\\.|{[^\$]|\$(?=[^a-zA-Z_\x7f-\uffff]))+/g;;
|
re = /^([^\\\$"{]|\\.|{[^\$]|\$(?=[^a-zA-Z_\x7f-\uffff]))+/g;;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var type, match2;
|
||||||
while(( match = result.match( re )) !== null ) {
|
while(( match = result.match( re )) !== null ) {
|
||||||
|
|
||||||
|
|
||||||
if (result.length === 1) {
|
if (result.length === 1) {
|
||||||
throw new Error(match);
|
throw new Error(match);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type = 0;
|
||||||
|
|
||||||
|
if( curlyOpen > 0 ){
|
||||||
|
if( match2 = match[0].match(/^[\[\]\;\:\?\(\)\!\.\,\>\<\=\+\-\/\*\|\&\{\}\@\^\%\$\~]/) ){
|
||||||
results.push([
|
results.push(match2[0]);
|
||||||
parseInt(( curlyOpen > 0 ) ? PHP.Constants.T_CONSTANT_ENCAPSED_STRING : PHP.Constants.T_ENCAPSED_AND_WHITESPACE, 10),
|
}else{
|
||||||
match[ 0 ].replace(/\n/g,"\\n").replace(/\r/g,""),
|
type = PHP.Constants.T_STRING;
|
||||||
line
|
}
|
||||||
]);
|
}else{
|
||||||
|
type = PHP.Constants.T_ENCAPSED_AND_WHITESPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( type ){
|
||||||
|
results.push([
|
||||||
|
parseInt(type, 10),
|
||||||
|
match[ 0 ].replace(/\n/g,"\\n").replace(/\r/g,""),
|
||||||
|
line
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
line += match[ 0 ].split('\n').length - 1;
|
line += match[ 0 ].split('\n').length - 1;
|
||||||
|
|
||||||
result = result.substring( match[ 0 ].length );
|
result = result.substring( match[ 0 ].length );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( curlyOpen > 0 && result.match(/^\->/) !== null ) {
|
||||||
|
results.push([
|
||||||
|
parseInt(PHP.Constants.T_OBJECT_OPERATOR, 10),
|
||||||
|
'->',
|
||||||
|
line
|
||||||
|
]);
|
||||||
|
result = result.substring( 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( result.match(/^{\$/) !== null ) {
|
if( result.match(/^{\$/) !== null ) {
|
||||||
|
|
||||||
results.push([
|
results.push([
|
||||||
parseInt(PHP.Constants.T_CURLY_OPEN, 10),
|
parseInt(PHP.Constants.T_CURLY_OPEN, 10),
|
||||||
"{",
|
"{",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue