From a6d85a634264fad0d8514877d4c62e074d73b68a Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 6 Feb 2013 22:28:14 +0400 Subject: [PATCH] hotfix ruby heredoc highlighting --- lib/ace/mode/ruby_highlight_rules.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ace/mode/ruby_highlight_rules.js b/lib/ace/mode/ruby_highlight_rules.js index 27053507..373f1636 100644 --- a/lib/ace/mode/ruby_highlight_rules.js +++ b/lib/ace/mode/ruby_highlight_rules.js @@ -174,9 +174,15 @@ var RubyHighlightRules = function() { }, { stateName: "heredoc", token : function(value, currentState, stack) { - var next = value[0].length == 2 ? "heredoc" : "indentedHeredoc" - stack.push(next, value[2]) - return ["constant", "string", "support.class", "string"] + var next = value[3] == '-' ? "heredoc" : "indentedHeredoc"; + var tokens = value.split(this.splitRegex); + stack.push(next, tokens[3]); + return [ + {type:"constant", value: "<<"}, + {type:"string", value: tokens[2]}, + {type:"support.class", value: tokens[3]}, + {type:"string", value: tokens[4]} + ]; }, regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", rules: {