Repository: tailwindlabs/tailwindcss
File: crates/oxide/src/extractor/pre_processors/clojure.rs (Rust)

Code before:
use crate::cursor;
use crate::extractor::pre_processors::pre_processor::PreProcessor;
use bstr::ByteSlice;

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

#[inline]
fn is_keyword_character(byte: u8) -> bool {
    matches!(
        byte,
        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' ';

Review comment (refactor):
```suggestion
/// 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 {
    return matches!(
        byte,
        b'!' | b'%' | b'*' | b'+' | b'-' | b'.' | b'/' | b':' | b'_'
    ) | byte.is_ascii_alphanumeric();
}
```

I updated this list to:
- Include `!` and `%` since they should be there
- Drop `#` and `?` as they can't be used in a named utility / variant today
- Order them in byte value order (not really needed just did it anyway)

Code after:
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 {
    return matches!(
        byte,
        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();