From: PR #feat/mds-three-enhancements (2026-05-16)
Deferred: Not modified in PR; complex refactoring of stateful character loop
Details
parse_args_inner at src/parser.rs:634-692 spans 59 lines with 4-level nesting and implements a stateful character-by-character parser:
- String escape handling (backslash sequences)
- Parenthesis depth tracking
- In-string flag state
- Argument boundary detection
Why Deferred
The refactoring is not safe as a one-pass extraction during this PR because:
- Changes were not made to this function in the current review
- Restructuring the loop requires careful state management (escape flags, depth)
- Extraction risk is moderate-to-high for behavioral regression
- Best extracted as a separate PR with targeted test coverage
Suggested Approach
- Extract
parse_loop_state struct to hold (in_string, escape_pending, paren_depth)
- Extract loop body into helper function accepting mutable state
- Add tests for edge cases: nested parens, escaped quotes, mixed depths
- Consider builder pattern or state machine for clarity
Related
- Similar pattern found in Lexer's string handling (potential shared refactoring)
Co-Authored-By: Claude noreply@anthropic.com
From: PR #feat/mds-three-enhancements (2026-05-16)
Deferred: Not modified in PR; complex refactoring of stateful character loop
Details
parse_args_innerat src/parser.rs:634-692 spans 59 lines with 4-level nesting and implements a stateful character-by-character parser:Why Deferred
The refactoring is not safe as a one-pass extraction during this PR because:
Suggested Approach
parse_loop_statestruct to hold (in_string, escape_pending, paren_depth)Related
Co-Authored-By: Claude noreply@anthropic.com