feat: 改行処理革命Phase 2-B完了 - Box宣言系skip_newlines()完全削除

 **41%削減達成**: 48→35→21箇所(14箇所削除)
- fields.rs: 9箇所のskip_newlines()削除
- box_definition.rs: 3箇所削除
- static_box.rs: 2箇所削除

 **Smart advance()実用化**: 深度追跡で自動改行処理完璧機能
- Box宣言、match式OR、複数行構文すべて対応
- NYASH_SMART_ADVANCE=1で安定動作確認

🔧 **ORパターンバグ同時修正**: exprs_peek.rsでInteger/Boolean型マッチング実装
- 修正前: 1 | 2 => "found" が動作せず(String型のみ)
- 修正後: 全リテラル型(Integer/Bool/Float/Null/Void)完全対応

🎉 **技術的価値**: 手動skip依存→コンテキスト認識自動処理への移行成功

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Selfhosting Dev
2025-09-23 11:22:16 +09:00
parent 536e64441a
commit ad62066172
5 changed files with 45 additions and 54 deletions

View File

@ -75,25 +75,31 @@ impl super::MirBuilder {
// In current dispatch block, compare and branch
self.start_new_block(cur_dispatch)?;
if let LiteralValue::String(s) = label {
let lit_id = self.value_gen.next();
self.emit_instruction(super::MirInstruction::Const {
dst: lit_id,
value: super::ConstValue::String(s),
})?;
let cond_id = self.value_gen.next();
self.emit_instruction(super::MirInstruction::Compare {
dst: cond_id,
op: super::CompareOp::Eq,
lhs: scr_val,
rhs: lit_id,
})?;
self.emit_instruction(super::MirInstruction::Branch {
condition: cond_id,
then_bb: then_block,
else_bb: else_target,
})?;
}
let lit_id = self.value_gen.next();
let const_value = match label {
LiteralValue::String(s) => super::ConstValue::String(s),
LiteralValue::Integer(i) => super::ConstValue::Integer(i),
LiteralValue::Bool(b) => super::ConstValue::Bool(b),
LiteralValue::Float(f) => super::ConstValue::Float(f),
LiteralValue::Null => super::ConstValue::Null,
LiteralValue::Void => super::ConstValue::Void,
};
self.emit_instruction(super::MirInstruction::Const {
dst: lit_id,
value: const_value,
})?;
let cond_id = self.value_gen.next();
self.emit_instruction(super::MirInstruction::Compare {
dst: cond_id,
op: super::CompareOp::Eq,
lhs: scr_val,
rhs: lit_id,
})?;
self.emit_instruction(super::MirInstruction::Branch {
condition: cond_id,
then_bb: then_block,
else_bb: else_target,
})?;
// then arm
self.start_new_block(then_block)?;