nadesiko3 3.7.25 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/batch/build_nako_version.nako3 +2 -4
  2. package/batch/command.txt +24 -36
  3. package/batch/pickup_command.nako3 +7 -8
  4. package/core/batch/build_nako_version.nako3 +1 -2
  5. package/core/package.json +1 -1
  6. package/core/src/nako_core_version.mjs +3 -3
  7. package/core/src/nako_core_version.mts +3 -3
  8. package/core/src/nako_gen.mjs +1 -1
  9. package/core/src/nako_gen.mts +1 -1
  10. package/core/src/nako_parser3.mjs +85 -20
  11. package/core/src/nako_parser3.mts +81 -18
  12. package/core/src/plugin_system.mjs +1 -1
  13. package/core/src/plugin_system.mts +1 -1
  14. package/core/src/plugin_system_json.mjs +0 -24
  15. package/core/src/plugin_system_json.mts +0 -24
  16. package/core/src/plugin_system_timer.mjs +0 -11
  17. package/core/src/plugin_system_timer.mts +0 -11
  18. package/core/test/array_test.mjs +4 -0
  19. package/core/test/calc_test.mjs +12 -0
  20. package/core/test/core_module_test.mjs +4 -0
  21. package/core/test/error_message_test.mjs +13 -0
  22. package/core/test/parser_hang_test.mjs +64 -0
  23. package/core/test/plugin_system_debug_test.mjs +1 -1
  24. package/core/test/plugin_system_test.mjs +4 -4
  25. package/doc/browser-tests.md +3 -5
  26. package/doc/command_list.json +24 -174
  27. package/doc/release.md +75 -38
  28. package/package.json +1 -1
  29. package/release/_hash.txt +32 -32
  30. package/release/_script-tags.txt +16 -16
  31. package/release/command.json +1 -1
  32. package/release/command.json.js +1 -1
  33. package/release/command_cnako3.json +1 -1
  34. package/release/command_list.json +1 -1
  35. package/release/edit_main.js +7 -7
  36. package/release/edit_main.js.map +2 -2
  37. package/release/editor.js +7 -7
  38. package/release/plugin_markup.js +36 -35
  39. package/release/plugin_markup.js.map +3 -3
  40. package/release/version.js +1 -1
  41. package/release/version_main.js +1 -1
  42. package/release/version_main.js.map +2 -2
  43. package/release/wnako3.js +162 -162
  44. package/release/wnako3.js.map +3 -3
  45. package/release/wnako3webworker.js +8 -8
  46. package/release/wnako3webworker.js.map +3 -3
  47. package/src/nako_version.mjs +3 -3
  48. package/src/nako_version.mts +3 -3
  49. package/src/plugin_browser_ajax.mjs +0 -99
  50. package/src/plugin_browser_ajax.mts +0 -88
  51. package/src/plugin_httpserver.mjs +53 -16
  52. package/src/plugin_httpserver.mts +47 -13
  53. package/src/plugin_node.mjs +0 -17
  54. package/src/plugin_node.mts +0 -17
  55. package/test/node/build_command_test.mjs +65 -1
  56. package/test/node/error_message_test.mjs +52 -40
  57. package/test/node/plugin_httpserver_test.mjs +51 -0
  58. package/test/node/plugin_markup_test.mjs +11 -14
  59. package/test/node/plugin_node_test.mjs +1 -1
  60. package/test/node/plugin_test.mjs +40 -3
  61. package/test/node/scope_assignment.nako3 +5 -0
  62. package/core/package-lock.json +0 -516
@@ -44,11 +44,10 @@ export default nakoVersion
44
44
    VSを保存先へ保存。
45
45
    「
46
46
  # ---------------------------------------------
47
- # ● なでしこのバージョン情報(src/nako_version.mts)を更新しました。
47
+ # ● なでしこのバージョン情報を更新しました。
48
48
  # version {VER}
49
49
  # file: {保存先}
50
- # ---------------------------------------------
51
- 」を表示。
50
+ 」をトリムして表示。
52
51
 
53
52
  ●コアバージョン更新とは:
54
53
    もし、メインバージョン=空ならば:
@@ -56,7 +55,6 @@ export default nakoVersion
56
55
    CORE_PACKAGE=「{基本パス}/core/package.json」
57
56
    CORE_PACKAGEを読んでJSONデコードして、Pに代入。
58
57
    VER=P@"version"
59
-   「★★コアバージョンを勝手に書き換えます!!」と表示。
60
58
    P@"version" = メインバージョン
61
59
    PをJSONエンコード整形してSに代入。
62
60
    CORE_PACKAGEにSを保存。
package/batch/command.txt CHANGED
@@ -311,9 +311,6 @@
311
311
  | 関数 | JSONエンコード | Vを/Vの | オブジェクトVをJSON形式に変換して返す(『JSON変換』と同じ) | JSONえんこーど | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_json.mts#L29
312
312
  | 関数 | JSONエンコード整形 | Vを/Vの | オブジェクトVをJSON形式の文字列(整形済み)に変換して整形して返す | JSONえんこーどせいけい | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_json.mts#L37
313
313
  | 関数 | JSONデコード | Sを/Sの/Sから | JSON文字列Sをオブジェクトにして返す(『JSON取得』と同じ) | JSONでこーど | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_json.mts#L45
314
- | 関数 | JSON_E | Vを/Vの | オブジェクトVをJSON形式の文字列に変換して返す(『JSON変換』と同じ) | JSON_E | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_json.mts#L53
315
- | 関数 | JSON_ES | Vを/Vの | オブジェクトVをJSON形式の文字列(整形済み)に変換して返す(『JSONエンコード整形』と同じ) | JSON_ES | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_json.mts#L61
316
- | 関数 | JSON_D | Sを/Sの/Sから | JSON文字列Sをオブジェクトにして返す(『JSON取得』と同じ) | JSON_D | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_json.mts#L69
317
314
  ●正規表現
318
315
  | 関数 | 正規表現マッチ | AをBで/AがBに | 文字列Aを正規表現パターンBでマッチして結果を返す(パターンBは「/pat/opt」の形式で指定。optにgの指定がなければ部分マッチが『抽出文字列』に入る) | せいきひょうげんまっち | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_regexp.mts#L13
319
316
  | 関数 | 正規表現抽出 | AからBで/Aを | 文字列Sを正規表現パターンREで正規表現マッチし、すべてのキャプチャグループ( )を一次元配列として返す。抽出文字列には二次元配列を返す | せいきひょうげんちゅうしゅつ | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_regexp.mts#L38
@@ -341,12 +338,11 @@
341
338
  ●タイマー
342
339
  | 関数 | 秒待 | N | N秒の間待機する(非同期関数) | びょうまつ | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L17
343
340
  | 関数 | 秒待機 | N | N秒の間待機する(『秒待』と同じ)(非同期関数) | びょうたいき | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L42
344
- | 関数 | 秒逐次待機 | N | (非推奨) 逐次実行構文にて、N秒の間待機する (廃止予定)(非同期関数) | びょうちくじたいき | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L53
345
- | 関数 | 秒後 | FをN | 無名関数(あるいは、文字列で関数名を指定)FをN秒後に実行する。変数『対象』にタイマーIDを代入する。 | びょうご | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L63
346
- | 関数 | 秒毎 | FをN | 無名関数(あるいは、文字列で関数名を指定)FをN秒ごとに実行する(『タイマー停止』で停止できる)。変数『対象』にタイマーIDを代入する。 | びょうごと | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L90
347
- | 関数 | 秒タイマー開始時 | FをN | 無名関数(あるいは、文字列で関数名を指定)FをN秒ごとに実行する(『秒毎』と同じ) | びょうたいまーかいししたとき | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L107
348
- | 関数 | タイマー停止 | TIMERIDの/TIMERIDで | 『秒毎』『秒後』や『秒タイマー開始』で開始したタイマーを停止する | たいまーていし | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L115
349
- | 関数 | 全タイマー停止 | | 『秒毎』『秒後』や『秒タイマー開始』で開始したタイマーを全部停止する | ぜんたいまーていし | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L136
341
+ | 関数 | 秒後 | FをN | 無名関数(あるいは、文字列で関数名を指定)FをN秒後に実行する。変数『対象』にタイマーIDを代入する。 | びょうご | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L52
342
+ | 関数 | 秒毎 | FをN | 無名関数(あるいは、文字列で関数名を指定)FをN秒ごとに実行する(『タイマー停止』で停止できる)。変数『対象』にタイマーIDを代入する。 | びょうごと | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L79
343
+ | 関数 | 秒タイマー開始時 | FをN | 無名関数(あるいは、文字列で関数名を指定)FをN秒ごとに実行する(『秒毎』と同じ) | びょうたいまーかいししたとき | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L96
344
+ | 関数 | タイマー停止 | TIMERIDの/TIMERIDで | 『秒毎』『秒後』や『秒タイマー開始』で開始したタイマーを停止する | たいまーていし | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L104
345
+ | 関数 | 全タイマー停止 | | 『秒毎』『秒後』や『秒タイマー開始』で開始したタイマーを全部停止する | ぜんたいまーていし | https://github.com/kujirahand/nadesiko3/blob/master/core/src/plugin_system_timer.mts#L125
350
346
 
351
347
 
352
348
  ■plugin_csv(基本プラグイン,wnako,cnako)
@@ -485,11 +481,6 @@
485
481
  | 関数 | AJAX内容取得 | RESからTYPEで | 「保証」を使った非同期通信(Ajax)の応答から内容を指定した形式で取り出すための非同期処理オブジェクト(Promise)を返す。 | AJAXないようしゅとく | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_ajax.mts#L319
486
482
  ●Blob
487
483
  | 関数 | BLOB作成 | DATAをOPTIONSで/DATAから | DATA(配列型)をOPTIONS(辞書型)でBlobオブジェクトを作成する。 | BLOBさくせい | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_ajax.mts#L345
488
- ●HTTPとAJAX(非推奨)
489
- | 関数 | AJAX逐次送信 | URLまで/URLへ/URLに | (非推奨)『AJAXテキスト取得』をご利用ください。- 逐次実行構文にて、非同期通信(Ajax)でURLにデータを送信する。成功すると『対象』にデータが代入される。 | AJAXちくじそうしん | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_ajax.mts#L355
490
- | 関数 | HTTP逐次取得 | URLの/URLから/URLを | (非推奨)『AJAXテキスト取得』をご利用ください。- 逐次実行構文にて、非同期通信(Ajax)でURLにデータを送信する。成功すると『対象』にデータが代入される。失敗すると『AJAX失敗時』を実行。 | HTTPちくじしゅとく | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_ajax.mts#L377
491
- | 関数 | POST逐次送信 | URLまでPARAMSを/URLへ/URLに | (非推奨)逐次実行構文にて、AjaxでURLにPARAMSをPOST送信し『対象』にデータを設定。失敗すると『AJAX失敗時』を実行。 | POSTちくじそうしん | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_ajax.mts#L387
492
- | 関数 | POSTフォーム逐次送信 | URLまでPARAMSを/URLへ/URLに | (非推奨)逐次実行構文にて、AjaxでURLにPARAMSをフォームとしてPOST送信し『対象』にデータを設定。失敗すると『AJAX失敗時』を実行。 | POSTふぉーむちくじそうしん | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_ajax.mts#L415
493
484
  ●DOM操作
494
485
  | 定数 | DOCUMENT | | '' | DOCUMENT | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dom_basic.mts#L5
495
486
  | 定数 | WINDOW | | '' | WINDOW | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dom_basic.mts#L6
@@ -872,34 +863,31 @@
872
863
  | 関数 | AJAXバイナリ取得 | URLから | AJAXでURLにアクセスしバイナリ(arrayBuffer)形式で結果を得る。送信時AJAXオプションの値を参照。(非同期関数) | AJAXばいなりしゅとく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1550
873
864
  | 関数 | DISCORD送信 | URLへSを/URLに | DISCORDのウェブフックURLにSのメッセージを送信する。宛先のウェブフックを取得しておく必要がある。(非同期関数) | DISCORDそうしん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1565
874
865
  | 関数 | DISCORDファイル送信 | URLへFとSを/URLに | DISCORDのウェブフックURLにファイルF(パスを指定)とメッセージSを送信する。(非同期関数) | DISCORDふぁいるそうしん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1585
875
- ●LINE
876
- | 関数 | LINE送信 | _TOKENへ_MESSAGEを/_TOKENに | LINEにメッセージを送信する。現在利用不可能。 | LINEそうしん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1608
877
- | 関数 | LINE画像送信 | _TOKENへ_IMAGEFILEと_MESSAGEを/_TOKENに | LINEにメッセージを送信する。先にLINE Notifyのページで宛先のトークンを取得する。TOKENへIMAGE_FILEとMESSAGEをLINE画像送信する。 | LINEがぞうそうしん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1616
878
866
  ●文字コード
879
- | 関数 | 文字コード変換サポート判定 | CODEの/CODEを | 文字コードCODEをサポートしているか確認 | もじこーどへんかんさぽーとはんてい | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1625
880
- | 関数 | SJIS変換 | STRに/STRへ/STRを | (v1非互換)文字列をShift_JISのバイナリバッファに変換 | SJISへんかん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1633
881
- | 関数 | SJIS取得 | BUFから/BUFを/BUFで | Shift_JISのバイナリバッファを文字列に変換 | SJISしゅとく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1642
882
- | 関数 | エンコーディング変換 | SをCODEへ/CODEで | 文字列SをCODEへ変換してバイナリバッファを返す | えんこーでぃんぐへんかん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1651
883
- | 関数 | エンコーディング取得 | BUFをCODEから/CODEで | バイナリバッファBUFをCODEから変換して返す | えんこーでぃんぐしゅとく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1660
867
+ | 関数 | 文字コード変換サポート判定 | CODEの/CODEを | 文字コードCODEをサポートしているか確認 | もじこーどへんかんさぽーとはんてい | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1608
868
+ | 関数 | SJIS変換 | STRに/STRへ/STRを | (v1非互換)文字列をShift_JISのバイナリバッファに変換 | SJISへんかん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1616
869
+ | 関数 | SJIS取得 | BUFから/BUFを/BUFで | Shift_JISのバイナリバッファを文字列に変換 | SJISしゅとく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1625
870
+ | 関数 | エンコーディング変換 | SをCODEへ/CODEで | 文字列SをCODEへ変換してバイナリバッファを返す | えんこーでぃんぐへんかん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1634
871
+ | 関数 | エンコーディング取得 | BUFをCODEから/CODEで | バイナリバッファBUFをCODEから変換して返す | えんこーでぃんぐしゅとく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1643
884
872
  ●ハッシュ関数
885
- | 関数 | ハッシュ関数一覧取得 | | 利用可能なハッシュ関数の一覧を返す | はっしゅかんすういちらんしゅとく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1670
886
- | 関数 | ハッシュ値計算 | SをALGのENCで | データSをアルゴリズムALG(sha256/sha512/md5)のエンコーディングENC(hex/base64)でハッシュ値を計算して返す | はっしゅちけいさん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1678
887
- | 関数 | ランダムUUID生成 | | ランダムに生成された36文字のv4 UUID(文字列)を返す | らんだむUUIDせいせい | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1688
888
- | 関数 | ランダム配列生成 | CNTの | 暗号強度の強い乱数のバイト配列(Uint8Array)を指定個数返す | らんだむはいれつせいせい | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1697
873
+ | 関数 | ハッシュ関数一覧取得 | | 利用可能なハッシュ関数の一覧を返す | はっしゅかんすういちらんしゅとく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1653
874
+ | 関数 | ハッシュ値計算 | SをALGのENCで | データSをアルゴリズムALG(sha256/sha512/md5)のエンコーディングENC(hex/base64)でハッシュ値を計算して返す | はっしゅちけいさん | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1661
875
+ | 関数 | ランダムUUID生成 | | ランダムに生成された36文字のv4 UUID(文字列)を返す | らんだむUUIDせいせい | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1671
876
+ | 関数 | ランダム配列生成 | CNTの | 暗号強度の強い乱数のバイト配列(Uint8Array)を指定個数返す | らんだむはいれつせいせい | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_node.mts#L1680
889
877
 
890
878
 
891
879
  ■plugin_httpserver(基本プラグイン,cnako)
892
880
  ●簡易HTTPサーバ
893
- | 定数 | HTTPメソッド | | '' | HTTPめそっど | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L350
894
- | 定数 | GETデータ | | '' | GETでーた | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L351
895
- | 定数 | POSTデータ | | '' | POSTでーた | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L352
896
- | 定数 | FILESデータ | | '' | FILESでーた | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L353
897
- | 関数 | 簡易HTTPサーバ起動時 | CALLBACKをPORTの/PORTで | ポート番号PORTを指定して簡易HTTPサーバを起動して、CALLBACKを実行する。 | かんいHTTPさーばきどうしたとき | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L358
898
- | 関数 | 簡易HTTPサーバ静的パス指定 | URLをPATHに/PATHへ | 静的コンテンツのパスを指定。URLをPATHへマップする。 | かんいHTTPさーばせいてきぱすしてい | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L380
899
- | 関数 | 簡易HTTPサーバ受信時 | CALLBACKをURLに/URLへ/URLで | URLを指定して合致するリクエストが来たら処理を実行する。 | かんいHTTPさーばじゅしんしたとき | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L395
900
- | 関数 | 簡易HTTPサーバ出力 | Sを/Sと/Sの | 受信時に、データSを出力する。 | かんいHTTPさーばしゅつりょく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L413
901
- | 関数 | 簡易HTTPサーバヘッダ出力 | NOでHEADを/HEADの/HEADと | 受信時にステータスコードNOで、ヘッダHEAD(辞書形式)を出力する。 | かんいHTTPさーばへっだしゅつりょく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L433
902
- | 関数 | 簡易HTTPサーバ移動 | URLへ/URLに | 受信時にヘッダ302(リダイレクト)を出力してURLへページを移動力する。 | かんいHTTPさーばいどう | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L450
881
+ | 定数 | HTTPメソッド | | '' | HTTPめそっど | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L379
882
+ | 定数 | GETデータ | | '' | GETでーた | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L380
883
+ | 定数 | POSTデータ | | '' | POSTでーた | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L381
884
+ | 定数 | FILESデータ | | '' | FILESでーた | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L382
885
+ | 関数 | 簡易HTTPサーバ起動時 | CALLBACKをPORTの/PORTで | ポート番号PORTを指定して簡易HTTPサーバを起動して、CALLBACKを実行する。 | かんいHTTPさーばきどうしたとき | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L387
886
+ | 関数 | 簡易HTTPサーバ静的パス指定 | URLをPATHに/PATHへ | 静的コンテンツのパスを指定。URLをPATHへマップする。 | かんいHTTPさーばせいてきぱすしてい | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L414
887
+ | 関数 | 簡易HTTPサーバ受信時 | CALLBACKをURLに/URLへ/URLで | URLを指定して合致するリクエストが来たら処理を実行する。 | かんいHTTPさーばじゅしんしたとき | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L429
888
+ | 関数 | 簡易HTTPサーバ出力 | Sを/Sと/Sの | 受信時に、データSを出力する。 | かんいHTTPさーばしゅつりょく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L447
889
+ | 関数 | 簡易HTTPサーバヘッダ出力 | NOでHEADを/HEADの/HEADと | 受信時にステータスコードNOで、ヘッダHEAD(辞書形式)を出力する。 | かんいHTTPさーばへっだしゅつりょく | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L467
890
+ | 関数 | 簡易HTTPサーバ移動 | URLへ/URLに | 受信時にヘッダ302(リダイレクト)を出力してURLへページを移動力する。 | かんいHTTPさーばいどう | https://github.com/kujirahand/nadesiko3/tree/master/src/plugin_httpserver.mts#L484
903
891
 
904
892
 
905
893
  ■plugin_markup(基本プラグイン,wnako,cnako)
@@ -58,15 +58,15 @@ CORE="core/src"
58
58
 
59
59
  #------------------------
60
60
  結果データ=「」
61
- SRC_URL=""
61
+ jsplugin2text__SRC_URL=""
62
62
  FILE_PATH=""
63
63
  #------------------------
64
64
  コアプラグイン一覧を反復
65
65
    PNAME=対象@0
66
-   カレントプラグイン="{CORE}/{PNAME}"
66
+   jsplugin2text__カレントプラグイン="{CORE}/{PNAME}"
67
67
    FILE_PATH="{基本パス}/{CORE}/{PNAME}"
68
68
    # (ex) https://github.com/kujirahand/nadesiko3/blob/master/core/src/nako3.mts#L81
69
-   SRC_URL="https://github.com/kujirahand/nadesiko3/blob/master/core/src/{PNAME}"
69
+   jsplugin2text__SRC_URL="https://github.com/kujirahand/nadesiko3/blob/master/core/src/{PNAME}"
70
70
    ナコタイプ=対象@1
71
71
    パスは「{基本パス}/{カレントプラグイン}」
72
72
    パスを「(基本プラグイン,{ナコタイプ})」でプラグイン要約作成
@@ -75,10 +75,10 @@ FILE_PATH=""
75
75
  #------------------------
76
76
  基本プラグイン一覧を反復
77
77
    PNAME=対象@0
78
-   カレントプラグイン=対象@0
78
+   jsplugin2text__カレントプラグイン=対象@0
79
79
    ナコタイプ=対象@1
80
80
    FILE_PATH="{基本パス}/{PNAME}"
81
-   SRC_URL="https://github.com/kujirahand/nadesiko3/tree/master/{PNAME}"
81
+   jsplugin2text__SRC_URL="https://github.com/kujirahand/nadesiko3/tree/master/{PNAME}"
82
82
    パスは「{基本パス}/{カレントプラグイン}」
83
83
    RRR=パスを「(基本プラグイン,{ナコタイプ})」でプラグイン要約作成
84
84
    もし、文字数(RRR)<50ならば:
@@ -88,14 +88,14 @@ FILE_PATH=""
88
88
  ここまで
89
89
  #------------------------
90
90
  拡張プラグイン一覧を反復
91
-   カレントプラグイン=それ@0
91
+   jsplugin2text__カレントプラグイン=それ@0
92
92
    ナコタイプ=それ@1
93
93
    パスは「{REPOSパス}/{カレントプラグイン}」
94
94
    FILE_PATH="{REPOSパス}/{カレントプラグイン}"
95
95
    カレントプラグインを「/」で区切ってAに代入。
96
96
    P0=Aの0を配列切取。
97
97
    P1=Aを「/」で配列結合。
98
-   SRC_URL="https://github.com/kujirahand/{P0}/blob/master/{P1}"
98
+   jsplugin2text__SRC_URL="https://github.com/kujirahand/{P0}/blob/master/{P1}"
99
99
    パスが存在
100
100
    もし、そうならば
101
101
       # パスを表示。
@@ -120,4 +120,3 @@ FILE_PATH=""
120
120
  B=「REPORT_ERR」の環境変数取得
121
121
  もし、Bならば、結果データを表示。
122
122
  結果データを「{基本パス}/batch/command.txt」に保存。
123
-
@@ -35,8 +35,7 @@ export default coreVersion
35
35
  VSを保存先へ保存。
36
36
 
37
37
  # ---------------------------------------------
38
- # ● なでしこのコアバージョン(core/src/nako_core_version.mts)情報を更新しました。
38
+ # ● なでしこのコアバージョンの情報を更新しました。
39
39
  # version {VER}
40
40
  # file: {保存先}
41
- # ---------------------------------------------
42
41
  」を表示。
package/core/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nadesiko3core",
3
- "version": "3.7.25",
3
+ "version": "3.8.1",
4
4
  "description": "Japanese Programming Language Nadesiko v3 core",
5
5
  "main": "index.mjs",
6
6
  "type": "module",
@@ -1,8 +1,8 @@
1
1
  // 実際のバージョン定義 (自動生成されるので以下を編集しない)
2
2
  const coreVersion = {
3
- version: '3.7.25',
3
+ version: '3.8.1',
4
4
  major: 3,
5
- minor: 7,
6
- patch: 25
5
+ minor: 8,
6
+ patch: 1
7
7
  };
8
8
  export default coreVersion;
@@ -11,9 +11,9 @@ export interface NakoCoreVersion {
11
11
  }
12
12
  // 実際のバージョン定義 (自動生成されるので以下を編集しない)
13
13
  const coreVersion: NakoCoreVersion = {
14
- version: '3.7.25',
14
+ version: '3.8.1',
15
15
  major: 3,
16
- minor: 7,
17
- patch: 25
16
+ minor: 8,
17
+ patch: 1
18
18
  }
19
19
  export default coreVersion
@@ -2156,7 +2156,7 @@ self.logger = {
2156
2156
  error: (message) => { console.error(message) },
2157
2157
  warn: (message) => { console.warn(message) },
2158
2158
  send: (level, message) => { console.log(message) },
2159
- runtimeError: (message, lineInfo) => { console.error(message, lineInfo) }
2159
+ runtimeError: (error, lineInfo) => new NakoRuntimeError(error, lineInfo)
2160
2160
  };
2161
2161
  self.__varslist = [self.newVariables(), self.newVariables(), self.newVariables()]
2162
2162
  self.__v0 = self.__varslist[0]
@@ -2256,7 +2256,7 @@ self.logger = {
2256
2256
  error: (message) => { console.error(message) },
2257
2257
  warn: (message) => { console.warn(message) },
2258
2258
  send: (level, message) => { console.log(message) },
2259
- runtimeError: (message, lineInfo) => { console.error(message, lineInfo) }
2259
+ runtimeError: (error, lineInfo) => new NakoRuntimeError(error, lineInfo)
2260
2260
  };
2261
2261
  self.__varslist = [self.newVariables(), self.newVariables(), self.newVariables()]
2262
2262
  self.__v0 = self.__varslist[0]
@@ -48,11 +48,16 @@ import { NewEmptyToken } from './nako_types.mjs';
48
48
  * 構文解析を行うクラス
49
49
  */
50
50
  export class NakoParser extends NakoParserBase {
51
+ constructor() {
52
+ super(...arguments);
53
+ this.originalVarNames = new WeakMap();
54
+ }
51
55
  /**
52
56
  * 構文解析を実行する
53
57
  */
54
58
  parse(tokens, filename) {
55
59
  this.reset();
60
+ this.originalVarNames = new WeakMap();
56
61
  this.tokens = tokens;
57
62
  this.modName = NakoLexer.filenameToModName(filename);
58
63
  this.modList.push(this.modName);
@@ -1415,14 +1420,15 @@ export class NakoParser extends NakoParserBase {
1415
1420
  if (word.type === 'func') {
1416
1421
  throw NakoSyntaxError.fromNode('関数『' + String(word.name) + '』に代入できません。『(変数名)に(値)を代入』のように使います。', dainyu);
1417
1422
  }
1423
+ const target = this.getAssignmentVarName(word);
1418
1424
  // 配列への代入
1419
- if (word.type === 'ref_array') {
1420
- const indexArray = word.index || [];
1425
+ if (target.type === 'ref_array') {
1426
+ const indexArray = target.index || [];
1421
1427
  const blocks = [value, ...indexArray];
1422
1428
  return {
1423
1429
  type: 'let_array',
1424
- name: word.name.value,
1425
- indexes: word.index,
1430
+ name: target.name.value,
1431
+ indexes: target.index,
1426
1432
  blocks,
1427
1433
  josi: '',
1428
1434
  checkInit: this.flagCheckArrayInit,
@@ -1431,10 +1437,9 @@ export class NakoParser extends NakoParserBase {
1431
1437
  };
1432
1438
  }
1433
1439
  // 一般的な変数への代入
1434
- const word2 = this.getVarName(word);
1435
1440
  return {
1436
1441
  type: 'let',
1437
- name: word2.value,
1442
+ name: target.value,
1438
1443
  blocks: [value],
1439
1444
  josi: '',
1440
1445
  ...map,
@@ -1518,7 +1523,7 @@ export class NakoParser extends NakoParserBase {
1518
1523
  }
1519
1524
  return {
1520
1525
  type: 'inc',
1521
- name: word,
1526
+ name: this.getAssignmentVarName(word),
1522
1527
  blocks: [value],
1523
1528
  josi: action.josi,
1524
1529
  ...map,
@@ -1807,7 +1812,7 @@ export class NakoParser extends NakoParserBase {
1807
1812
  // オブジェクトプロパティ構文:代入文::ここから (#1793)
1808
1813
  if (this.check2(['word', '$', '*', '$', '*', '$', '*', '$', '*', 'eq']) || this.check2(['word', '$', '*', '$', '*', '$', '*', 'eq']) || this.check2(['word', '$', '*', '$', '*', 'eq']) || this.check2(['word', '$', '*', 'eq'])) {
1809
1814
  const propList = [];
1810
- const word = this.getVarName(this.get());
1815
+ const word = this.getContainerVarName(this.get());
1811
1816
  for (;;) {
1812
1817
  const flag = this.peek();
1813
1818
  if (flag === null || flag.type !== '$') {
@@ -2213,7 +2218,7 @@ export class NakoParser extends NakoParserBase {
2213
2218
  if (astValue === null) {
2214
2219
  return rollback();
2215
2220
  }
2216
- const name = this.getVarName(wordToken).value;
2221
+ const name = this.getContainerVarName(wordToken).value;
2217
2222
  if (astProps.length > 0) {
2218
2223
  // ここまで来て初めてトークンを書き換える。
2219
2224
  // 途中でrollback()するとトークンの書き換えだけが残ってしまうため。(#2396)
@@ -2558,6 +2563,10 @@ export class NakoParser extends NakoParserBase {
2558
2563
  throw NakoSyntaxError.fromNode('配列アクセス『@』でカンマ区切りの多次元指定は使えません。' +
2559
2564
  '『A[1,2]』または『A@1@2』のように書いてください。', ast);
2560
2565
  }
2566
+ /**
2567
+ * 変数や配列リテラルなどの後ろに続く『[添字]』『@添字』を読む。
2568
+ * @returns {boolean} 添字を読めたらtrue、読めなければfalseを返す。
2569
+ */
2561
2570
  yValueWordGetIndex(ast) {
2562
2571
  if (!ast.index) {
2563
2572
  ast.index = [];
@@ -2772,37 +2781,81 @@ export class NakoParser extends NakoParserBase {
2772
2781
  return word;
2773
2782
  }
2774
2783
  }
2784
+ /** 代入先の変数名を解決する。getVarName と getContainerVarName の共通処理。
2785
+ * @param word 解決したいトークン
2786
+ * @param separateFileScope ファイルスコープの分離 (#1332) を適用するか
2787
+ * @return {Ast|Token}
2788
+ */
2789
+ resolveAssignVarName(word, separateFileScope) {
2790
+ // 名前空間の解決前に記録した元の名前があれば、そちらを優先して検索する
2791
+ const originalName = this.originalVarNames.get(word);
2792
+ const name = originalName || word.value;
2793
+ const f = this.findVar(name);
2794
+ // 変数が見つからないので現在のスコープに生成する
2795
+ if (!f) {
2796
+ if (originalName) {
2797
+ word.value = name;
2798
+ }
2799
+ return this.createVar(word, false, this.isExportDefault);
2800
+ }
2801
+ // ファイル直下の無修飾な代入は、取り込み先ではなく自身の変数にする (#1332)
2802
+ // ただし、次の場合は取り込み先の実体をそのまま使う。
2803
+ // - 要素やプロパティへの代入 … 変数全体を作り直す操作ではないため
2804
+ // - 取り込んだ定数 … 新たな変数を作ると、定数への代入が暗黙のシャドーイングになるため
2805
+ if (separateFileScope && this.funcLevel === 0 && f.scope === 'global' &&
2806
+ f.info?.type !== 'const' && name.indexOf('__') < 0 &&
2807
+ f.name !== `${this.modName}__${name}`) {
2808
+ word.value = name;
2809
+ return this.createVar(word, false, this.isExportDefault);
2810
+ }
2811
+ if (f.scope === 'global') {
2812
+ word.value = f.name;
2813
+ }
2814
+ return word;
2815
+ }
2775
2816
  /** 変数名を検索して解決する
2776
2817
  * @param {Ast|Token} word
2777
2818
  * @return {Ast|Token}
2778
2819
  */
2779
2820
  getVarName(word) {
2780
- // check word name
2781
- const f = this.findVar(word.value);
2782
- if (f) {
2783
- if (f && f.scope === 'global') {
2784
- word.value = f.name;
2785
- }
2786
- return word;
2787
- }
2788
- // 変数が見つからない
2789
- this.createVar(word, false, this.isExportDefault);
2790
- return word;
2821
+ return this.resolveAssignVarName(word, true);
2822
+ }
2823
+ /** 配列・オブジェクトの代入先を解決する。
2824
+ * 既存のコンテナは取り込み元の実体を更新し、未定義の場合だけ現在のスコープに生成する。
2825
+ */
2826
+ getContainerVarName(word) {
2827
+ return this.resolveAssignVarName(word, false);
2791
2828
  }
2792
2829
  /** 変数名を検索して解決する */
2793
2830
  getVarNameRef(word) {
2794
2831
  // check word name
2832
+ const originalName = word.value;
2795
2833
  const f = this.findVar(word.value);
2796
2834
  if (!f) { // 変数が見つからない
2797
2835
  if (this.funcLevel === 0 && word.value.indexOf('__') < 0) {
2836
+ this.originalVarNames.set(word, originalName);
2798
2837
  word.value = this.modName + '__' + String(word.value);
2799
2838
  }
2800
2839
  }
2801
2840
  else if (f && f.scope === 'global') {
2841
+ if (word.value !== f.name) {
2842
+ this.originalVarNames.set(word, originalName);
2843
+ }
2802
2844
  word.value = f.name;
2803
2845
  }
2804
2846
  return word;
2805
2847
  }
2848
+ /** 代入・増減対象の変数名を、元の無修飾名を考慮して解決する */
2849
+ getAssignmentVarName(word) {
2850
+ if (word.type === 'word') {
2851
+ return this.getVarName(word);
2852
+ }
2853
+ if ((word.type === 'ref_array' || word.type === 'ref_prop') &&
2854
+ word.name && typeof word.name !== 'string') {
2855
+ word.name = this.getContainerVarName(word.name);
2856
+ }
2857
+ return word;
2858
+ }
2806
2859
  /** 複数の変数名を検索して解決する */
2807
2860
  createVarList(words, isConst, isExport) {
2808
2861
  for (let i = 0; i < words.length; i++) {
@@ -2936,6 +2989,7 @@ export class NakoParser extends NakoParserBase {
2936
2989
  // 配列の直後に@や[]があるか?
2937
2990
  // ただし、助詞がある場合には、別の引数の可能性があるので無視。 (例) [0,1,2]を[3,4,5]に配列***
2938
2991
  if (val.josi === '' && this.checkTypes(['@', '['])) {
2992
+ const startIndex = this.index;
2939
2993
  const ast = {
2940
2994
  type: 'ref_array_value',
2941
2995
  name: '@',
@@ -2949,11 +3003,18 @@ export class NakoParser extends NakoParserBase {
2949
3003
  break;
2950
3004
  }
2951
3005
  }
3006
+ // 後置添字として1つも解析できず、トークン位置も進まない場合はエラーにする。(#2436)
3007
+ // (例)『[[0,0,0,0][0,0,0,0]]』のように要素の区切りのカンマを書き忘れた場合
3008
+ if (this.index === startIndex) {
3009
+ throw NakoSyntaxError.fromNode('配列の直後にある『[...]』を配列アクセスとして解析できません。' +
3010
+ '配列の要素を区切る『,』(カンマ)を忘れていませんか。', val);
3011
+ }
2952
3012
  val = ast;
2953
3013
  continue;
2954
3014
  }
2955
3015
  // 配列の直の後に$(プロパティ)があるか?
2956
3016
  if (this.check('$')) {
3017
+ const startIndex = this.index;
2957
3018
  const ast = {
2958
3019
  type: 'ref_array_value',
2959
3020
  name: '$',
@@ -2967,6 +3028,10 @@ export class NakoParser extends NakoParserBase {
2967
3028
  break;
2968
3029
  }
2969
3030
  }
3031
+ // プロパティを1つも解析できず、トークン位置も進まない場合はエラーにする。(#2436)
3032
+ if (this.index === startIndex) {
3033
+ throw NakoSyntaxError.fromNode('配列の直後にある『$プロパティ』の指定が不正です。', val);
3034
+ }
2970
3035
  val = ast;
2971
3036
  continue;
2972
3037
  }