Commit c165e7df by Aaron Leung

Updating the emitter to handle combinators. All tests pass again.

parent c800eab4
...@@ -80,7 +80,8 @@ namespace Sass { ...@@ -80,7 +80,8 @@ namespace Sass {
if (prefixes.empty()) { if (prefixes.empty()) {
new_prefixes.reserve(sel_group.children->size()); new_prefixes.reserve(sel_group.children->size());
for (int i = 0; i < sel_group.children->size(); ++i) { for (int i = 0; i < sel_group.children->size(); ++i) {
new_prefixes.push_back(string(sel_group.children->at(i).token)); // new_prefixes.push_back(string(sel_group.children->at(i).token));
new_prefixes.push_back(string(sel_group.children->at(i)));
} }
} }
else { else {
...@@ -89,7 +90,7 @@ namespace Sass { ...@@ -89,7 +90,7 @@ namespace Sass {
for (int j = 0; j < sel_group.children->size(); ++j) { for (int j = 0; j < sel_group.children->size(); ++j) {
new_prefixes.push_back(prefixes[i] + new_prefixes.push_back(prefixes[i] +
' ' + ' ' +
string(sel_group.children->at(j).token)); string(sel_group.children->at(j)));
} }
} }
} }
......
...@@ -119,6 +119,23 @@ namespace Sass { ...@@ -119,6 +119,23 @@ namespace Sass {
return *this; return *this;
} }
operator string() {
if (type == selector) {
string result(string(children->at(0)));
for (int i = 1; i < children->size(); ++i) {
result += string(children->at(i));
}
return result;
}
else if (type == selector_combinator) {
if (std::isspace(token.begin[0])) return string(" ");
else return string(" ") += string(token) += string(" ");
}
else {
return string(token);
}
}
void release() const { children = 0; } void release() const { children = 0; }
void echo(stringstream& buf, size_t depth = 0); void echo(stringstream& buf, size_t depth = 0);
......
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