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