diff --git a/src/lib.rs b/src/lib.rs index 1cc1e16..d34c7f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -387,8 +387,9 @@ pub(crate) fn eat_expr>( } } '\\' => { - values.push(toks.next().unwrap()); - values.push(toks.next().unwrap()); + let next = toks.next().unwrap(); + values.push(next); + values.push(toks.next().ok_or(("expected \"}\".", next.pos))?); } // todo: this should only apply to special functions // it is causing us to emit nothing on malformed input diff --git a/tests/error.rs b/tests/error.rs index cbc53c5..8acb405 100644 --- a/tests/error.rs +++ b/tests/error.rs @@ -123,6 +123,7 @@ error!( "#{", "Error: expected \"}\"." ); error!(toplevel_hash, "#", "Error: expected \"{\"."); +error!(toplevel_backslash, "\\", "Error: expected \"}\"."); error!(toplevel_var_no_colon, "$r", "Error: expected \":\"."); error!(bar_in_value, "a {color: a|b;}", "Error: expected \";\"."); error!(