Add error message for toplevel &
This commit is contained in:
parent
6c41d7722b
commit
4fdd1ce69a
@ -310,7 +310,7 @@ struct StyleSheetParser<'a> {
|
|||||||
impl<'a> StyleSheetParser<'a> {
|
impl<'a> StyleSheetParser<'a> {
|
||||||
fn parse_toplevel(mut self) -> SassResult<(Vec<Stmt>, Scope)> {
|
fn parse_toplevel(mut self) -> SassResult<(Vec<Stmt>, Scope)> {
|
||||||
let mut rules: Vec<Stmt> = Vec::new();
|
let mut rules: Vec<Stmt> = Vec::new();
|
||||||
while let Some(Token { kind, .. }) = self.lexer.peek() {
|
while let Some(Token { kind, pos }) = self.lexer.peek() {
|
||||||
match kind {
|
match kind {
|
||||||
TokenKind::Ident(_)
|
TokenKind::Ident(_)
|
||||||
| TokenKind::Attribute(_)
|
| TokenKind::Attribute(_)
|
||||||
@ -422,6 +422,9 @@ impl<'a> StyleSheetParser<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TokenKind::Symbol(Symbol::BitAnd) => {
|
||||||
|
return Err(SassError::new("Base-level rules cannot contain the parent-selector-referencing character '&'.", pos.clone()))
|
||||||
|
}
|
||||||
_ => match self.lexer.next() {
|
_ => match self.lexer.next() {
|
||||||
Some(Token { pos, .. }) => self.error(pos, "unexpected toplevel token"),
|
Some(Token { pos, .. }) => self.error(pos, "unexpected toplevel token"),
|
||||||
_ => unsafe { std::hint::unreachable_unchecked() },
|
_ => unsafe { std::hint::unreachable_unchecked() },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user