Skip to content

Commit 9a775df

Browse files
committed
fix(parse/tailwind): fix lexing variants that start with numbers
1 parent 547c2da commit 9a775df

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

crates/biome_tailwind_parser/src/lexer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'src> TailwindLexer<'src> {
5858
b'-' => self.consume_byte(T![-]),
5959
b'!' => self.consume_byte(T![!]),
6060
b'/' => self.consume_byte(T![/]),
61-
_ if current.is_ascii_alphabetic() => self.consume_base(),
61+
_ if current.is_ascii_alphanumeric() => self.consume_base(),
6262
_ => {
6363
if self.position == 0
6464
&& let Some((bom, bom_size)) = self.consume_potential_bom(UNICODE_BOM)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2xl:table
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
source: crates/biome_tailwind_parser/tests/spec_test.rs
3+
expression: snapshot
4+
---
5+
## Input
6+
7+
```text
8+
2xl:table
9+
10+
```
11+
12+
13+
## AST
14+
15+
```
16+
TwRoot {
17+
bom_token: missing (optional),
18+
candidates: TwCandidateList [
19+
TwFullCandidate {
20+
variants: TwVariantList [
21+
TwStaticVariant {
22+
base_token: TW_BASE@0..3 "2xl" [] [],
23+
},
24+
COLON@3..4 ":" [] [],
25+
],
26+
negative_token: missing (optional),
27+
candidate: TwStaticCandidate {
28+
base_token: TW_BASE@4..10 "table" [] [Newline("\n")],
29+
},
30+
excl_token: missing (optional),
31+
},
32+
],
33+
eof_token: EOF@10..10 "" [] [],
34+
}
35+
```
36+
37+
## CST
38+
39+
```
40+
41+
0: (empty)
42+
43+
44+
45+
46+
0: [email protected] "2xl" [] []
47+
1: [email protected] ":" [] []
48+
1: (empty)
49+
50+
0: [email protected] "table" [] [Newline("\n")]
51+
3: (empty)
52+
2: [email protected] "" [] []
53+
54+
```

0 commit comments

Comments
 (0)