# cmccomb/human_regex architecture

> Architecture diagram of the GitHub repository cmccomb/human_regex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cmccomb/human_regex
- Repository: https://github.com/cmccomb/human_regex

## Overview

##### Main Components

a) Core Components Layer:
- HumanRegex API (Primary Interface)
- Rust Regex Core Library (Foundation Layer)
- Type System (Compiler Validation Layer)

b) Feature Categories (Group these as modules):
- Character Operations
- Pattern Matching
- Grouping Operations
- Flag Management
- String Manipulation

**┌─────────────────────────────────────────┐**
- Client Code Layer            │
- ┘
- ↓
**┌─────────────────────────────────────────┐**
- Human Regex API Layer           │
- ┤
- Character Classes                     │
- Repetitions                           │
- Empty Matches                         │
- Groupings                             │
- Flags                                 │
- ┘
- ↓
**┌─────────────────────────────────────────┐**
- Rust Regex Core Library         │
- ┘

##### Component Details

- Green: Public API interfaces
- Blue: Internal implementations
- Yellow: Core library dependencies
- Gray: Utility functions and helpers

##### Flow Representation

Transformation process:
**Human-Readable API Call → Type Checking → Regex String Generation → Core Regex Compilation**

##### Key Elements to Highlight

a) API Components (based on src/ directory):
- ASCII Operations (ascii.rs)
- Capturing Groups (capturing.rs)
- Direct Matching (direct.rs)
- Pattern Repetitions (repetitions.rs)
- Logical Operations (logical.rs)

b) Integration Points:
- How the builder pattern combines operations
- Type safety checks
- Conversion to core regex objects

##### Implementation Notes

- Pattern Building Process
- Type System Integration
- Core Regex Integration
- Flag Management System

##### Integration with the core Rust regex library

Remember to include examples from the cookbook.rs file to demonstrate common usage patterns and transformations.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Code Layer"]
        ClientCode["Client Applications"]
    end

    subgraph API["Human Regex API Layer"]
        HumanRegex["HumanRegex API"]:::primary
        click HumanRegex "https://github.com/cmccomb/human_regex/blob/master/src/humanregex.rs"
        
        subgraph Features["Feature Modules"]
            CharOps["Character Operations"]:::module
            click CharOps "https://github.com/cmccomb/human_regex/blob/master/src/ascii.rs"
            
            PatternMatch["Pattern Matching"]:::module
            click PatternMatch "https://github.com/cmccomb/human_regex/blob/master/src/direct.rs"
            
            GroupOps["Grouping Operations"]:::module
            click GroupOps "https://github.com/cmccomb/human_regex/blob/master/src/capturing.rs"
            
            FlagMgmt["Flag Management"]:::module
            click FlagMgmt "https://github.com/cmccomb/human_regex/blob/master/src/flags.rs"
            
            StringManip["String Manipulation"]:::module
            click StringManip "https://github.com/cmccomb/human_regex/blob/master/src/logical.rs"
            
            Repetitions["Pattern Repetitions"]:::module
            click Repetitions "https://github.com/cmccomb/human_regex/blob/master/src/repetitions.rs"
            
            EmptyMatch["Empty Match Handling"]:::module
            click EmptyMatch "https://github.com/cmccomb/human_regex/blob/master/src/emptymatches.rs"
        end

        Examples["Usage Examples & Cookbook"]:::examples
        click Examples "https://github.com/cmccomb/human_regex/blob/master/src/cookbook.rs"
    end

    subgraph Core["Rust Regex Core Layer"]
        RegexCore["Rust Regex Library"]:::core
        TypeSystem["Type System & Validation"]:::core
    end

    %% Connections
    ClientCode --> HumanRegex
    
    HumanRegex --> CharOps
    HumanRegex --> PatternMatch
    HumanRegex --> GroupOps
    HumanRegex --> FlagMgmt
    HumanRegex --> StringManip
    HumanRegex --> Repetitions
    HumanRegex --> EmptyMatch
    
    CharOps --> RegexCore
    PatternMatch --> RegexCore
    GroupOps --> RegexCore
    FlagMgmt --> RegexCore
    StringManip --> RegexCore
    Repetitions --> RegexCore
    EmptyMatch --> RegexCore
    
    HumanRegex -.-> Examples
    Examples -.-> RegexCore
    
    %% Type System Connections
    CharOps --> TypeSystem
    PatternMatch --> TypeSystem
    GroupOps --> TypeSystem
    StringManip --> TypeSystem
    Repetitions --> TypeSystem
    EmptyMatch --> TypeSystem
    
    TypeSystem --> RegexCore

    %% Styling
    classDef primary fill:#90EE90,stroke:#333,stroke-width:2px
    classDef module fill:#ADD8E6,stroke:#333
    classDef core fill:#FFE4B5,stroke:#333
    classDef examples fill:#D3D3D3,stroke:#333

    %% Legend
    subgraph Legend
        Primary["Primary Interface"]:::primary
        Module["Feature Module"]:::module
        CoreComp["Core Component"]:::core
        Example["Examples & Documentation"]:::examples
    end
```
