diff --git a/src/utils/read_until.rs b/src/utils/read_until.rs index e1dac0f..5eb4505 100644 --- a/src/utils/read_until.rs +++ b/src/utils/read_until.rs @@ -259,7 +259,7 @@ pub(crate) fn read_until_closing_square_brace( continue; } '\\' => { - t.push(toks.next().unwrap()); + t.push(tok); t.push(match toks.next() { Some(tok) => tok, None => continue, diff --git a/tests/error.rs b/tests/error.rs index ffa3fc1..997d9c2 100644 --- a/tests/error.rs +++ b/tests/error.rs @@ -245,4 +245,11 @@ error!( "a {foo: {bar: red", "Error: Expected identifier." ); error!(toplevel_nullbyte, "\u{0}", "Error: expected selector."); -error!(double_escaped_bang_at_toplevel, "\\!\\!", "Error: expected \"{\"."); +error!( + double_escaped_bang_at_toplevel, + "\\!\\!", "Error: expected \"{\"." +); +error!( + nothing_after_escape_inside_brackets, + "a { color: [\\", "Error: expected \"]\"." +);