feat: using ブレース均等解明完了&環境変数簡略化戦略策定

🎯 using ブレース均等の正体完全解明:
- SeamInspector.report()のprelude_brace_delta計算を解析
- "static box Main {" より前のブレース{/}バランス検証
- usingシステムでファイル結合時の整合性チェック機能と判明

📝 環境変数地獄(8変数)の簡略化戦略策定:
- Phase 1: NYASH_ENABLE_USING, NYASH_RESOLVE_FIX_BRACESデフォルト化
- Phase 2: PyVM/ny_plugins安定化後の段階的デフォルト化
- Phase 3: デバッグ変数のCLIフラグ化(--debug-pyvm等)
- 理想形: 8変数→0変数(./target/release/nyash program.nyash)

🔧 skip_newlines()削除革命継続:
- TokenCursor v2パーサー実装(nyash_parser_v2.rs新規)
- 既存パーサー拡張版(parser_enhanced.rs)
- Smart advance()とTokenCursorの協調実装

📚 次の課題:
- 環境変数デフォルト化の段階的実装
- using systemの完全安定化
- codex協働でのデバッグ効率化

🤖 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:58:31 +09:00
parent 9b801de98d
commit bbc581a07f
10 changed files with 469 additions and 20 deletions

View File

@ -34,7 +34,6 @@ pub(crate) fn parse_header(
p.advance();
if p.match_token(&TokenType::COMMA) {
p.advance();
p.skip_newlines();
}
} else {
return Err(ParseError::UnexpectedToken {
@ -66,7 +65,6 @@ pub(crate) fn parse_header(
}
while p.match_token(&TokenType::COMMA) {
p.advance(); // consume ','
p.skip_newlines();
if let TokenType::IDENTIFIER(parent) = &p.current_token().token_type {
parents.push(parent.clone());
p.advance();

View File

@ -25,12 +25,10 @@ pub(crate) fn parse_interface_box(p: &mut NyashParser) -> Result<ASTNode, ParseE
};
p.consume(TokenType::LBRACE)?;
p.skip_newlines(); // ブレース後の改行をスキップ
let mut methods = HashMap::new();
while !p.match_token(&TokenType::RBRACE) && !p.is_at_end() {
p.skip_newlines(); // ループ開始時に改行をスキップ
if let TokenType::IDENTIFIER(method_name) = &p.current_token().token_type {
let method_name = method_name.clone();
p.advance();
@ -64,9 +62,6 @@ pub(crate) fn parse_interface_box(p: &mut NyashParser) -> Result<ASTNode, ParseE
};
methods.insert(method_name, method_decl);
// メソッド宣言後の改行をスキップ
p.skip_newlines();
} else {
let line = p.current_token().line;
return Err(ParseError::UnexpectedToken {

View File

@ -36,7 +36,6 @@ pub(crate) fn try_parse_constructor(
}
p.consume(TokenType::RPAREN)?;
let mut body = p.parse_block_statements()?;
p.skip_newlines();
// Optional postfix catch/cleanup (method-level gate)
if p.match_token(&TokenType::CATCH) || p.match_token(&TokenType::CLEANUP) {
let mut catch_clauses: Vec<crate::ast::CatchClause> = Vec::new();
@ -52,7 +51,6 @@ pub(crate) fn try_parse_constructor(
body: catch_body,
span: Span::unknown(),
});
p.skip_newlines();
if p.match_token(&TokenType::CATCH) {
let line = p.current_token().line;
return Err(ParseError::UnexpectedToken {

View File

@ -30,7 +30,6 @@ pub(crate) fn wrap_with_optional_postfix(
body: catch_body,
span: Span::unknown(),
});
p.skip_newlines();
if p.match_token(&TokenType::CATCH) {
let line = p.current_token().line;
return Err(ParseError::UnexpectedToken {
@ -78,7 +77,6 @@ pub(crate) fn try_parse_method_postfix_after_last_method(
body: catch_body,
span: Span::unknown(),
});
p.skip_newlines();
if p.match_token(&TokenType::CATCH) {
let line = p.current_token().line;
return Err(ParseError::UnexpectedToken {

View File

@ -129,7 +129,6 @@ pub(crate) fn try_parse_block_first_property(
}
// 1) Parse block body first
let mut final_body = p.parse_block_statements()?;
p.skip_newlines();
// 2) Expect 'as'
if let TokenType::IDENTIFIER(kw) = &p.current_token().token_type {