non greedy js strings

This commit is contained in:
nightwing 2012-12-08 22:16:56 +04:00
commit e56b9284da

View file

@ -65,7 +65,7 @@ var JavaScriptHighlightRules = function() {
}, "identifier"); }, "identifier");
// keywords which can be followed by regular expressions // 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 // TODO: Unicode escape sequences
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b"; var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
@ -186,7 +186,7 @@ var JavaScriptHighlightRules = function() {
regex : identifierRe regex : identifierRe
}, { }, {
token : "keyword.operator", token : "keyword.operator",
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/, regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
next : "regex_allowed" next : "regex_allowed"
}, { }, {
token : "punctuation.operator", token : "punctuation.operator",
@ -341,10 +341,6 @@ var JavaScriptHighlightRules = function() {
{ {
token : "constant.language.escape", token : "constant.language.escape",
regex : escapedRe regex : escapedRe
}, {
token : "string",
regex : '[^"\\\\]+',
merge : true
}, { }, {
token : "string", token : "string",
regex : "\\\\$", regex : "\\\\$",
@ -355,16 +351,16 @@ var JavaScriptHighlightRules = function() {
regex : '"|$', regex : '"|$',
next : "start", next : "start",
merge : true merge : true
}, {
token : "string",
regex : '.|\\w+|\\s+',
merge : true
} }
], ],
"qstring" : [ "qstring" : [
{ {
token : "constant.language.escape", token : "constant.language.escape",
regex : escapedRe regex : escapedRe
}, {
token : "string",
regex : "[^'\\\\]+",
merge : true
}, { }, {
token : "string", token : "string",
regex : "\\\\$", regex : "\\\\$",
@ -375,6 +371,10 @@ var JavaScriptHighlightRules = function() {
regex : "'|$", regex : "'|$",
next : "start", next : "start",
merge : true merge : true
}, {
token : "string",
regex : '.|\\w+|\\s+',
merge : true
} }
] ]
}; };