Commit 2ff087f3 by Dean Mao

Merge branch 'master' of git://github.com/hcatlin/libsass

parents 90a28428 5107d2b7
......@@ -60,7 +60,7 @@ namespace Sass {
collect_include_paths(paths_str);
setup_color_map();
string path_string(img_path_str);
string path_string(img_path_str ? img_path_str : "");
path_string = "'" + path_string + "/'";
image_path = new char[path_string.length() + 1];
std::strcpy(image_path, path_string.c_str());
......@@ -158,6 +158,7 @@ namespace Sass {
register_function(comparable_descriptor, comparable);
// Boolean Functions
register_function(not_descriptor, not_impl);
register_function(if_descriptor, if_impl);
}
void Context::setup_color_map()
......
......@@ -67,7 +67,7 @@ namespace Sass {
Document doc(ctx);
doc.path = path;
doc.line = 1;
doc.line = 1;
doc.root = ctx.new_Node(Node::root, path, 1, 0);
doc.lexed = Token::make();
doc.own_source = true;
......
......@@ -748,7 +748,7 @@ namespace Sass {
// Boolean Functions ///////////////////////////////////////////////////
Function_Descriptor not_descriptor =
{ "not", "value", 0 };
{ "not", "$value", 0 };
Node not_impl(const Node parameters, map<Token, Node>& bindings, Node_Factory& new_Node) {
Node val(bindings[parameters[0].token()]);
if (val.type() == Node::boolean && val.boolean_value() == false) {
......@@ -759,5 +759,16 @@ namespace Sass {
}
}
Function_Descriptor if_descriptor =
{ "if", "$predicate", "$consequent", "$alternative", 0 };
Node if_impl(const Node parameters, map<Token, Node>& bindings, Node_Factory& new_Node) {
Node predicate(bindings[parameters[0].token()]);
Node consequent(bindings[parameters[1].token()]);
Node alternative(bindings[parameters[2].token()]);
if (predicate.type() == Node::boolean && predicate.boolean_value() == false) return alternative;
return consequent;
}
}
}
......@@ -196,6 +196,9 @@ namespace Sass {
extern Function_Descriptor not_descriptor;
Node not_impl(const Node parameters, map<Token, Node>& bindings, Node_Factory& new_Node);
extern Function_Descriptor if_descriptor;
Node if_impl(const Node parameters, map<Token, Node>& bindings, Node_Factory& new_Node);
}
}
......@@ -183,8 +183,8 @@ namespace Sass {
bool has_backref() const;
bool from_variable() const;
bool& should_eval() const;
bool& is_unquoted() const;
bool& is_quoted() const;
bool& is_unquoted() const; // for strings
bool& is_quoted() const; // for identifiers
bool is_numeric() const;
bool is_guarded() const;
bool& has_been_extended() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment