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