highlight escapes in sh mode

This commit is contained in:
nightwing 2013-06-22 22:38:54 +04:00
commit 4b398798c0

View file

@ -77,12 +77,28 @@ var ShHighlightRules = function() {
var func = "(?:" + variableName + "\\s*\\(\\))"; var func = "(?:" + variableName + "\\s*\\(\\))";
this.$rules = { this.$rules = {
"start" : [ { "start" : [{
token : "constant",
regex : /\\./
}, {
token : ["text", "comment"], token : ["text", "comment"],
regex : /(^|\s)(#.*)$/ regex : /(^|\s)(#.*)$/
}, { }, {
token : "string", // " string token : "string",
regex : '"(?:[^\\\\]|\\\\.)*?"' regex : '"',
push : [{
token : "constant.language.escape",
regex : /\\(?:[$abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
}, {
token : "constant",
regex : /\$\w+/
}, {
token : "string",
regex : '"',
next: "pop"
}, {
defaultToken: "string"
}]
}, { }, {
token : "variable.language", token : "variable.language",
regex : builtinVariable regex : builtinVariable
@ -97,7 +113,7 @@ var ShHighlightRules = function() {
regex : fileDescriptor regex : fileDescriptor
}, { }, {
token : "string", // ' string token : "string", // ' string
regex : "'(?:[^\\\\]|\\\\.)*?'" start : "'", end : "'"
}, { }, {
token : "constant.numeric", // float token : "constant.numeric", // float
regex : floatNumber regex : floatNumber
@ -118,6 +134,8 @@ var ShHighlightRules = function() {
regex : "[\\]\\)\\}]" regex : "[\\]\\)\\}]"
} ] } ]
}; };
this.normalizeRules();
}; };
oop.inherits(ShHighlightRules, TextHighlightRules); oop.inherits(ShHighlightRules, TextHighlightRules);