Skip to content

Commit af000a8

Browse files
committed
raise error if selectors is present but no rules defined (different than unterminated rule set)
1 parent 8484bfc commit af000a8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

org/w3c/css/parser/analyzer/CssParser.jj

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,16 +2030,20 @@ void ruleSet() :
20302030
if ((ac.getCssProfile() != CssProfile.MOBILE) && !context_set.isEmpty()) {
20312031
String ret = skipStatement();
20322032
CssVersion version = ac.getCssVersion();
2033-
Token t1 = getToken(1);
2033+
Token t1 = getToken(0);
20342034
if (version.compareTo(CssVersion.CSS3) < 0) {
20352035
addError(e, ret);
20362036
} else if ((ret != null) && !ret.startsWith("/*") && (t1 != null && t1.kind != EOF)) {
20372037
addError(e, ret);
2038+
} else if (!context_set.isEmpty() && value_set == null) {
2039+
addError(e, ret);
20382040
} else {
2039-
// unterminated comment, skip until EOF
2040-
Token t = getToken(0);
2041-
while(t.kind != EOF) {
2042-
t = getNextToken();
2041+
if ((ret != null) && ret.startsWith("/*")) {
2042+
// unterminated comment, skip until EOF
2043+
Token t = getToken(0);
2044+
while(t.kind != EOF) {
2045+
t = getNextToken();
2046+
}
20432047
}
20442048
// then process
20452049
if (version.compareTo(CssVersion.CSS3) >= 0) {
@@ -3571,12 +3575,12 @@ String skipStatement() {
35713575
}
35723576
first = false;
35733577
}
3574-
3578+
getNextToken();
35753579
// skip white space
3576-
while (tok.kind == S) {
3580+
/* while (tok.kind == S) {
35773581
getNextToken();
35783582
tok = getToken(1);
3579-
}
3583+
} */
35803584
String statement = s.toString().trim();
35813585
return statement;
35823586
}
@@ -3598,6 +3602,7 @@ String skip_to_matching_brace() {
35983602
} else if (tok.kind == RBRACE) {
35993603
nesting--;
36003604
if (nesting == 0) {
3605+
s.append(tok.image);
36013606
break;
36023607
}
36033608
}

0 commit comments

Comments
 (0)