Expand description
The {name} step matcher: cucumber-expression-style patterns binding Gherkin
prose to macros (TECH-SPEC §4.3).
A pattern is literal text with {name} captures (I search for {term}).
Matching is anchored and leftmost: literals must appear in order (the
whole text must be consumed), and each capture extends to the leftmost
occurrence of the next literal. Captured values are trimmed; a value wrapped
in symmetric double or single quotes sheds them (quotes preserve inner
spaces and commas exactly).
Guard rails (pattern_problems, run at pack load — validation pass 1):
a pattern must contain literal text to anchor on, adjacent captures are
rejected (the single-pass matcher cannot split them), braces must be
balanced, and every capture must name a declared param.
Enums§
- Pattern
Problem - One problem found in a
match:pattern (validation pass 1), typed so each maps to a stable diagnostic code. - Token
- One token of a
match:pattern.
Functions§
- closest
- The candidate closest to
inputby edit distance, within the shared “did you mean” threshold.Nonewhen nothing is close. - levenshtein
- Levenshtein edit distance over chars (small inputs; O(a·b) rolling row).
- literal_
skeleton - The literal skeleton of a pattern (captures dropped) — the comparison basis for closest-pattern suggestions on unbound steps.
- match_
pattern - Match
textagainstpattern, returning the captured args, orNonewhen the pattern does not apply. Total: never panics, any inputs. - near_
duplicate_ macros - Group pattern macros that differ only in their captures — i.e. share a
literal_skeleton. Returns, for each such macro, the sorted names of its near-duplicate siblings. Pure and deterministic (sorted throughout); the caller (proef macros) surfaces it as an authoring advisory, never a gate. - pattern_
problems - The problems found in a
match:pattern (validation pass 1); empty = sound. - prefix_
rank - Rank
patternagainst the partially-typed prosetyped, for completion ordering. Lower sorts first: the returned tuple is(tier, tiebreak). - tokenize
- Split a pattern into
Tokens. An unclosed{degrades the remainder into a literal —pattern_problemsrejects it at load; the matcher stays total.