From d2dfec41eea853baf3ce6909e15135d756ca3981 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 26 May 2012 22:03:41 +0400 Subject: [PATCH] fix highlighting of multiline php strings --- lib/ace/mode/php_highlight_rules.js | 46 ++++++++++++++++------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/ace/mode/php_highlight_rules.js b/lib/ace/mode/php_highlight_rules.js index e25dddc8..424dbfe3 100644 --- a/lib/ace/mode/php_highlight_rules.js +++ b/lib/ace/mode/php_highlight_rules.js @@ -948,18 +948,12 @@ var PhpHighlightRules = function() { token : "string.regexp", regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)" }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // multi line string start - regex : '["][\\s\\S]*', + token : "string", // " string start + regex : '"', next : "qqstring" }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "string", // multi line string start - regex : "['][\\s\\S]+", + token : "string", // ' string start + regex : "'", next : "qstring" }, { token : "constant.numeric", // hex @@ -1040,33 +1034,45 @@ var PhpHighlightRules = function() { ], "qqstring" : [ { + token : "constant.language.escape", + regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})' + }, { + token : "constant.language.escape", + regex : /\$[\w\d]+(?:\[[\w\d]+\])?/ + }, { + token : "constant.language.escape", + regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now + }, { token : "string", regex : '"', next : "start" }, { token : "string", - regex : '[^"]+' + regex : '.+?' } ], "qstring" : [ { + token : "constant.language.escape", + regex : "\\\\['\\\\]" + }, { token : "string", regex : "'", next : "start" }, { token : "string", - regex : "[^']+" + regex : ".+?" } ], "htmlcomment" : [ - { - token : "comment", - regex : ".*?-->", - next : "start" - }, { - token : "comment", - regex : ".+" - } + { + token : "comment", + regex : ".*?-->", + next : "start" + }, { + token : "comment", + regex : ".+" + } ], "htmltag" : [ {