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*\\(\\))";
this.$rules = {
"start" : [ {
"start" : [{
token : "constant",
regex : /\\./
}, {
token : ["text", "comment"],
regex : /(^|\s)(#.*)$/
}, {
token : "string", // " string
regex : '"(?:[^\\\\]|\\\\.)*?"'
token : "string",
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",
regex : builtinVariable
@ -97,7 +113,7 @@ var ShHighlightRules = function() {
regex : fileDescriptor
}, {
token : "string", // ' string
regex : "'(?:[^\\\\]|\\\\.)*?'"
start : "'", end : "'"
}, {
token : "constant.numeric", // float
regex : floatNumber
@ -118,6 +134,8 @@ var ShHighlightRules = function() {
regex : "[\\]\\)\\}]"
} ]
};
this.normalizeRules();
};
oop.inherits(ShHighlightRules, TextHighlightRules);