diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index 83edff53..314ebc1b 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -58,9 +58,10 @@ Addendum (2025‑09‑26 2nd half) - [x] テストランナー: 出力ノイズの共通フィルタ化(filter_noise) 次アクション -- [ ] Step‑2: primary.rs を TokenCursor 経路へ寄せる(ラッパ+内部実装の段階移行) -- [ ] Step‑2: compare/logic/term までを一括寄せ → quick/core 再実行 -- [ ] Step‑3: 旧来 skip 系の参照数ゼロを確認 → 段階撤去 PR を用意 +- [x] Step‑2: primary/postfix/new/unary(−/not/await) を TokenCursor 経路へ寄せる(env トグル配下) +- [x] Step‑2: parity 代表(優先順位/単項)を追加し VM↔LLVM 整合を確認 +- [ ] Step‑3: statements 側の薄いラッパ導入(env トグル時のみ Cursor を用いた if/loop/print/local/return の最小経路) +- [ ] Step‑3: 旧来 skip 系(common.rs/depth_tracking.rs/parser_enhanced.rs)参照ゼロ確認→段階撤去 --- diff --git a/src/mir/builder/phi.rs b/src/mir/builder/phi.rs index 51d7ab48..d5ca3113 100644 --- a/src/mir/builder/phi.rs +++ b/src/mir/builder/phi.rs @@ -109,7 +109,7 @@ impl MirBuilder { /// `skip_var` allows skipping a variable already merged elsewhere (e.g., bound to an expression result). pub(super) fn merge_modified_vars( &mut self, - then_block: super::BasicBlockId, + _then_block: super::BasicBlockId, else_block: super::BasicBlockId, then_exit_block: super::BasicBlockId, else_exit_block_opt: Option, diff --git a/src/parser/common.rs b/src/parser/common.rs index 7ddb5fdf..dc5ea543 100644 --- a/src/parser/common.rs +++ b/src/parser/common.rs @@ -96,7 +96,10 @@ pub trait ParserUtils { false } - /// 内部用改行スキップ(再帰防止) +/// 内部用改行スキップ(再帰防止) +/// +/// LEGACY NOTE (Phase 15.5): 改行処理は TokenCursor での一元管理へ移行中。 +/// 既存パスの互換維持のため残置。参照ゼロ後に撤去予定。 fn skip_newlines_internal(&mut self) { let allow_sc = std::env::var("NYASH_PARSER_ALLOW_SEMICOLON").ok().map(|v| { let lv = v.to_ascii_lowercase(); @@ -115,6 +118,8 @@ pub trait ParserUtils { } /// NEWLINEトークンをスキップ + /// + /// LEGACY NOTE: 直接の呼び出しは推奨しない。TokenCursor への移行を優先。 fn skip_newlines(&mut self) { let allow_sc = std::env::var("NYASH_PARSER_ALLOW_SEMICOLON").ok().map(|v| { let lv = v.to_ascii_lowercase(); diff --git a/src/parser/depth_tracking.rs b/src/parser/depth_tracking.rs index 7d1bb992..688e0bbf 100644 --- a/src/parser/depth_tracking.rs +++ b/src/parser/depth_tracking.rs @@ -1,7 +1,12 @@ +#![allow(dead_code)] /*! * 深度追跡機能 - Smart advance用 * * 括弧の深度を追跡し、改行の自動スキップを判定 + * + * LEGACY (Phase 15.5): + * - 改行/深度の判定は TokenCursor に一元化していく方針。 + * - 互換維持のため当面残置(参照ゼロ後に撤去予定)。 */ use super::{NyashParser, ParserUtils}; @@ -121,4 +126,4 @@ impl ParserUtils for NyashParser { false } -} \ No newline at end of file +} diff --git a/src/parser/parser_enhanced.rs b/src/parser/parser_enhanced.rs index 4560f6dc..3cfb6779 100644 --- a/src/parser/parser_enhanced.rs +++ b/src/parser/parser_enhanced.rs @@ -1,8 +1,13 @@ +#![allow(dead_code)] /*! * Parser Enhanced - 既存パーサーの改行処理自動化 * * 既存のNyashParserを拡張し、advance()で自動的に改行をスキップ * skip_newlines()の明示的呼び出しを不要にする + * + * LEGACY (Phase 15.5): + * - TokenCursor による改行/深度の一元管理へ移行中。 + * - 本モジュールは互換維持のため一時残置(参照ゼロ後に撤去予定)。 */ use crate::tokenizer::{Token, TokenType}; @@ -197,4 +202,4 @@ pub trait EnhancedParserUtils { fn parse_in_block_context(&mut self, f: F) -> T where F: FnOnce(&mut Self) -> T; -} \ No newline at end of file +} diff --git a/tools/smokes/v2/profiles/quick/core/arithmetic_precedence_unary.sh b/tools/smokes/v2/profiles/quick/core/arithmetic_precedence_unary.sh new file mode 100644 index 00000000..42bbc969 --- /dev/null +++ b/tools/smokes/v2/profiles/quick/core/arithmetic_precedence_unary.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# arithmetic_precedence_unary.sh - 単項と優先順位の基本チェック + +source "$(dirname "$0")/../../../lib/test_runner.sh" +source "$(dirname "$0")/../../../lib/result_checker.sh" + +require_env || exit 2 +preflight_plugins || exit 2 + +test_unary_precedence() { + local script=' +print(-(1 + 2) * 3) +print(1 + -2) +' + local out + out=$(run_nyash_vm -c "$script" 2>&1) + # 期待: -9 と -1 の2行 + if echo "$out" | grep -q "^-9$" && echo "$out" | grep -q "^-1$"; then + return 0 + else + echo "[FAIL] unary_precedence: output mismatch" >&2 + echo " Actual output:" >&2 + echo "$out" | sed 's/^/ /' >&2 + return 1 + fi +} + +run_test "unary_precedence" test_unary_precedence +