cleanup(parser): mark legacy newline paths with allow(dead_code) and LEGACY notes; fix unused param warning in phi.rs; update CURRENT_TASK for Step‑3 plan
This commit is contained in:
@ -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)参照ゼロ確認→段階撤去
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -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<super::BasicBlockId>,
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
#![allow(dead_code)]
|
||||
/*!
|
||||
* 深度追跡機能 - Smart advance用
|
||||
*
|
||||
* 括弧の深度を追跡し、改行の自動スキップを判定
|
||||
*
|
||||
* LEGACY (Phase 15.5):
|
||||
* - 改行/深度の判定は TokenCursor に一元化していく方針。
|
||||
* - 互換維持のため当面残置(参照ゼロ後に撤去予定)。
|
||||
*/
|
||||
|
||||
use super::{NyashParser, ParserUtils};
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
#![allow(dead_code)]
|
||||
/*!
|
||||
* Parser Enhanced - 既存パーサーの改行処理自動化
|
||||
*
|
||||
* 既存のNyashParserを拡張し、advance()で自動的に改行をスキップ
|
||||
* skip_newlines()の明示的呼び出しを不要にする
|
||||
*
|
||||
* LEGACY (Phase 15.5):
|
||||
* - TokenCursor による改行/深度の一元管理へ移行中。
|
||||
* - 本モジュールは互換維持のため一時残置(参照ゼロ後に撤去予定)。
|
||||
*/
|
||||
|
||||
use crate::tokenizer::{Token, TokenType};
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user