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");
// 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
}
]
};