From c95ecc08254705f55a2051c9080186a4fac0b470 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Fri, 14 Feb 2020 13:27:08 -0500 Subject: [PATCH] Fix crash encountering `--` --- src/lexer.rs | 1 + tests/interpolation.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/lexer.rs b/src/lexer.rs index 74404a3..5041066 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -59,6 +59,7 @@ impl<'a> Iterator for Lexer<'a> { s.push_str(&kw.to_string()); TokenKind::Ident(s) } + TokenKind::Symbol(Symbol::Minus) => TokenKind::Ident(String::from("--")), _ => unsafe { std::hint::unreachable_unchecked() }, }, _ => TokenKind::Symbol(Symbol::Minus), diff --git a/tests/interpolation.rs b/tests/interpolation.rs index aeff296..4a7c8eb 100644 --- a/tests/interpolation.rs +++ b/tests/interpolation.rs @@ -18,3 +18,8 @@ test!( "a {\n color: a#{foo}1;\n}\n", "a {\n color: afoo1;\n}\n" ); +test!( + double_hyphen_before_interpolation, + "a {\n --#{foo}: red;\n}\n", + "a {\n --foo: red;\n}\n" +);