carto/lib/mess/tree/expression.js
2011-01-05 14:23:28 -05:00

22 lines
538 B
JavaScript

(function (tree) {
tree.Expression = function (value) { this.value = value };
tree.Expression.prototype = {
eval: function (env) {
if (this.value.length > 1) {
return new(tree.Expression)(this.value.map(function (e) {
return e.eval(env);
}));
} else {
return this.value[0].eval(env);
}
},
toCSS: function (env) {
return this.value.map(function (e) {
return e.toCSS(env);
}).join(' ');
}
};
})(require('mess/tree'));