feat(joinir): Phase 46 - P2-Mid canonical Normalized promotion
Promote P2-Mid patterns (_atoi real, _parse_number real) to canonical
Normalized→MIR(direct) route, completing P2 line transition.
Canonical set expansion (Phase 41 → Phase 46):
- P2-Core: Pattern2Mini, skip_ws mini/real, atoi mini
- P2-Mid: atoi real, parse_number real (NEW)
All JsonParser P2 loops (_skip_whitespace, _atoi, _parse_number) now
canonical Normalized - Structured→MIR is legacy/comparison-only.
Key changes:
- shape_guard.rs: Expanded is_canonical_shape() (+2 patterns)
- JsonparserAtoiReal
- JsonparserParseNumberReal
- Made NormalizedDevShape enum public
- bridge.rs: Updated canonical routing comments (Phase 41 → 46)
- normalized.rs: Made shape_guard module public
- normalized_joinir_min.rs: Added Phase 46 canonical verification test
- phase46-norm-canon-p2-mid.md: Complete design documentation
Out of scope (deferred):
- P3/P4 Normalized support → NORM-P3/NORM-P4 phases
- Selfhost complex loops → separate phases
Benefits:
- Clear P2 boundary: All JsonParser P2 = Normalized canonical
- Infrastructure validation: Phase 43/245B proven production-ready
- Simplified mental model: P2 = Normalized-first, P3/P4 = future
Tests: 937/937 PASS (lib), 20/20 PASS (normalized_dev feature)
Phase 46 test: test_phase46_canonical_set_includes_p2_mid ✅
This commit is contained in:
@ -19,7 +19,7 @@ pub enum ShapeCapabilityKind {
|
||||
/// P2 Mid: _parse_number real (p + num_str + result)
|
||||
P2MidParseNumber,
|
||||
|
||||
/// Future: Other P2 patterns
|
||||
// Future: Other P2 patterns
|
||||
// P2MidAtOfLoop,
|
||||
// P2HeavyString,
|
||||
}
|
||||
@ -42,7 +42,7 @@ impl ShapeCapability {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum NormalizedDevShape {
|
||||
pub enum NormalizedDevShape {
|
||||
Pattern1Mini,
|
||||
Pattern2Mini,
|
||||
JsonparserSkipWsMini,
|
||||
@ -109,15 +109,25 @@ pub fn capability_for_shape(shape: &NormalizedDevShape) -> ShapeCapability {
|
||||
ShapeCapability::new(kind)
|
||||
}
|
||||
|
||||
/// Phase 44: Check if shape is canonical P2-Core (shape-level check)
|
||||
/// Phase 46: Canonical shapes that ALWAYS use Normalized→MIR(direct)
|
||||
/// regardless of feature flags or mode.
|
||||
///
|
||||
/// Phase 41 canonical set (exact): Pattern2Mini, skip_ws (mini/real), atoi mini.
|
||||
/// Excludes: Pattern1Mini, atoi real, parse_number real.
|
||||
/// Canonical set (Phase 46):
|
||||
/// - P2-Core: Pattern2Mini, JsonparserSkipWsMini, JsonparserSkipWsReal, JsonparserAtoiMini
|
||||
/// - P2-Mid: JsonparserAtoiReal, JsonparserParseNumberReal
|
||||
///
|
||||
/// P3/P4 patterns are NOT canonical (deferred to NORM-P3/NORM-P4 phases).
|
||||
pub fn is_canonical_shape(shape: &NormalizedDevShape) -> bool {
|
||||
use NormalizedDevShape::*;
|
||||
matches!(
|
||||
shape,
|
||||
Pattern2Mini | JsonparserSkipWsMini | JsonparserSkipWsReal | JsonparserAtoiMini
|
||||
Pattern2Mini
|
||||
| JsonparserSkipWsMini
|
||||
| JsonparserSkipWsReal
|
||||
| JsonparserAtoiMini
|
||||
// Phase 46: Add P2-Mid patterns
|
||||
| JsonparserAtoiReal
|
||||
| JsonparserParseNumberReal
|
||||
)
|
||||
}
|
||||
|
||||
@ -137,8 +147,13 @@ pub fn is_supported_by_normalized(cap: &ShapeCapability) -> bool {
|
||||
}
|
||||
|
||||
/// canonical(常時 Normalized 経路を通す)対象。
|
||||
/// Phase 41: P2 コアセット(P2 mini + JP skip_ws mini/real + JP atoi mini)。
|
||||
/// Phase 44: Capability-based filtering (backward compatible)。
|
||||
/// Phase 46: Extract canonical shapes from JoinModule.
|
||||
///
|
||||
/// Canonical set (P2-Core + P2-Mid):
|
||||
/// - Pattern2Mini, skip_ws mini/real, atoi mini/real, parse_number real
|
||||
///
|
||||
/// These shapes ALWAYS use Normalized→MIR(direct) regardless of mode.
|
||||
/// P3/P4 patterns are NOT canonical (future NORM-P3/NORM-P4 phases).
|
||||
pub(crate) fn canonical_shapes(module: &JoinModule) -> Vec<NormalizedDevShape> {
|
||||
let shapes: Vec<_> = detect_shapes(module)
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user