diff --git a/lib/ace/mode/objectivec_highlight_rules.js b/lib/ace/mode/objectivec_highlight_rules.js index e703c8ad..adc95e39 100644 --- a/lib/ace/mode/objectivec_highlight_rules.js +++ b/lib/ace/mode/objectivec_highlight_rules.js @@ -17,12 +17,10 @@ var ObjectiveCHighlightRules = function() { "222|" + "x[a-zA-Z0-9]+)"; - var specialVariables = [ - { + var specialVariables = [{ "regex": "\\b_cmd\\b", "token": "variable.other.selector.objc" - }, - { + }, { "regex": "\\b(?:self|super)\\b", "token": "variable.language.objc" } @@ -31,8 +29,7 @@ var ObjectiveCHighlightRules = function() { var cObj = new CHighlightRules(); var cRules = cObj.getRules(); - this.$rules = - { + this.$rules = { "start": [ { token : "comment", @@ -312,24 +309,17 @@ var ObjectiveCHighlightRules = function() { // copy in C-Rules directly for (var r in cRules) { - if (r == "start") { - for (var key in cRules[r]) { - this.$rules.start.push(cRules[r][key]) - } - } - else { + if (this.$rules[r]) { + if (this.$rules[r].push) + this.$rules[r].push.apply(this.$rules[r], cRules[r]); + } else { this.$rules[r] = cRules[r]; } } - - var startRules = this.$rules.start; - for (var s in startRules) { - this.$rules.bracketed_content.push(startRules[s]); - } - for (var s in specialVariables) { - this.$rules.bracketed_content.push(specialVariables[s]); - } - + + this.$rules.bracketed_content = this.$rules.bracketed_content.concat( + this.$rules.start, specialVariables + ); this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);