Commit 748532bb by Aaron Leung

Handling empty rules (i.e., extra semicolons, but it's subtle).

parent a6ae423a
...@@ -73,7 +73,7 @@ namespace Sass { ...@@ -73,7 +73,7 @@ namespace Sass {
lex< exactly<'{'> >(); lex< exactly<'{'> >();
bool semicolon = false; bool semicolon = false;
Node block(line_number, Node::block); Node block(line_number, Node::block);
while (!lex < exactly<'}'> >()) { while (!lex< exactly<'}'> >()) {
if (semicolon) { if (semicolon) {
lex< exactly<';'> >(); // enforce terminal ';' here lex< exactly<';'> >(); // enforce terminal ';' here
semicolon = false; semicolon = false;
...@@ -84,23 +84,20 @@ namespace Sass { ...@@ -84,23 +84,20 @@ namespace Sass {
block << Node(line_number, Node::comment, lexed); block << Node(line_number, Node::comment, lexed);
block.has_rules_or_comments = true; block.has_rules_or_comments = true;
semicolon = true; semicolon = true;
continue;
} }
else if (lex< variable >()) { else if (lex< variable >()) {
parse_var_def(); parse_var_def();
continue;
} }
else if (look_for_rule(position)) { else if (look_for_rule(position)) {
block << parse_rule(); block << parse_rule();
block.has_rules_or_comments = true; block.has_rules_or_comments = true;
semicolon = true; semicolon = true;
continue;
} }
else { else if (!peek< exactly<';'> >()) {
block << parse_ruleset(); block << parse_ruleset();
block.has_rulesets = true; block.has_rulesets = true;
continue;
} }
else lex< exactly<';'> >();
} }
return block; return block;
// lex< identifier >(); // lex< identifier >();
......
...@@ -13,7 +13,7 @@ div { ...@@ -13,7 +13,7 @@ div {
text-decoration: none; /* where will this comment go? */ text-decoration: none; /* where will this comment go? */
color: green; color: green;
/* what about this comment? */ border: 1px $blah red; /* what about this comment? */ border: 1px $blah red;
} };;
/* yet another comment that should be preserved */ /* yet another comment that should be preserved */
display: inline-block; display: inline-block;
} // gone! } // gone!
...@@ -26,7 +26,8 @@ div { ...@@ -26,7 +26,8 @@ div {
} }
p { p {
padding: 10px 8%; padding: 10px 8%;
-webkit-box-sizing: $blux; -webkit-box-sizing: $blux; ; ;
; ; ;;;
} }
margin: 10px 5px; margin: 10px 5px;
h1 { h1 {
......
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