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 Oxide PreProcessors 4 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  2512c3cb_e625_2618_a8de_488cdc04e632["elixir.rs"]
  6260e821_5315_6d2a_08e7_f0195d8ae36e["super::Elixir"]
  2512c3cb_e625_2618_a8de_488cdc04e632 --> 6260e821_5315_6d2a_08e7_f0195d8ae36e
  96a36755_a007_15e1_ec6c_526c02d24b9b["crate::cursor"]
  2512c3cb_e625_2618_a8de_488cdc04e632 --> 96a36755_a007_15e1_ec6c_526c02d24b9b
  c4d29b89_2191_f275_13fb_7cf117340055["crate::extractor::bracket_stack::BracketStack"]
  2512c3cb_e625_2618_a8de_488cdc04e632 --> c4d29b89_2191_f275_13fb_7cf117340055
  ed5b6564_5e78_f7bf_cdc6_b0150d9116c1["crate::extractor::pre_processors::pre_processor::PreProcessor"]
  2512c3cb_e625_2618_a8de_488cdc04e632 --> ed5b6564_5e78_f7bf_cdc6_b0150d9116c1
  style 2512c3cb_e625_2618_a8de_488cdc04e632 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 Oxide 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: Oxide, 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