lib/csscss/parser/css.rb in csscss-0.1.0 vs lib/csscss/parser/css.rb in csscss-0.2.0
- old
+ new
@@ -18,10 +18,12 @@
rule(:css_space?) {
comment.repeat(1) | space?
}
+ rule(:blank_attribute) { str(";") >> space? }
+
rule(:attribute) {
match["^:{}"].repeat(1).as(:property) >>
str(":") >>
match["^;}"].repeat(1).as(:value) >>
str(";").maybe >>
@@ -31,11 +33,11 @@
rule(:ruleset) {
(
match["^{}"].repeat(1).as(:selector) >>
str("{") >>
space? >>
- (comment | attribute).repeat(0).as(:properties) >>
+ (comment | attribute | blank_attribute).repeat(0).as(:properties) >>
str("}") >>
space?
).as(:ruleset)
}
@@ -48,10 +50,9 @@
str("}") >>
space?
).as(:nested_ruleset)
}
- #rule(:blocks) { (nested_ruleset.as(:nested) | ruleset).repeat(0).as(:blocks) }
rule(:blocks) {
space? >> (comment | nested_ruleset | ruleset).repeat(1).as(:blocks) >> space?
}
root(:blocks)