Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions crates/biome_tailwind_parser/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,18 @@ impl<'src> TailwindLexer<'src> {
.rfind(|&name| source_from_position.starts_with(name));

if let Some(base_name) = base_name {
self.advance(base_name.len());
return TW_BASE;
// we need to make sure that either the base is followed by a `-` to signify a value is coming, or a whitespace/end of input to signify the end of the base
match self.byte_at(base_name.len()) {
Some(b'-') | None => {
self.advance(base_name.len());
return TW_BASE;
}
Some(b) if b.is_ascii_whitespace() => {
self.advance(base_name.len());
return TW_BASE;
}
_ => {}
}
}

while let Some(byte) = self.current_byte() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
inset-x-[20px] inset-y-[15px]
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
source: crates/biome_tailwind_parser/tests/spec_test.rs
expression: snapshot
---
## Input

```text
inset-x-[20px] inset-y-[15px]

```


## AST

```
TwRoot {
bom_token: missing (optional),
candidates: TwCandidateList [
TwFullCandidate {
variants: TwVariantList [],
negative_token: missing (optional),
candidate: TwFunctionalCandidate {
base_token: [email protected] "inset-x" [] [],
minus_token: [email protected] "-" [] [],
value: TwArbitraryValue {
l_brack_token: [email protected] "[" [] [],
value_token: [email protected] "20px" [] [],
r_brack_token: [email protected] "]" [] [],
},
modifier: missing (optional),
},
excl_token: missing (optional),
},
[email protected] " " [] [],
TwFullCandidate {
variants: TwVariantList [],
negative_token: missing (optional),
candidate: TwFunctionalCandidate {
base_token: [email protected] "inset-y" [] [],
minus_token: [email protected] "-" [] [],
value: TwArbitraryValue {
l_brack_token: [email protected] "[" [] [],
value_token: [email protected] "15px" [] [],
r_brack_token: [email protected] "]" [] [Newline("\n")],
},
modifier: missing (optional),
},
excl_token: missing (optional),
},
],
eof_token: [email protected] "" [] [],
}
```

## CST

```
0: [email protected]
0: (empty)
1: [email protected]
0: [email protected]
0: [email protected]
1: (empty)
2: [email protected]
0: [email protected] "inset-x" [] []
1: [email protected] "-" [] []
2: [email protected]
0: [email protected] "[" [] []
1: [email protected] "20px" [] []
2: [email protected] "]" [] []
3: (empty)
3: (empty)
1: [email protected] " " [] []
2: [email protected]
0: [email protected]
1: (empty)
2: [email protected]
0: [email protected] "inset-y" [] []
1: [email protected] "-" [] []
2: [email protected]
0: [email protected] "[" [] []
1: [email protected] "15px" [] []
2: [email protected] "]" [] [Newline("\n")]
3: (empty)
3: (empty)
2: [email protected] "" [] []

```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
space-x-[14px] space-y-[10px] divide-x-[2px] divide-y-[3px]
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
source: crates/biome_tailwind_parser/tests/spec_test.rs
expression: snapshot
---
## Input

```text
space-x-[14px] space-y-[10px] divide-x-[2px] divide-y-[3px]

```


## AST

```
TwRoot {
bom_token: missing (optional),
candidates: TwCandidateList [
TwFullCandidate {
variants: TwVariantList [],
negative_token: missing (optional),
candidate: TwFunctionalCandidate {
base_token: [email protected] "space-x" [] [],
minus_token: [email protected] "-" [] [],
value: TwArbitraryValue {
l_brack_token: [email protected] "[" [] [],
value_token: [email protected] "14px" [] [],
r_brack_token: [email protected] "]" [] [],
},
modifier: missing (optional),
},
excl_token: missing (optional),
},
[email protected] " " [] [],
TwFullCandidate {
variants: TwVariantList [],
negative_token: missing (optional),
candidate: TwFunctionalCandidate {
base_token: [email protected] "space-y" [] [],
minus_token: [email protected] "-" [] [],
value: TwArbitraryValue {
l_brack_token: [email protected] "[" [] [],
value_token: [email protected] "10px" [] [],
r_brack_token: [email protected] "]" [] [],
},
modifier: missing (optional),
},
excl_token: missing (optional),
},
[email protected] " " [] [],
TwFullCandidate {
variants: TwVariantList [],
negative_token: missing (optional),
candidate: TwFunctionalCandidate {
base_token: [email protected] "divide-x" [] [],
minus_token: [email protected] "-" [] [],
value: TwArbitraryValue {
l_brack_token: [email protected] "[" [] [],
value_token: [email protected] "2px" [] [],
r_brack_token: [email protected] "]" [] [],
},
modifier: missing (optional),
},
excl_token: missing (optional),
},
[email protected] " " [] [],
TwFullCandidate {
variants: TwVariantList [],
negative_token: missing (optional),
candidate: TwFunctionalCandidate {
base_token: [email protected] "divide-y" [] [],
minus_token: [email protected] "-" [] [],
value: TwArbitraryValue {
l_brack_token: [email protected] "[" [] [],
value_token: [email protected] "3px" [] [],
r_brack_token: [email protected] "]" [] [Newline("\n")],
},
modifier: missing (optional),
},
excl_token: missing (optional),
},
],
eof_token: [email protected] "" [] [],
}
```

## CST

```
0: [email protected]
0: (empty)
1: [email protected]
0: [email protected]
0: [email protected]
1: (empty)
2: [email protected]
0: [email protected] "space-x" [] []
1: [email protected] "-" [] []
2: [email protected]
0: [email protected] "[" [] []
1: [email protected] "14px" [] []
2: [email protected] "]" [] []
3: (empty)
3: (empty)
1: [email protected] " " [] []
2: [email protected]
0: [email protected]
1: (empty)
2: [email protected]
0: [email protected] "space-y" [] []
1: [email protected] "-" [] []
2: [email protected]
0: [email protected] "[" [] []
1: [email protected] "10px" [] []
2: [email protected] "]" [] []
3: (empty)
3: (empty)
3: [email protected] " " [] []
4: [email protected]
0: [email protected]
1: (empty)
2: [email protected]
0: [email protected] "divide-x" [] []
1: [email protected] "-" [] []
2: [email protected]
0: [email protected] "[" [] []
1: [email protected] "2px" [] []
2: [email protected] "]" [] []
3: (empty)
3: (empty)
5: [email protected] " " [] []
6: [email protected]
0: [email protected]
1: (empty)
2: [email protected]
0: [email protected] "divide-y" [] []
1: [email protected] "-" [] []
2: [email protected]
0: [email protected] "[" [] []
1: [email protected] "3px" [] []
2: [email protected] "]" [] [Newline("\n")]
3: (empty)
3: (empty)
2: [email protected] "" [] []

```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
break-before-auto break-after-page mix-blend-normal
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
source: crates/biome_tailwind_parser/tests/spec_test.rs
expression: snapshot
---
## Input

```text
break-before-auto break-after-page mix-blend-normal

```


## AST

```
TwRoot {
bom_token: missing (optional),
candidates: TwCandidateList [
TwFullCandidate {
variants: TwVariantList [],
negative_token: missing (optional),
candidate: TwFunctionalCandidate {
base_token: [email protected] "break-before" [] [],
minus_token: [email protected] "-" [] [],
value: TwNamedValue {
value_token: [email protected] "auto" [] [],
},
modifier: missing (optional),
},
excl_token: missing (optional),
},
[email protected] " " [] [],
TwFullCandidate {
variants: TwVariantList [],
negative_token: missing (optional),
candidate: TwFunctionalCandidate {
base_token: [email protected] "break-after" [] [],
minus_token: [email protected] "-" [] [],
value: TwNamedValue {
value_token: [email protected] "page" [] [],
},
modifier: missing (optional),
},
excl_token: missing (optional),
},
[email protected] " " [] [],
TwFullCandidate {
variants: TwVariantList [],
negative_token: missing (optional),
candidate: TwFunctionalCandidate {
base_token: [email protected] "mix-blend" [] [],
minus_token: [email protected] "-" [] [],
value: TwNamedValue {
value_token: [email protected] "normal" [] [Newline("\n")],
},
modifier: missing (optional),
},
excl_token: missing (optional),
},
],
eof_token: [email protected] "" [] [],
}
```

## CST

```
0: [email protected]
0: (empty)
1: [email protected]
0: [email protected]
0: [email protected]
1: (empty)
2: [email protected]
0: [email protected] "break-before" [] []
1: [email protected] "-" [] []
2: [email protected]
0: [email protected] "auto" [] []
3: (empty)
3: (empty)
1: [email protected] " " [] []
2: [email protected]
0: [email protected]
1: (empty)
2: [email protected]
0: [email protected] "break-after" [] []
1: [email protected] "-" [] []
2: [email protected]
0: [email protected] "page" [] []
3: (empty)
3: (empty)
3: [email protected] " " [] []
4: [email protected]
0: [email protected]
1: (empty)
2: [email protected]
0: [email protected] "mix-blend" [] []
1: [email protected] "-" [] []
2: [email protected]
0: [email protected] "normal" [] [Newline("\n")]
3: (empty)
3: (empty)
2: [email protected] "" [] []

```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
border-slate-500 border-teal-600 border-solid
Loading