better handle - at the start of idents
This commit is contained in:
parent
709b95d035
commit
67091115db
@ -295,7 +295,7 @@ 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());
|
||||
}
|
||||
'`' => {
|
||||
|
@ -166,6 +166,9 @@ pub(crate) fn peek_ident_no_interpolation<I: Iterator<Item = Token>>(
|
||||
if toks.peek().unwrap().kind == '-' {
|
||||
toks.peek_forward(1);
|
||||
text.push('-');
|
||||
if toks.peek().is_none() {
|
||||
return Ok(Spanned { node: text, span });
|
||||
}
|
||||
if toks.peek().unwrap().kind == '-' {
|
||||
toks.peek_forward(1);
|
||||
text.push('-');
|
||||
|
@ -179,6 +179,9 @@ pub(crate) fn eat_ident<I: Iterator<Item = Token>>(
|
||||
if toks.peek().unwrap().kind == '-' {
|
||||
toks.next();
|
||||
text.push('-');
|
||||
if toks.peek().is_none() {
|
||||
return Ok(Spanned { node: text, span });
|
||||
}
|
||||
if toks.peek().unwrap().kind == '-' {
|
||||
toks.next();
|
||||
text.push('-');
|
||||
@ -235,6 +238,9 @@ pub(crate) fn eat_ident_no_interpolation<I: Iterator<Item = Token>>(
|
||||
if toks.peek().unwrap().kind == '-' {
|
||||
toks.next();
|
||||
text.push('-');
|
||||
if toks.peek().is_none() {
|
||||
return Ok(Spanned { node: text, span });
|
||||
}
|
||||
if toks.peek().unwrap().kind == '-' {
|
||||
toks.next();
|
||||
text.push('-');
|
||||
|
@ -85,6 +85,10 @@ error!(
|
||||
error!(toplevel_comma, "a {},", "Error: expected \"{\".");
|
||||
error!(toplevel_exclamation, "! {}", "Error: expected \"{\".");
|
||||
error!(toplevel_backtick, "` {}", "Error: expected selector.");
|
||||
error!(
|
||||
toplevel_open_curly_brace,
|
||||
"{ {color: red;}", "Error: expected \"{\"."
|
||||
);
|
||||
error!(
|
||||
backtick_in_value,
|
||||
"a {color:`red;}", "Error: Expected expression."
|
||||
@ -93,3 +97,15 @@ error!(
|
||||
comma_begins_value,
|
||||
"a {color:,red;}", "Error: Expected expression."
|
||||
);
|
||||
error!(
|
||||
nothing_after_hyphen,
|
||||
"a {-}", "Error: Expected \":\"."
|
||||
);
|
||||
error!(
|
||||
nothing_after_hyphen_variable,
|
||||
"a {$-", "Error: expected \":\"."
|
||||
);
|
||||
error!(
|
||||
closing_brace_after_hyphen_variable,
|
||||
"a {$-}", "Error: Expected identifier."
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user