clojure.rs — tailwindcss Source File
Architecture documentation for clojure.rs, a rust file in the tailwindcss codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d5897009_a00e_cc82_ddfa_bf299b0bd83d["clojure.rs"] 9ae50d22_63b7_6aac_0bbf_64cf82ee4dc9["super::Clojure"] d5897009_a00e_cc82_ddfa_bf299b0bd83d --> 9ae50d22_63b7_6aac_0bbf_64cf82ee4dc9 e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e["crate::cursor"] d5897009_a00e_cc82_ddfa_bf299b0bd83d --> e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e a55fec3d_3fee_4b46_48f2_43f3844c61e4["crate::extractor::pre_processors::pre_processor::PreProcessor"] d5897009_a00e_cc82_ddfa_bf299b0bd83d --> a55fec3d_3fee_4b46_48f2_43f3844c61e4 e8f7ef42_4edb_c180_b1a1_7f3dcfa8e322["bstr::ByteSlice"] d5897009_a00e_cc82_ddfa_bf299b0bd83d --> e8f7ef42_4edb_c180_b1a1_7f3dcfa8e322 style d5897009_a00e_cc82_ddfa_bf299b0bd83d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
use crate::cursor;
use crate::extractor::pre_processors::pre_processor::PreProcessor;
use bstr::ByteSlice;
#[derive(Debug, Default)]
pub struct Clojure;
/// This is meant to be a rough estimate of a valid ClojureScript keyword
///
/// This can be approximated by the following regex:
/// /::?[a-zA-Z0-9!#$%&*+./:<=>?_|-]+/
///
/// However, keywords are intended to be detected as utilities. Since the set
/// of valid characters in a utility (outside of arbitrary values) is smaller,
/// along with the fact that neither `[]` nor `()` are allowed in keywords we
/// can simplify this list quite a bit.
#[inline]
fn is_keyword_character(byte: u8) -> bool {
(matches!(
byte,
b'!' | b'#' | b'%' | b'*' | b'+' | b'-' | b'.' | b'/' | b':' | b'_'
) | byte.is_ascii_alphanumeric())
}
impl PreProcessor for Clojure {
fn process(&self, content: &[u8]) -> Vec<u8> {
let content = content
.replace(":class", " ")
.replace(":className", " ");
let len = content.len();
let mut result = content.to_vec();
let mut cursor = cursor::Cursor::new(&content);
while cursor.pos < len {
match cursor.curr {
// Consume strings as-is
b'"' => {
result[cursor.pos] = b' ';
cursor.advance();
while cursor.pos < len {
match cursor.curr {
// Escaped character, skip ahead to the next character
b'\\' => cursor.advance_twice(),
// End of the string
b'"' => {
result[cursor.pos] = b' ';
break;
}
// Everything else is valid
_ => cursor.advance(),
};
}
}
// Discard line comments until the end of the line.
// Comments start with `;;`
b';' if matches!(cursor.next, b';') => {
// ... (377 more lines)
Domain
Subdomains
Functions
- is_keyword_character()
- process()
- test_clojure_pre_processor()
- test_extract_candidates()
- test_extract_from_symbol_list()
- test_extraction_of_classes_with_dots()
- test_extraction_of_pseudoclasses_from_keywords()
- test_ignore_comments_with_invalid_strings()
- test_noninterference_of_parens_on_keywords()
- test_special_characters_are_valid_in_strings()
Dependencies
- bstr::ByteSlice
- crate::cursor
- crate::extractor::pre_processors::pre_processor::PreProcessor
- super::Clojure
Source
Frequently Asked Questions
What does clojure.rs do?
clojure.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the OxideEngine domain, PreProcessors subdomain.
What functions are defined in clojure.rs?
clojure.rs defines 10 function(s): is_keyword_character, process, test_clojure_pre_processor, test_extract_candidates, test_extract_from_symbol_list, test_extraction_of_classes_with_dots, test_extraction_of_pseudoclasses_from_keywords, test_ignore_comments_with_invalid_strings, test_noninterference_of_parens_on_keywords, test_special_characters_are_valid_in_strings.
What does clojure.rs depend on?
clojure.rs imports 4 module(s): bstr::ByteSlice, crate::cursor, crate::extractor::pre_processors::pre_processor::PreProcessor, super::Clojure.
Where is clojure.rs in the architecture?
clojure.rs is located at crates/oxide/src/extractor/pre_processors/clojure.rs (domain: OxideEngine, subdomain: PreProcessors, directory: crates/oxide/src/extractor/pre_processors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free