1.2 KiB
1.2 KiB
Pattern6/7 Contracts (SSOT)
This document defines the contract boundary for Pattern6/7 extractors.
It is the SSOT for NotApplicable vs Freeze decisions.
Common Rule
- NotApplicable: shape mismatch (another pattern may apply)
- Freeze: shape matches but contract is violated (fail-fast)
Tags:
- Pattern6:
[joinir/phase29ab/pattern6/contract] - Pattern7:
[joinir/phase29ab/pattern7/contract]
Pattern6 (ScanWithInit / MatchScan)
Accepted shape:
loop(i < s.length())orloop(i <= s.length() - needle.length())if s.substring(i, i + 1) == needle { return i }- step update exists and matches direction
Freeze conditions:
- step update missing
- forward scan with step !=
i = i + 1 - reverse scan with step !=
i = i - 1Note: - plan line supports reverse scan (cond:
i >= 0, step:i = i - 1)
Pattern7 (SplitScan)
Accepted shape:
loop(i <= s.length() - separator.length())if s.substring(i, i + separator.length()) == separator- then:
result.push(...),start = i + separator.length(),i = start - else:
i = i + 1
Freeze conditions:
- then/else update contracts broken (start/i updates)
- separator literal length != 1 (P0 scope)