Refactored parsers.rule

This commit is contained in:
cloudhead 2010-03-13 20:15:44 -05:00
parent 61a7b2e9e7
commit 854f65f079

View File

@ -657,15 +657,19 @@ less.parser = {
}
},
rule: function () {
var name, value, match;
if (name = $(this.property) || $(this.variable)) {
if ((name[0] != '@') && (match = peek(/([^@+\/*(;{}-]*);[\s\n]*/g))) {
i += match[0].length;
return new(tree.Rule)(name, match[1]);
} else if ((name === "font") && (value = $(this.font)) && $(this.end)) {
return new(tree.Rule)(name, value);
} else if ((value = $(this.value)) && ($(';') || peek('}'))) {
value = (function () {
if ((name[0] != '@') && (match = peek(/([^@+\/*(;{}-]*);/g))) {
i += match[0].length - 1;
return match[1];
} else if (name === "font") {
return $(this.font);
} else {
return $(this.value);
}
})();
if ($(this.end)) {
return new(tree.Rule)(name, value);
}
}