handle selector with nothing after colon
This commit is contained in:
parent
042dbfa914
commit
096abb6ca0
@ -1,5 +1,7 @@
|
||||
use std::fmt::{self, Display, Write};
|
||||
|
||||
use codemap::Span;
|
||||
|
||||
use peekmore::{PeekMore, PeekMoreIterator};
|
||||
|
||||
use crate::common::{Brackets, ListSeparator, QuoteKind};
|
||||
@ -360,7 +362,7 @@ impl Selector {
|
||||
}
|
||||
':' => {
|
||||
iter.next();
|
||||
let sel = Self::consume_pseudo_selector(&mut iter, scope, super_selector)?;
|
||||
let sel = Self::consume_pseudo_selector(&mut iter, scope, super_selector, pos)?;
|
||||
match &sel {
|
||||
SelectorKind::PseudoParen(_, s) => {
|
||||
if s.contains_super_selector() {
|
||||
@ -399,8 +401,9 @@ impl Selector {
|
||||
toks: &mut PeekMoreIterator<I>,
|
||||
scope: &Scope,
|
||||
super_selector: &Selector,
|
||||
span_before: Span,
|
||||
) -> SassResult<SelectorKind> {
|
||||
let is_pseudo_element = if toks.peek().unwrap().kind == ':' {
|
||||
let is_pseudo_element = if toks.peek().ok_or(("Expected identifier.", span_before))?.kind == ':' {
|
||||
toks.next();
|
||||
true
|
||||
} else {
|
||||
|
@ -544,8 +544,12 @@ test!(
|
||||
error!(nothing_after_period, ". {}", "Error: Expected identifier.");
|
||||
error!(nothing_after_hash, "# {}", "Error: Expected identifier.");
|
||||
error!(nothing_after_percent, "% {}", "Error: Expected identifier.");
|
||||
error!(nothing_after_colon, ": {}", "Error: Expected identifier.");
|
||||
error!(no_ident_after_colon, ": {}", "Error: Expected identifier.");
|
||||
error!(
|
||||
non_ident_after_colon,
|
||||
non_ident_char_after_colon,
|
||||
":#ab {}", "Error: Expected identifier."
|
||||
);
|
||||
error!(
|
||||
nothing_after_colon,
|
||||
"a:{}", "Error: Expected identifier."
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user