Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fixer_v2): State Transition Machine for Metavariable Parser #114

Merged
merged 6 commits into from
Jan 19, 2025

Conversation

notJoon
Copy link
Contributor

@notJoon notJoon commented Jan 18, 2025

Description

stateDiagram-v2
    direction LR
    
    GO --> CL: "COLON"
    CL --> OB: "["
    OB --> DB: "["
    OB --> NM: "ident"
    DB --> NM: "ident"
    
    %% Simple Pattern :[name]
    NM --> NM: "ident"
    NM --> CB: "]"
    CB --> OK: "COLON" or "whitespace"
    CB --> QB: "]"
    CB --> QT: "*+?"
    
    %% Type Pattern :[[name:type]]
    NM --> ID: "COLON"
    ID --> ID: "ident"
    ID --> CB: "]"
    
    %% Post Quantifier
    QB --> QT: "*+?"
    QB --> OK: "COLON" or "whitespace"
    QT --> OK: "COLON" or "whitespace"
    
    %% Text handling
    GO --> TX: "other"
    GO --> WS: "whitespace"
    GO --> BR: "{}"
    
    %% Whitespace loop
    WS --> WS: "whitespace"
    WS --> CL: "COLON"
    WS --> TX: "other"
    WS --> BR: "{}"
    
    %% Block handling
    BR --> BR: "{"
    BR --> OK: "}"
    BR --> CL: "COLON"
    BR --> WS: "whitespace"
    
    note right of GO
        Initial state
    end note
    
    note right of CL
        After colon
    end note
    
    note right of NM
        Reading name
    end note
    
    note right of ID
        Reading type
    end note
    
    note right of QT
        Reading quantifier
    end note
Loading

The initial implemtation of state transition machine, which will replaces the current naive lexer implementation. This is a drop-in replacement for the existing lexer. No changes required in the parser or other components for now.

@notJoon notJoon added the T-fixer Type: Auto fix label Jan 18, 2025
@notJoon notJoon merged commit ac21b4c into main Jan 19, 2025
5 checks passed
@notJoon notJoon deleted the state-machine branch January 19, 2025 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-fixer Type: Auto fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant