next() — tailwindcss Function Reference
Architecture documentation for the next() function in modifier_machine.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 4d6a0a74_5bf5_8fdb_538b_cd13a0d44a5c["next()"] b783b7fd_efe2_8b73_5f61_5830aab9391d["modifier_machine.rs"] 4d6a0a74_5bf5_8fdb_538b_cd13a0d44a5c -->|defined in| b783b7fd_efe2_8b73_5f61_5830aab9391d style 4d6a0a74_5bf5_8fdb_538b_cd13a0d44a5c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/oxide/src/extractor/modifier_machine.rs lines 32–96
fn next(&mut self, cursor: &mut cursor::Cursor<'_>) -> MachineState {
// A modifier must start with a `/`, everything else is not a valid start of a modifier
if Class::Slash != cursor.curr.into() {
return MachineState::Idle;
}
let start_pos = cursor.pos;
cursor.advance();
match cursor.curr.into() {
// Start of an arbitrary value:
//
// ```
// bg-red-500/[20%]
// ^^^^^
// ```
Class::OpenBracket => match self.arbitrary_value_machine.next(cursor) {
MachineState::Idle => self.restart(),
MachineState::Done(_) => self.done(start_pos, cursor),
},
// Start of an arbitrary variable:
//
// ```
// bg-red-500/(--my-opacity)
// ^^^^^^^^^^^^^^
// ```
Class::OpenParen => match self.arbitrary_variable_machine.next(cursor) {
MachineState::Idle => self.restart(),
MachineState::Done(_) => self.done(start_pos, cursor),
},
// Start of a named modifier:
//
// ```
// bg-red-500/20
// ^^
// ```
Class::ValidStart => {
let len = cursor.input.len();
while cursor.pos < len {
match cursor.curr.into() {
Class::ValidStart | Class::ValidInside => {
match cursor.next.into() {
// Only valid characters are allowed, if followed by another valid character
Class::ValidStart | Class::ValidInside => cursor.advance(),
// Valid character, but at the end of the modifier, this ends the
// modifier
_ => return self.done(start_pos, cursor),
}
}
// Anything else is invalid, end of the modifier
_ => return self.restart(),
}
}
MachineState::Idle
}
// Anything else is not a valid start of a modifier
_ => MachineState::Idle,
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does next() do?
next() is a function in the tailwindcss codebase, defined in crates/oxide/src/extractor/modifier_machine.rs.
Where is next() defined?
next() is defined in crates/oxide/src/extractor/modifier_machine.rs at line 32.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free