Skip to main content

Module matcher

Module matcher 

Source
Expand description

Patch-specific line-sequence matcher ported from the TypeScript apply_patch engine.

This module intentionally does not reuse fuzzy_match: edit matching works in byte ranges, while apply_patch needs line indexes, EOF anchoring, and unique-only reflow.

Structs§

SequenceMatch

Enums§

MatchTier

Constants§

REFLOW_NON_WS_TOLERANCE
Allow candidate reflow windows to differ by up to eight non-whitespace characters before exact normalized comparison.

Functions§

find_reflow_match
Find one unique whitespace-reflowed window, returning (found_line, line_count); mirrors patch-parser.ts:310-351.
has_reflow_content
Return true when a line has any non-whitespace content; mirrors patch-parser.ts:241-243.
normalize_indent
Replace a leading run of tabs and spaces with the same number of plain spaces; mirrors patch-parser.ts:227-229.
normalize_reflow_whitespace
Collapse every Unicode whitespace run to one space and trim the ends; mirrors patch-parser.ts:233-235.
normalize_unicode
Convert smart quotes, dash variants, ellipsis, and NBSP to their ASCII forms; mirrors patch-parser.ts:207-214.
seek_sequence_tiered
Run the first-hit-wins Exact/Rstrip/Trim/Indent/Unicode/Reflow ladder; mirrors patch-parser.ts:353-399.
strip_reflow_whitespace
Remove every Unicode whitespace character; mirrors patch-parser.ts:237-239.
try_match
Search for a full pattern with a caller-supplied comparator, optionally anchored at EOF; mirrors patch-parser.ts:247-281.