@@ -562,34 +562,52 @@ PHP.Lexer = function( src, ini ) {
562
562
563
563
var re ;
564
564
if ( curlyOpen > 0 ) {
565
- re = / ^ ( [ ^ \\ \$ " { } \] ) ] | \\ .) + / g;
565
+ re = / ^ ( [ ^ \\ \$ " { } \] \) \- > ] | \\ .) + / g;
566
566
} else {
567
- re = / ^ ( [ ^ \\ \$ " { ] | \\ .| { [ ^ \$ ] | \$ (? = [ ^ a - z A - Z _ \x7f - \xff ] ) ) + / g; ;
567
+ re = / ^ ( [ ^ \\ \$ " { ] | \\ .| { [ ^ \$ ] | \$ (? = [ ^ a - z A - Z _ \x7f - \uffff ] ) ) + / g;
568
568
}
569
569
570
+ var type , match2 ;
570
571
while ( ( match = result . match ( re ) ) !== null ) {
571
-
572
-
573
572
if ( result . length === 1 ) {
574
573
throw new Error ( match ) ;
575
574
}
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
+ }
584
595
585
596
line += match [ 0 ] . split ( '\n' ) . length - 1 ;
586
597
587
598
result = result . substring ( match [ 0 ] . length ) ;
599
+ }
588
600
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 ) ;
589
608
}
590
609
591
610
if ( result . match ( / ^ { \$ / ) !== null ) {
592
-
593
611
results . push ( [
594
612
parseInt ( PHP . Constants . T_CURLY_OPEN , 10 ) ,
595
613
"{" ,
0 commit comments