carto/lib/mess/tree/expression.js

22 lines
532 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'));