mirror of
https://github.com/less/less.js.git
synced 2026-02-08 22:15:04 -05:00
28 lines
664 B
JavaScript
28 lines
664 B
JavaScript
module.exports = function (tree) {
|
|
|
|
var Keyword = function (value) { this.value = value; };
|
|
Keyword.prototype = {
|
|
type: "Keyword",
|
|
eval: function () { return this; },
|
|
genCSS: function (env, output) {
|
|
if (this.value === '%') { throw { type: "Syntax", message: "Invalid % without number" }; }
|
|
output.add(this.value);
|
|
},
|
|
toCSS: tree.toCSS,
|
|
compare: function (other) {
|
|
if (other instanceof Keyword) {
|
|
return other.value === this.value ? 0 : 1;
|
|
} else {
|
|
return -1;
|
|
}
|
|
}
|
|
};
|
|
|
|
//TODO move?
|
|
tree.True = new(Keyword)('true');
|
|
tree.False = new(Keyword)('false');
|
|
|
|
return Keyword;
|
|
|
|
};
|