Home / File/ elixir.rs — tailwindcss Source File

elixir.rs — tailwindcss Source File

Architecture documentation for elixir.rs, a rust file in the tailwindcss codebase. 4 imports, 0 dependents.

File rust OxideEngine PreProcessors 4 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  49b7c9b9_4460_eeb3_7d00_eaf6ca7e963c["elixir.rs"]
  9565553b_2a50_726f_fa1d_7ee1f428776f["super::Elixir"]
  49b7c9b9_4460_eeb3_7d00_eaf6ca7e963c --> 9565553b_2a50_726f_fa1d_7ee1f428776f
  e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e["crate::cursor"]
  49b7c9b9_4460_eeb3_7d00_eaf6ca7e963c --> e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e
  94b5420b_055c_efe5_392d_b0d15e43aa35["crate::extractor::bracket_stack::BracketStack"]
  49b7c9b9_4460_eeb3_7d00_eaf6ca7e963c --> 94b5420b_055c_efe5_392d_b0d15e43aa35
  a55fec3d_3fee_4b46_48f2_43f3844c61e4["crate::extractor::pre_processors::pre_processor::PreProcessor"]
  49b7c9b9_4460_eeb3_7d00_eaf6ca7e963c --> a55fec3d_3fee_4b46_48f2_43f3844c61e4
  style 49b7c9b9_4460_eeb3_7d00_eaf6ca7e963c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

use crate::cursor;
use crate::extractor::bracket_stack::BracketStack;
use crate::extractor::pre_processors::pre_processor::PreProcessor;

#[derive(Debug, Default)]
pub struct Elixir;

impl PreProcessor for Elixir {
    fn process(&self, content: &[u8]) -> Vec<u8> {
        let mut cursor = cursor::Cursor::new(content);
        let mut result = content.to_vec();
        let mut bracket_stack = BracketStack::default();

        while cursor.pos < content.len() {
            // Look for a sigil marker
            if cursor.curr != b'~' {
                cursor.advance();
                continue;
            }

            // Scan charlists, strings, and wordlists
            if !matches!(cursor.next, b'c' | b'C' | b's' | b'S' | b'w' | b'W') {
                cursor.advance();
                continue;
            }

            cursor.advance_twice();

            // Match the opening for a sigil
            if !matches!(cursor.curr, b'(' | b'[' | b'{') {
                continue;
            }

            // Replace the opening bracket with a space
            result[cursor.pos] = b' ';

            // Scan until we find a balanced closing one and replace it too
            bracket_stack.push(cursor.curr);

            while cursor.pos < content.len() {
                cursor.advance();

                match cursor.curr {
                    // Escaped character, skip ahead to the next character
                    b'\\' => cursor.advance_twice(),
                    b'(' | b'[' | b'{' => {
                        bracket_stack.push(cursor.curr);
                    }
                    b')' | b']' | b'}' if !bracket_stack.is_empty() => {
                        bracket_stack.pop(cursor.curr);

                        if bracket_stack.is_empty() {
                            // Replace the closing bracket with a space
                            result[cursor.pos] = b' ';
                            break;
                        }
                    }
                    _ => {}
                }
            }
// ... (95 more lines)

Domain

Subdomains

Dependencies

  • crate::cursor
  • crate::extractor::bracket_stack::BracketStack
  • crate::extractor::pre_processors::pre_processor::PreProcessor
  • super::Elixir

Frequently Asked Questions

What does elixir.rs do?
elixir.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 elixir.rs?
elixir.rs defines 3 function(s): process, test_elixir_pre_processor, test_extract_candidates.
What does elixir.rs depend on?
elixir.rs imports 4 module(s): crate::cursor, crate::extractor::bracket_stack::BracketStack, crate::extractor::pre_processors::pre_processor::PreProcessor, super::Elixir.
Where is elixir.rs in the architecture?
elixir.rs is located at crates/oxide/src/extractor/pre_processors/elixir.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