Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b450ffe

Browse files
fix "{$foo->bar}"."{$foo->bar($a)}"."{$foo->bar(&$a, $b)}";
1 parent 0e6a130 commit b450ffe

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

‎src/parser/lexer.js

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -562,34 +562,52 @@ PHP.Lexer = function( src, ini ) {
562562

563563
var re;
564564
if ( curlyOpen > 0) {
565-
re = /^([^\\\$"{}\])]|\\.)+/g;
565+
re = /^([^\\\$"{}\]\)\->]|\\.)+/g;
566566
} else {
567-
re = /^([^\\\$"{]|\\.|{[^\$]|\$(?=[^a-zA-Z_\x7f-\xff]))+/g;;
567+
re = /^([^\\\$"{]|\\.|{[^\$]|\$(?=[^a-zA-Z_\x7f-\uffff]))+/g;
568568
}
569569

570+
var type, match2;
570571
while(( match = result.match( re )) !== null ) {
571-
572-
573572
if (result.length === 1) {
574573
throw new Error(match);
575574
}
576-
577-
578-
579-
results.push([
580-
parseInt(( curlyOpen > 0 ) ? PHP.Constants.T_CONSTANT_ENCAPSED_STRING : PHP.Constants.T_ENCAPSED_AND_WHITESPACE, 10),
581-
match[ 0 ].replace(/\n/g,"\\n").replace(/\r/g,""),
582-
line
583-
]);
575+
576+
type = 0;
577+
578+
if( curlyOpen > 0 ){
579+
if( match2 = match[0].match(/^[\[\]\;\:\?\(\)\!\.,円\>\<\=\+\-\/\*\|\&\{\}\@\^\%\"\'\$\~]/) ){
580+
results.push(match2[0]);
581+
}else{
582+
type = PHP.Constants.T_STRING;
583+
}
584+
}else{
585+
type = PHP.Constants.T_ENCAPSED_AND_WHITESPACE;
586+
}
587+
588+
if( type ){
589+
results.push([
590+
parseInt(type, 10),
591+
match[ 0 ].replace(/\n/g,"\\n").replace(/\r/g,""),
592+
line
593+
]);
594+
}
584595

585596
line += match[ 0 ].split('\n').length - 1;
586597

587598
result = result.substring( match[ 0 ].length );
599+
}
588600

601+
if( curlyOpen > 0 && result.match(/^\->/) !== null ) {
602+
results.push([
603+
parseInt(PHP.Constants.T_OBJECT_OPERATOR, 10),
604+
'->',
605+
line
606+
]);
607+
result = result.substring( 2 );
589608
}
590609

591610
if( result.match(/^{\$/) !== null ) {
592-
593611
results.push([
594612
parseInt(PHP.Constants.T_CURLY_OPEN, 10),
595613
"{",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /