handle toplevel closing curly brace

This commit is contained in:
ConnorSkees 2020-05-23 11:59:04 -04:00
parent a3548b0044
commit eca952b201
2 changed files with 5 additions and 3 deletions

View File

@ -332,14 +332,15 @@ impl<'a> StyleSheetParser<'a> {
.into()) .into())
} }
c if c.is_control() => { c if c.is_control() => {
return Err(("expected selector.", self.lexer.next().unwrap().pos()).into()); 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()); return Err(("expected selector.", self.lexer.next().unwrap().pos).into());
} }
'}' => return Err(("unmatched \"}\".", self.lexer.next().unwrap().pos).into()),
_ => todo!("unexpected toplevel token: {:?}", kind), _ => todo!("unexpected toplevel token: {:?}", kind),
}; };
} }

View File

@ -123,6 +123,7 @@ error!(
"#{", "Error: expected \"}\"." "#{", "Error: expected \"}\"."
); );
error!(toplevel_hash, "#", "Error: expected \"{\"."); error!(toplevel_hash, "#", "Error: expected \"{\".");
error!(toplevel_closing_brace, "}", "Error: unmatched \"}\".");
error!(toplevel_at, "@", "Error: Expected identifier."); error!(toplevel_at, "@", "Error: Expected identifier.");
error!( error!(
toplevel_ampersand, toplevel_ampersand,