Skip to content

Commit 4d1387f

Browse files
author
Tab Atkins
committed
Sync the parser with the spec.
1 parent bf808b4 commit 4d1387f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

parser.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function parse(tokens) {
8282
case ";": pop() && switchto(); break;
8383
case "{":
8484
if(rule.fillType !== '') switchto(rule.fillType);
85-
else parseerror("Attempt to open a curly-block in a statement-type at-rule.") && switchto('next-block') && reprocess();
85+
else parseerror("Attempt to open a curly-block in a statement-type at-rule.") && discard() && switchto('next-block') && reprocess();
8686
break;
8787
case "EOF": finish(); return stylesheet;
8888
default: rule.appendPrelude(consumeAPrimitive());
@@ -92,8 +92,6 @@ function parse(tokens) {
9292
case "rule":
9393
switch(token.tokenType) {
9494
case "WHITESPACE": break;
95-
case "BADSTRING":
96-
case "BADURL": parseerror("Use of BADSTRING or BADURL token in selector.") && switchto('next-block'); break;
9795
case "}": pop() && switchto(); break;
9896
case "AT-KEYWORD": push(new AtRule(token.value)) && switchto('at-rule'); break;
9997
case "EOF": finish(); return stylesheet;
@@ -117,7 +115,7 @@ function parse(tokens) {
117115
case "AT-RULE": push(new AtRule(token.value)) && switchto('at-rule'); break;
118116
case "IDENT": push(new Declaration(token.value)) && switchto('after-declaration-name'); break;
119117
case "EOF": finish(); return stylesheet;
120-
default: parseerror() && switchto('next-declaration');
118+
default: parseerror() && discard() && switchto('next-declaration');
121119
}
122120
break;
123121

@@ -143,7 +141,7 @@ function parse(tokens) {
143141
}
144142
break;
145143
case ";": pop() && switchto(); break;
146-
case "}": pop() && switchto() && reprocess(); break;
144+
case "}": pop() && pop() && switchto(); break;
147145
case "EOF": finish(); return stylesheet;
148146
default: rule.append(consumeAPrimitive());
149147
}
@@ -153,7 +151,7 @@ function parse(tokens) {
153151
switch(token.tokenType) {
154152
case "WHITESPACE": break;
155153
case ";": pop() && switchto(); break;
156-
case "}": pop() && switchto() && reprocess(); break;
154+
case "}": pop() && pop() && switchto(); break;
157155
case "EOF": finish(); return stylesheet;
158156
default: parseerror("Invalid declaration - additional token after !important.") && discard() && switchto('next-declaration');
159157
}

0 commit comments

Comments
 (0)