Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
eval: function (args, env) {
var frame = new(tree.Ruleset)(null, []), context;
for (var i = 0, val; i < this.params.length; i++) {
if (this.params[i].name) {
if (val = (args && args[i]) || this.params[i].value) {
frame.rules.unshift(new(tree.Rule)(this.params[i].name, val.eval(env)));
} else {
throw { message: "wrong number of arguments for " + this.name +
' (' + args.length + ' for ' + this.arity + ')' };
}
}
}
return new(tree.Ruleset)(null, this.rules).evalRules({
frames: [this, frame].concat(env.frames)
});
},
match: function (args, env) {
rule: function () {
var value;
var memo = i;
if (name = $(this.property) || $(this.variable)) {
if ((name.charAt(0) != '@') && (match = peek(/([^@+\/*(;{}-]*);/g))) {
i += match[0].length - 1;
value = new(tree.Anonymous)(match[1]);
} else if (name === "font") {
value = $(this.font);
} else {
value = $(this.value);
}
if ($(this.end)) {
return new(tree.Rule)(name, value, memo);
} else {
furthest = i;
i = memo;
}
}
},
rule: function () {
var value;
var memo = i;
if (name = $(this.property) || $(this.variable)) {
if ((name.charAt(0) != '@') && (match = peek(/([^@+\/*(;{}-]*);/g))) {
i += match[0].length - 1;
value = new(tree.Anonymous)(match[1]);
} else if (name === "font") {
value = $(this.font);
} else {
value = $(this.value);
}
if ($(this.end)) {
return new(tree.Rule)(name, value, memo);
} else {
furthest = i;
i = memo;
}
}
},
tree.Rule.prototype.eval = function (context) {
return new(tree.Rule)(this.name, this.value.eval(context));
};
eval: function (args, env) {
var frame = new(tree.Ruleset)(null, []), context;
for (var i = 0, val; i < this.params.length; i++) {
if (this.params[i].name) {
if (val = (args && args[i]) || this.params[i].value) {
frame.rules.unshift(new(tree.Rule)(this.params[i].name, val.eval(env)));
} else {
throw { message: "wrong number of arguments for " + this.name +
' (' + args.length + ' for ' + this.arity + ')' };
}
}
}
return new(tree.Ruleset)(null, this.rules).evalRules({
frames: [this, frame].concat(env.frames)
});
},
match: function (args, env) {
rule: function () {
var value;
var memo = i;
if (name = $(this.property) || $(this.variable)) {
if ((name.charAt(0) != '@') && (match = peek(/([^@+\/*(;{}-]*);/g))) {
i += match[0].length - 1;
value = new(tree.Anonymous)(match[1]);
} else if (name === "font") {
value = $(this.font);
} else {
value = $(this.value);
}
if ($(this.end)) {
return new(tree.Rule)(name, value, memo);
} else {
furthest = i;
i = memo;
}
}
},
tree.Rule.prototype.eval = function (context) {
return new(tree.Rule)(this.name, this.value.eval(context));
};
eval: function (args, env) {
var frame = new(tree.Ruleset)(null, []), context;
for (var i = 0, val; i < this.params.length; i++) {
if (this.params[i].name) {
if (val = (args && args[i]) || this.params[i].value) {
frame.rules.unshift(new(tree.Rule)(this.params[i].name, val.eval(env)));
} else {
throw { message: "wrong number of arguments for " + this.name +
' (' + args.length + ' for ' + this.arity + ')' };
}
}
}
return new(tree.Ruleset)(null, this.rules).evalRules({
frames: [this, frame].concat(env.frames)
});
},
match: function (args, env) {
tree.Rule.prototype.eval = function (context) {
return new(tree.Rule)(this.name, this.value.eval(context));
};