From e56b9284dae450c2c4831751414f05fbd675c6b3 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 8 Dec 2012 22:16:56 +0400 Subject: [PATCH] non greedy js strings --- lib/ace/mode/javascript_highlight_rules.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/ace/mode/javascript_highlight_rules.js b/lib/ace/mode/javascript_highlight_rules.js index 25216613..72edb1b8 100644 --- a/lib/ace/mode/javascript_highlight_rules.js +++ b/lib/ace/mode/javascript_highlight_rules.js @@ -65,7 +65,7 @@ var JavaScriptHighlightRules = function() { }, "identifier"); // keywords which can be followed by regular expressions - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield"; + var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; // TODO: Unicode escape sequences var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b"; @@ -186,7 +186,7 @@ var JavaScriptHighlightRules = function() { regex : identifierRe }, { token : "keyword.operator", - regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/, + regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/, next : "regex_allowed" }, { token : "punctuation.operator", @@ -341,10 +341,6 @@ var JavaScriptHighlightRules = function() { { token : "constant.language.escape", regex : escapedRe - }, { - token : "string", - regex : '[^"\\\\]+', - merge : true }, { token : "string", regex : "\\\\$", @@ -355,16 +351,16 @@ var JavaScriptHighlightRules = function() { regex : '"|$', next : "start", merge : true + }, { + token : "string", + regex : '.|\\w+|\\s+', + merge : true } ], "qstring" : [ { token : "constant.language.escape", regex : escapedRe - }, { - token : "string", - regex : "[^'\\\\]+", - merge : true }, { token : "string", regex : "\\\\$", @@ -375,6 +371,10 @@ var JavaScriptHighlightRules = function() { regex : "'|$", next : "start", merge : true + }, { + token : "string", + regex : '.|\\w+|\\s+', + merge : true } ] };