next() — tailwindcss Function Reference
Architecture documentation for the next() function in arbitrary_value_machine.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 9809ef0a_7dcb_69e0_be80_ba47076a88c6["next()"] 2b32c2f1_30a5_e7bc_225e_f9c276ad26c0["arbitrary_value_machine.rs"] 9809ef0a_7dcb_69e0_be80_ba47076a88c6 -->|defined in| 2b32c2f1_30a5_e7bc_225e_f9c276ad26c0 style 9809ef0a_7dcb_69e0_be80_ba47076a88c6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/oxide/src/extractor/arbitrary_value_machine.rs lines 33–109
fn next(&mut self, cursor: &mut cursor::Cursor<'_>) -> MachineState {
// An arbitrary value must start with an open bracket
if Class::OpenBracket != cursor.curr.into() {
return MachineState::Idle;
}
let start_pos = cursor.pos;
cursor.advance();
let len = cursor.input.len();
while cursor.pos < len {
match cursor.curr.into() {
Class::Escape => match cursor.next.into() {
// An escaped whitespace character is not allowed
//
// E.g.: `[color:var(--my-\ color)]`
// ^
Class::Whitespace => {
cursor.advance_twice();
return self.restart();
}
// An escaped character, skip the next character, resume after
//
// E.g.: `[color:var(--my-\#color)]`
// ^
_ => cursor.advance_twice(),
},
Class::OpenParen | Class::OpenBracket | Class::OpenCurly => {
if !self.bracket_stack.push(cursor.curr) {
return self.restart();
}
cursor.advance();
}
Class::CloseParen | Class::CloseBracket | Class::CloseCurly
if !self.bracket_stack.is_empty() =>
{
if !self.bracket_stack.pop(cursor.curr) {
return self.restart();
}
cursor.advance();
}
// End of an arbitrary value
//
// 1. All brackets must be balanced
// 2. There must be at least a single character inside the brackets
Class::CloseBracket
if start_pos + 1 != cursor.pos && self.bracket_stack.is_empty() =>
{
return self.done(start_pos, cursor);
}
// Start of a string
Class::Quote => match self.string_machine.next(cursor) {
MachineState::Idle => return self.restart(),
MachineState::Done(_) => cursor.advance(),
},
// Any kind of whitespace is not allowed
Class::Whitespace => return self.restart(),
// String interpolation-like syntax is not allowed. E.g.: `[${x}]`
Class::Dollar if matches!(cursor.next.into(), Class::OpenCurly) => {
return self.restart()
}
// Everything else is valid
_ => cursor.advance(),
};
}
self.restart()
}
Domain
Subdomains
Source
Frequently Asked Questions
What does next() do?
next() is a function in the tailwindcss codebase, defined in crates/oxide/src/extractor/arbitrary_value_machine.rs.
Where is next() defined?
next() is defined in crates/oxide/src/extractor/arbitrary_value_machine.rs at line 33.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free