From 0b4c56c5a75129ec59b99827e3a12354379c31b1 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 11 Aug 2013 14:53:01 +0400 Subject: [PATCH] fix string parsing in php worker --- lib/ace/mode/php/php.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/ace/mode/php/php.js b/lib/ace/mode/php/php.js index de5e5a99..67346058 100644 --- a/lib/ace/mode/php/php.js +++ b/lib/ace/mode/php/php.js @@ -689,7 +689,7 @@ PHP.Lexer = function( src, ini ) { result = result.substring( match[ 0 ].length ); - match = result.match(/^(\-\>)([a-zA-Z0-9_\x7f-\xff]*)/); + match = result.match(/^(\-\>)\s*([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*(\()/); if ( match !== null ) { @@ -703,6 +703,9 @@ PHP.Lexer = function( src, ini ) { match[ 2 ], line ]); + if (match[3]) { + results.push(match[3]); + } result = result.substring( match[ 0 ].length ); } @@ -714,9 +717,9 @@ PHP.Lexer = function( src, ini ) { var re; if ( curlyOpen > 0) { - re = /^([^\\\$"{}\]]|\\.)+/g; + re = /^([^\\\$"{}\]\)]|\\.)+/g; } else { - re = /^([^\\\$"{]|\\.|{[^\$])+/g; + re = /^([^\\\$"{]|\\.|{[^\$]|\$(?=[^a-zA-Z_\x7f-\xff]))+/g;; } while(( match = result.match( re )) !== null ) {