fix error in objectivec_highlight_rules when Array.prototype is modified

This commit is contained in:
nightwing 2012-12-25 19:39:33 +04:00
commit 8f6f6c6e3d

View file

@ -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") ]);