symbol after hash in value

This commit is contained in:
ConnorSkees 2020-04-02 02:08:14 -04:00
parent 87b03e91c9
commit 618fa9ed86
3 changed files with 11 additions and 2 deletions

View File

@ -368,7 +368,7 @@ pub(crate) fn eat_ident<I: Iterator<Item = Token>>(
match tok.kind { match tok.kind {
'#' => { '#' => {
toks.next(); toks.next();
if toks.peek().unwrap().kind == '{' { if toks.peek().ok_or("Expected identifier.")?.kind == '{' {
toks.next(); toks.next();
s.push_str(&parse_interpolation(toks, scope, super_selector)?.to_string()); s.push_str(&parse_interpolation(toks, scope, super_selector)?.to_string());
} else { } else {

View File

@ -31,7 +31,12 @@ fn parse_hex<I: Iterator<Item = Token>>(
super_selector: &Selector, super_selector: &Selector,
) -> SassResult<Value> { ) -> SassResult<Value> {
let mut s = String::with_capacity(8); let mut s = String::with_capacity(8);
if toks.peek().unwrap().kind.is_ascii_digit() { if toks
.peek()
.ok_or("Expected identifier.")?
.kind
.is_ascii_digit()
{
while let Some(c) = toks.peek() { while let Some(c) = toks.peek() {
if !c.kind.is_ascii_hexdigit() || s.len() == 8 { if !c.kind.is_ascii_hexdigit() || s.len() == 8 {
break; break;

View File

@ -40,3 +40,7 @@ error!(
close_paren_without_opening, close_paren_without_opening,
"a {color: foo);}", "Error: expected \";\"." "a {color: foo);}", "Error: expected \";\"."
); );
error!(
symbol_after_hash,
"a {color: bar + #}ar;}", "Error: Expected identifier."
);