Commit 34cb35fd by Aaron Leung

Handling selectors that begin with a combinator, since nesting makes them valid and meaningful.

parent 42ee27a6
......@@ -48,6 +48,11 @@ namespace Sass {
Node Document::parse_selector()
{
Node selector(line_number, Node::selector, 1);
if (lex< exactly<'+'> >() ||
lex< exactly<'~'> >() ||
lex< exactly<'>'> >()) {
selector << Node(line_number, Node::selector_combinator, lexed);
}
selector << parse_simple_selector_sequence();
while (lex< exactly<'+'> >() ||
lex< exactly<'~'> >() ||
......
......@@ -121,7 +121,13 @@ namespace Sass {
operator string() {
if (type == selector) {
string result(string(children->at(0)));
string result;
if (children->at(0).type == selector_combinator) {
result += string(children->at(0).token) + ' ';
}
else {
result += string(children->at(0));
}
for (int i = 1; i < children->size(); ++i) {
result += string(children->at(i));
}
......@@ -131,6 +137,9 @@ namespace Sass {
if (std::isspace(token.begin[0])) return string(" ");
else return string(" ") += string(token) += string(" ");
}
// else if (type == simple_selector_sequence) {
// return string(" ") += string(token);
// }
else {
return string(token);
}
......
a + b, c {
blah: blah;
bleh: bleh;
d e, f ~ g + h, > i {
bloo: bloo;
blee: blee;
}
}
\ No newline at end of file
a + b, c {
blah: blah;
bleh: bleh;
d e, f ~ g + h {
d e, f ~ g + h, > i {
bloo: bloo;
blee: blee;
}
......
a + b, c {
blah: blah;
bleh: bleh; }
a + b d e, a + b f ~ g + h, c d e, c f ~ g + h {
a + b d e, a + b f ~ g + h, a + b > i, c d e, c f ~ g + h, c > i {
bloo: bloo;
blee: blee; }
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