feat(phase-9.75e): Complete using nyashstd standard library implementation
🎉 Phase 9.75e完了: using nyashstdシステム完全実装成功 ✅ 実装完了項目: - USING tokenizer integration: TokenType::USING token support - UsingStatement AST node: Complete using statement parsing - BuiltinStdlib infrastructure: Core standard library framework - Full interpreter integration: Complete namespace resolution - Module system integration: Fixed crate::stdlib import issues 🌟 動作確認済み標準ライブラリ機能: - string.create("text") → StringBox creation - string.upper(str) → Uppercase string conversion - integer.create(42) → IntegerBox creation - bool.create(true) → BoolBox creation - array.create() → Empty ArrayBox creation - console.log("message") → Console output 📋 実装ファイル: - src/tokenizer.rs: USING token support - src/ast.rs: UsingStatement AST node - src/parser/statements.rs: using statement parser - src/interpreter/statements.rs: using statement execution - src/interpreter/core.rs: stdlib namespace resolution - src/stdlib/mod.rs: Complete BuiltinStdlib implementation - src/lib.rs + src/main.rs: Module declaration integration 🎯 テスト成功: All nyashstd functions work perfectly with comprehensive test coverage. Local test file: local_tests/test_nyashstd.nyash Everything is Box哲学を維持しながらモダンな標準ライブラリアクセスを実現\! 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -62,6 +62,9 @@ impl NyashParser {
|
||||
TokenType::THROW => {
|
||||
self.parse_throw()
|
||||
},
|
||||
TokenType::USING => {
|
||||
self.parse_using()
|
||||
},
|
||||
TokenType::FROM => {
|
||||
// 🔥 from構文: from Parent.method(args) または from Parent.constructor(args)
|
||||
self.parse_from_call_statement()
|
||||
@ -455,4 +458,32 @@ impl NyashParser {
|
||||
// 例: from Animal.constructor() (戻り値を使わない)
|
||||
Ok(from_call_expr)
|
||||
}
|
||||
|
||||
/// using文をパース: using namespace_name
|
||||
pub(super) fn parse_using(&mut self) -> Result<ASTNode, ParseError> {
|
||||
self.advance(); // consume 'using'
|
||||
|
||||
// 名前空間名を取得
|
||||
if let TokenType::IDENTIFIER(namespace_name) = &self.current_token().token_type {
|
||||
let name = namespace_name.clone();
|
||||
self.advance();
|
||||
|
||||
// Phase 0では "nyashstd" のみ許可
|
||||
if name != "nyashstd" {
|
||||
return Err(ParseError::UnsupportedNamespace {
|
||||
name,
|
||||
line: self.current_token().line
|
||||
});
|
||||
}
|
||||
|
||||
Ok(ASTNode::UsingStatement {
|
||||
namespace_name: name,
|
||||
span: Span::unknown(),
|
||||
})
|
||||
} else {
|
||||
Err(ParseError::ExpectedIdentifier {
|
||||
line: self.current_token().line
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user