fix herestring highlighting in sh mode

This commit is contained in:
nightwing 2014-09-02 13:04:33 +04:00
commit 9f2fba320d

View file

@ -99,8 +99,12 @@ var ShHighlightRules = function() {
}, {
defaultToken: "string"
}]
}, {
}, {
regex : "<<<",
token : "keyword.operator"
}, {
stateName: "heredoc",
regex : "(<<)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
onMatch : function(value, currentState, stack) {
var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
var tokens = value.split(this.splitRegex);
@ -113,7 +117,6 @@ var ShHighlightRules = function() {
{type:"string", value: tokens[5]}
];
},
regex : "(<<-?)(\\s*)(['\"`]?)([\\w\-]+)(['\"`]?)",
rules: {
heredoc: [{
onMatch: function(value, currentState, stack) {
@ -131,7 +134,7 @@ var ShHighlightRules = function() {
}],
indentedHeredoc: [{
token: "string",
regex: "^ +"
regex: "^\t+"
}, {
onMatch: function(value, currentState, stack) {
if (value === stack[1]) {
@ -178,7 +181,7 @@ var ShHighlightRules = function() {
regex : integer + "\\b"
}, {
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b"
}, {
token : "keyword.operator",
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="