Remove directives. Fixes #157

This commit is contained in:
Tom MacWright 2012-09-21 15:12:39 -04:00
parent 101026fe3c
commit 4a9b5b5939
2 changed files with 2 additions and 41 deletions

View File

@ -38,7 +38,7 @@ var carto = {
error = options.indent + error.join('\n' + options.indent) + '\033[0m\n';
message = options.indent + message + stylize(ctx.message, 'red');
ctx.filename && (message += stylize(' in ', 'red') + ctx.filename);
if (ctx.filename) (message += stylize(' in ', 'red') + ctx.filename);
util.error(message, error);
@ -51,7 +51,7 @@ var carto = {
};
[ 'call', 'color', 'comment', 'definition', 'dimension',
'directive', 'element', 'expression', 'filterset', 'filter', 'field',
'element', 'expression', 'filterset', 'filter', 'field',
'keyword', 'layer', 'literal', 'operation', 'quoted', 'imagefilter',
'reference', 'rule', 'ruleset', 'selector', 'style', 'url', 'value',
'variable', 'zoom', 'invalid', 'fontset'

View File

@ -1,39 +0,0 @@
(function(tree) {
tree.Directive = function Directive(name, value) {
this.name = name;
if (Array.isArray(value)) {
this.ruleset = new tree.Ruleset([], value);
} else {
this.value = value;
}
};
tree.Directive.prototype = {
toString: function(ctx, env) {
if (this.ruleset) {
this.ruleset.root = true;
return this.name + ' {\n ' +
this.ruleset.toString(ctx, env).trim().replace(/\n/g, '\n ') +
'\n}\n';
} else {
return this.name + ' ' + this.value.toString() + ';\n';
}
},
eval: function(env) {
env.frames.unshift(this);
this.ruleset = this.ruleset && this.ruleset.eval(env);
env.frames.shift();
return this;
},
variable: function(name) {
return tree.Ruleset.prototype.variable.call(this.ruleset, name);
},
find: function() {
return tree.Ruleset.prototype.find.apply(this.ruleset, arguments);
},
rulesets: function() {
return tree.Ruleset.prototype.rulesets.apply(this.ruleset);
}
};
})(require('../tree'));