css_variable_machine.rs — tailwindcss Source File
Architecture documentation for css_variable_machine.rs, a rust file in the tailwindcss codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 268529ba_4bf9_7a41_0273_72baf0f193f0["css_variable_machine.rs"] 70b34b9d_f8f6_0a85_23e0_55be4c5b81f2["super::CssVariableMachine"] 268529ba_4bf9_7a41_0273_72baf0f193f0 --> 70b34b9d_f8f6_0a85_23e0_55be4c5b81f2 e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e["crate::cursor"] 268529ba_4bf9_7a41_0273_72baf0f193f0 --> e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e cd83abb6_a664_e16d_ddc8_60a3f23ba86a["crate::extractor::machine::"] 268529ba_4bf9_7a41_0273_72baf0f193f0 --> cd83abb6_a664_e16d_ddc8_60a3f23ba86a 5731c53a_0325_b3af_2918_bcb379bc8ec6["classification_macros::ClassifyBytes"] 268529ba_4bf9_7a41_0273_72baf0f193f0 --> 5731c53a_0325_b3af_2918_bcb379bc8ec6 9a9673b5_10d4_f716_360c_b2510082b102["crate::extractor::machine::Machine"] 268529ba_4bf9_7a41_0273_72baf0f193f0 --> 9a9673b5_10d4_f716_360c_b2510082b102 e4088d34_b5b4_ec51_b975_557a1536ec76["pretty_assertions::assert_eq"] 268529ba_4bf9_7a41_0273_72baf0f193f0 --> e4088d34_b5b4_ec51_b975_557a1536ec76 style 268529ba_4bf9_7a41_0273_72baf0f193f0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
use crate::cursor;
use crate::extractor::machine::{Machine, MachineState};
use classification_macros::ClassifyBytes;
/// Extract CSS variables from an input.
///
/// E.g.:
///
/// ```text
/// var(--my-variable)
/// ^^^^^^^^^^^^^
/// ```
#[derive(Debug, Default)]
pub struct CssVariableMachine;
impl Machine for CssVariableMachine {
#[inline(always)]
fn reset(&mut self) {}
#[inline]
fn next(&mut self, cursor: &mut cursor::Cursor<'_>) -> MachineState {
// CSS Variables must start with `--`
if Class::Dash != cursor.curr.into() || Class::Dash != cursor.next.into() {
return MachineState::Idle;
}
let start_pos = cursor.pos;
let len = cursor.input.len();
cursor.advance_twice();
while cursor.pos < len {
match cursor.curr.into() {
// https://drafts.csswg.org/css-syntax-3/#ident-token-diagram
//
Class::AllowedCharacter | Class::Dash => {
match cursor.next.into() {
// Valid character followed by a valid character or an escape character
//
// E.g.: `--my-variable`
// ^^
// E.g.: `--my-\#variable`
// ^^
Class::AllowedCharacter | Class::Dash | Class::Escape => cursor.advance(),
// Valid character followed by anything else means the variable is done
//
// E.g.: `'--my-variable'`
// ^
_ => {
// There must be at least 1 character after the `--`
if cursor.pos - start_pos < 2 {
return self.restart();
} else {
return self.done(start_pos, cursor);
}
}
}
}
// ... (155 more lines)
Domain
Subdomains
Functions
Dependencies
- classification_macros::ClassifyBytes
- crate::cursor
- crate::extractor::machine::
- crate::extractor::machine::Machine
- pretty_assertions::assert_eq
- super::CssVariableMachine
Source
Frequently Asked Questions
What does css_variable_machine.rs do?
css_variable_machine.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the OxideEngine domain, Extractor subdomain.
What functions are defined in css_variable_machine.rs?
css_variable_machine.rs defines 4 function(s): next, reset, test_css_variable_machine_extraction, test_css_variable_machine_performance.
What does css_variable_machine.rs depend on?
css_variable_machine.rs imports 6 module(s): classification_macros::ClassifyBytes, crate::cursor, crate::extractor::machine::, crate::extractor::machine::Machine, pretty_assertions::assert_eq, super::CssVariableMachine.
Where is css_variable_machine.rs in the architecture?
css_variable_machine.rs is located at crates/oxide/src/extractor/css_variable_machine.rs (domain: OxideEngine, subdomain: Extractor, directory: crates/oxide/src/extractor).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free