From 34d80e81cafe90ea78bdb5fcc05fad8a0076bbba Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Tue, 24 Feb 2015 13:21:22 -0500 Subject: [PATCH] clean up string rule for lean-mode --- lib/ace/mode/lean_highlight_rules.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/ace/mode/lean_highlight_rules.js b/lib/ace/mode/lean_highlight_rules.js index 91440169..4ba9d484 100644 --- a/lib/ace/mode/lean_highlight_rules.js +++ b/lib/ace/mode/lean_highlight_rules.js @@ -100,12 +100,15 @@ var leanHighlightRules = function() { regex : "\\/-", next : "comment" }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + stateName: "qqstring", + token : "string.start", regex : '"', next : [ + {token : "string.end", regex : '"', next : "start"}, + {token : "string", regex : "\\\\$", next : "qqstring"}, + {token : "string", regex : "\\n$", next : "qqstring"}, + {token : "constant.language.escape", regex : /\\./}, + {defaultToken: "string"} + ] }, { - token : "string", // multi line string start - regex : '["].*\\\\$', - next : "qqstring" }, { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" @@ -141,6 +144,7 @@ var leanHighlightRules = function() { this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); + this.normalizeRules(); }; oop.inherits(leanHighlightRules, TextHighlightRules);