🚀 feat: ":"継承演算子実装+全14Box型の包括的ドキュメント化完成

## 🔧 言語機能改善
- from予約語問題を解決する":"継承演算子を実装
- box Child : Parent 構文でより直感的な継承表現
- tokenizer/parserを更新、from を変数名として使用可能に

## 📚 ドキュメント大改善(1000行以上追加)
全14Box型に包括的なJavaDoc風ドキュメントを追加:
- StringBox: 文字列操作メソッド群
- IntegerBox/BoolBox: 基本データ型と演算子
- MathBox/RandomBox/TimeBox: 計算・ユーティリティ
- ConsoleBox/DebugBox/SoundBox: システムIO
- MapBox/NullBox: データ構造
- EguiBox: デスクトップGUI
- SimpleIntentBox: P2P通信

各Boxに概要・メソッド一覧・使用例・実用例・注意事項を完備

## 🧹 プロジェクト整理
- ルートディレクトリから60個のテストファイルを削除
  (development/root_tests/に移動済み)
- 不要ファイル削除: bmp, tar.xz, html, 空フォルダ等
- examplesフォルダへ適切なファイルを移動

## 📝 その他の更新
- CLAUDE.md: パーサーデバッグ機能の説明追加
- sessions/: AI相談記録2件を保存
  - from予約語問題の解決策検討
  - 標準Box型(ArrayBox等)の設計相談
This commit is contained in:
Moe Charm
2025-08-10 11:32:32 +09:00
parent e7f6666917
commit ccb3204a35
89 changed files with 1536 additions and 3027 deletions

View File

@ -1,8 +1,87 @@
/*!
* Nyash Null Box - Null value representation
/*! 🚫 NullBox - NULL値表現Box
*
* null値を表現するBox型
* Everything is Box哲学に基づくnull実装
* ## 📝 概要
* null/void値を表現する特別なBox。
* JavaScript null、Python None、C# nullと同等の機能を提供。
* NULL安全プログラミングをサポート。
*
* ## 🛠️ 利用可能メソッド
* - `isNull()` - null判定 (常にtrue)
* - `isNotNull()` - 非null判定 (常にfalse)
* - `toString()` - 文字列変換 ("null")
* - `equals(other)` - 等価比較 (他のnullとのみtrue)
*
* ## 🛡️ 静的メソッド (null安全機能)
* - `NullBox.checkNull(value)` - 値のnull判定
* - `NullBox.checkNotNull(value)` - 値の非null判定
* - `NullBox.getOrDefault(value, default)` - null時デフォルト値取得
*
* ## 💡 使用例
* ```nyash
* local user, name, default_name
*
* // null値の作成と判定
* user = null
* if (user == null) {
* print("User is null")
* }
*
* // null安全な値取得
* name = getUsername() // null の可能性
* default_name = NullBox.getOrDefault(name, "Anonymous")
* print("Hello, " + default_name)
* ```
*
* ## 🎮 実用例 - null安全プログラミング
* ```nyash
* static box UserManager {
* init { current_user }
*
* main() {
* me.current_user = null
*
* // null安全なログイン処理
* me.loginUser("alice")
* me.displayUserInfo()
* }
*
* loginUser(username) {
* if (username == null or username == "") {
* print("Error: Invalid username")
* return
* }
* me.current_user = new User(username)
* }
*
* displayUserInfo() {
* if (me.current_user == null) {
* print("No user logged in")
* } else {
* print("Current user: " + me.current_user.name)
* }
* }
* }
* ```
*
* ## 🔍 デバッグ活用
* ```nyash
* local data, result
* data = fetchDataFromAPI() // null になる可能性
*
* // null チェック付きデバッグ
* if (NullBox.checkNull(data)) {
* print("Warning: API returned null data")
* result = NullBox.getOrDefault(data, "default_data")
* } else {
* result = data.process()
* }
* ```
*
* ## ⚠️ 重要な特徴
* - `null == null` は常にtrue
* - `null.toString()` は "null"
* - 全てのNullBoxインスタンスは論理的に等価
* - メソッド呼び出し時のnullチェックでNullPointerException防止
*/
use crate::box_trait::{NyashBox, StringBox, BoolBox};