handle ( and ) at toplevel

This commit is contained in:
ConnorSkees 2020-05-23 16:36:11 -04:00
parent 5137353cb4
commit 90f7023896
2 changed files with 13 additions and 2 deletions

View File

@ -334,9 +334,12 @@ impl<'a> StyleSheetParser<'a> {
c if c.is_control() => {
return Err(("expected selector.", self.lexer.next().unwrap().pos).into());
}
',' | '!' | '{' => {
',' | '!' | '(' | ')' => {
return Err(("expected \"{\".", self.lexer.next().unwrap().pos).into());
}
'{' => {
return Err(("expected \"}\".", self.lexer.next().unwrap().pos).into());
}
'`' | '\'' | '"' => {
return Err(("expected selector.", self.lexer.next().unwrap().pos).into());
}

View File

@ -87,7 +87,15 @@ error!(toplevel_exclamation, "! {}", "Error: expected \"{\".");
error!(toplevel_backtick, "` {}", "Error: expected selector.");
error!(
toplevel_open_curly_brace,
"{ {color: red;}", "Error: expected \"{\"."
"{ {color: red;}", "Error: expected \"}\"."
);
error!(
toplevel_open_paren,
"(", "Error: expected \"{\"."
);
error!(
toplevel_close_paren,
"(", "Error: expected \"{\"."
);
error!(
backtick_in_value,