From c1ed4b312197b2981d5136790e0f4c45c5584dbc Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Thu, 21 May 2020 00:46:06 -0400 Subject: [PATCH] handle , at toplevel --- src/stylesheet.rs | 3 +++ tests/error.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/stylesheet.rs b/src/stylesheet.rs index 8d204dc..fa1d120 100644 --- a/src/stylesheet.rs +++ b/src/stylesheet.rs @@ -295,6 +295,9 @@ 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()); + } _ => todo!("unexpected toplevel token: {:?}", kind), }; } diff --git a/tests/error.rs b/tests/error.rs index b758360..37bb62f 100644 --- a/tests/error.rs +++ b/tests/error.rs @@ -82,3 +82,7 @@ error!( nothing_after_variable_in_style, "a {$a", "Error: expected \":\"." ); +error!( + toplevel_comma, + "a {},", "Error: expected \"{\"." +);