allow non-ascii alphanumeric characters in selectors
This commit is contained in:
parent
b94a2403d0
commit
6b9f68922f
@ -151,13 +151,20 @@ struct StyleSheetParser<'a> {
|
||||
path: &'a Path,
|
||||
}
|
||||
|
||||
fn is_selector_char(c: char) -> bool {
|
||||
c.is_alphanumeric()
|
||||
|| matches!(
|
||||
c,
|
||||
'_' | '-' | '[' | '#' | ':' | '*' | '%' | '.' | '>' | '\\'
|
||||
)
|
||||
}
|
||||
|
||||
impl<'a> StyleSheetParser<'a> {
|
||||
fn parse_toplevel(mut self) -> SassResult<(Vec<Spanned<Stmt>>, Scope)> {
|
||||
let mut rules: Vec<Spanned<Stmt>> = Vec::new();
|
||||
while let Some(Token { kind, .. }) = self.lexer.peek() {
|
||||
match kind {
|
||||
'a'..='z' | 'A'..='Z' | '_' | '-' | '0'..='9'
|
||||
| '[' | '#' | ':' | '*' | '%' | '.' | '>' | '\\' => rules
|
||||
_ if is_selector_char(*kind) => rules
|
||||
.extend(self.eat_rules(&Selector::new(), &mut Scope::new())?),
|
||||
'\t' | '\n' | ' ' => {
|
||||
self.lexer.next();
|
||||
|
@ -520,3 +520,8 @@ test!(
|
||||
"$a: aaaaaaaaaaa;\n\n#{$a} {\n color: foo;\n}\n",
|
||||
"aaaaaaaaaaa {\n color: foo;\n}\n"
|
||||
);
|
||||
test!(
|
||||
toplevel_non_ascii_alphabetic,
|
||||
"ℓ {\n color: red;\n}\n",
|
||||
"@charset \"UTF-8\";\nℓ {\n color: red;\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user