nadesiko3 3.7.21 → 3.7.23

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 (212) hide show
  1. package/README.md +20 -1
  2. package/batch/command.txt +370 -334
  3. package/batch/generate_command_list.mjs +102 -0
  4. package/batch/jsplugin2text.nako3 +1 -1
  5. package/batch/pickup_command.nako3 +12 -0
  6. package/batch/search_command.mjs +34 -0
  7. package/batch/search_command.nako3 +430 -0
  8. package/core/command/snako.mts +5 -1
  9. package/core/deno/snako.ts +5 -1
  10. package/core/package-lock.json +382 -21
  11. package/core/package.json +7 -4
  12. package/core/sample/algorithms/README.md +43 -0
  13. package/core/sample/algorithms/graph/dijkstra.nako3 +47 -0
  14. package/core/sample/algorithms/graph/kruskal.nako3 +69 -0
  15. package/core/sample/algorithms/math/euclidean_gcd.nako3 +15 -0
  16. package/core/sample/algorithms/math/sieve_of_eratosthenes.nako3 +26 -0
  17. package/core/sample/algorithms/search/binary_search.nako3 +17 -0
  18. package/core/sample/algorithms/search/breadth_first_search.nako3 +33 -0
  19. package/core/sample/algorithms/search/depth_first_search.nako3 +25 -0
  20. package/core/sample/algorithms/sort/heap_sort.nako3 +37 -0
  21. package/core/sample/algorithms/sort/insertion_sort.nako3 +18 -0
  22. package/core/sample/algorithms/sort/merge_sort.nako3 +40 -0
  23. package/core/sample/algorithms/sort/quick_sort.nako3 +36 -0
  24. package/core/sample/algorithms/string/knuth_morris_pratt.nako3 +50 -0
  25. package/core/sample/algorithms/string/run_length_encoding.nako3 +25 -0
  26. package/core/src/nako3.mts +178 -614
  27. package/core/src/nako_basic_plugins.mts +39 -0
  28. package/core/src/nako_core_version.mts +2 -2
  29. package/core/src/nako_csv.mts +0 -1
  30. package/core/src/nako_event.mts +49 -0
  31. package/core/src/nako_gen.mts +320 -209
  32. package/core/src/nako_global.mts +18 -0
  33. package/core/src/nako_indent_inline.mts +2 -2
  34. package/core/src/nako_lex_rules.mts +1 -1
  35. package/core/src/nako_parser3.mts +111 -166
  36. package/core/src/nako_parser_async.mts +165 -0
  37. package/core/src/nako_parser_base.mts +4 -55
  38. package/core/src/nako_parser_message.mts +105 -0
  39. package/core/src/nako_parser_operator.mts +93 -0
  40. package/core/src/nako_plugin_manager.mts +260 -0
  41. package/core/src/nako_require.mts +292 -0
  42. package/core/src/nako_runner.mts +208 -0
  43. package/core/src/nako_tokenizer.mts +221 -0
  44. package/core/src/plugin_csv.mts +1 -1
  45. package/core/src/plugin_system.mts +34 -3259
  46. package/core/src/plugin_system_array.mts +699 -0
  47. package/core/src/plugin_system_datetime.mts +368 -0
  48. package/core/src/plugin_system_debug.mts +403 -0
  49. package/core/src/plugin_system_dict.mts +85 -0
  50. package/core/src/plugin_system_json.mts +73 -0
  51. package/core/src/plugin_system_math.mts +383 -0
  52. package/core/src/plugin_system_regexp.mts +120 -0
  53. package/core/src/plugin_system_stdio.mts +86 -0
  54. package/core/src/plugin_system_string.mts +666 -0
  55. package/core/src/plugin_system_timer.mts +152 -0
  56. package/core/src/plugin_system_types.mts +151 -0
  57. package/core/src/plugin_system_url.mts +193 -0
  58. package/core/src/plugin_toml.mts +3 -3
  59. package/core/test/algorithm_samples_test.mjs +58 -0
  60. package/core/test/algorithms/graph/dijkstra_test.nako3 +21 -0
  61. package/core/test/algorithms/graph/kruskal_test.nako3 +21 -0
  62. package/core/test/algorithms/helper.mjs +13 -0
  63. package/core/test/algorithms/math/euclidean_gcd_test.nako3 +13 -0
  64. package/core/test/algorithms/math/sieve_of_eratosthenes_test.nako3 +10 -0
  65. package/core/test/algorithms/search/binary_search_test.nako3 +15 -0
  66. package/core/test/algorithms/search/breadth_first_search_test.nako3 +13 -0
  67. package/core/test/algorithms/search/depth_first_search_test.nako3 +13 -0
  68. package/core/test/algorithms/sort/heap_sort_test.nako3 +13 -0
  69. package/core/test/algorithms/sort/insertion_sort_test.nako3 +13 -0
  70. package/core/test/algorithms/sort/merge_sort_test.nako3 +18 -0
  71. package/core/test/algorithms/sort/quick_sort_test.nako3 +34 -0
  72. package/core/test/algorithms/string/knuth_morris_pratt_test.nako3 +16 -0
  73. package/core/test/algorithms/string/run_length_encoding_test.nako3 +13 -0
  74. package/core/test/array_test.mjs +3 -0
  75. package/core/test/fixtures/README.md +39 -0
  76. package/core/test/fixtures/make_parser_ast_golden.mjs +31 -0
  77. package/core/test/fixtures/parser_ast_golden.json +8027 -0
  78. package/core/test/fixtures/parser_corpus.mjs +120 -0
  79. package/core/test/func_call.mjs +18 -0
  80. package/core/test/func_test.mjs +28 -0
  81. package/core/test/indent_test.mjs +6 -0
  82. package/core/test/nako_basic_plugins_test.mjs +44 -0
  83. package/core/test/nako_event_test.mjs +127 -0
  84. package/core/test/nako_gen_perf_test.mjs +178 -0
  85. package/core/test/nako_parser_async_test.mjs +385 -0
  86. package/core/test/nako_parser_test.mjs +160 -0
  87. package/core/test/nako_plugin_manager_test.mjs +185 -0
  88. package/core/test/nako_require_test.mjs +153 -0
  89. package/core/test/nako_runner_test.mjs +174 -0
  90. package/core/test/nako_tokenizer_test.mjs +115 -0
  91. package/core/test/plugin_system_debug_test.mjs +138 -0
  92. package/core/test/plugin_system_split_test.mjs +179 -0
  93. package/core/test/plugin_system_test.mjs +6 -0
  94. package/core/tsconfig.json +0 -1
  95. package/demo/browsers.html +1 -1
  96. package/doc/SETUP.md +1 -1
  97. package/doc/ai-code-generation.md +136 -0
  98. package/doc/browsers.md +1 -1
  99. package/doc/command_list.json +16842 -0
  100. package/doc/search_command.md +222 -0
  101. package/doc/syntax-nako3.md +344 -0
  102. package/package.json +29 -26
  103. package/release/_hash.txt +40 -40
  104. package/release/_script-tags.txt +16 -16
  105. package/release/command.json +1 -1
  106. package/release/command.json.js +1 -1
  107. package/release/command_cnako3.json +1 -1
  108. package/release/command_list.json +1 -1
  109. package/release/edit_main.js +6 -6
  110. package/release/edit_main.js.map +3 -3
  111. package/release/editor.js +6 -6
  112. package/release/plugin_caniuse.js +1 -1
  113. package/release/plugin_caniuse.js.map +2 -2
  114. package/release/plugin_keigo.js.map +3 -3
  115. package/release/plugin_markup.js +46 -46
  116. package/release/plugin_markup.js.map +3 -3
  117. package/release/plugin_weykturtle3d.js +1 -1
  118. package/release/plugin_weykturtle3d.js.map +3 -3
  119. package/release/version.js +2 -2
  120. package/release/version_main.js +2 -2
  121. package/release/version_main.js.map +1 -1
  122. package/release/wnako3.js +219 -230
  123. package/release/wnako3.js.map +4 -4
  124. package/release/wnako3webworker.js +193 -204
  125. package/release/wnako3webworker.js.map +4 -4
  126. package/src/browsers.mjs +1 -1
  127. package/src/browsers.txt +0 -1
  128. package/src/cnako3mod.mjs +7 -2
  129. package/src/cnako3mod.mts +7 -2
  130. package/src/nako_version.mjs +2 -2
  131. package/src/nako_version.mts +2 -2
  132. package/src/plugin_browser_ajax.mjs +4 -4
  133. package/src/plugin_browser_ajax.mts +4 -4
  134. package/src/plugin_browser_audio.mjs +10 -10
  135. package/src/plugin_browser_audio.mts +10 -10
  136. package/src/plugin_browser_camera.mjs +4 -4
  137. package/src/plugin_browser_camera.mts +4 -4
  138. package/src/plugin_browser_canvas.mjs +2 -2
  139. package/src/plugin_browser_canvas.mts +2 -2
  140. package/src/plugin_browser_crypto.mjs +3 -3
  141. package/src/plugin_browser_crypto.mts +3 -3
  142. package/src/plugin_browser_dom_event.mjs +1 -1
  143. package/src/plugin_browser_dom_event.mts +1 -1
  144. package/src/plugin_browser_geolocation.mjs +1 -1
  145. package/src/plugin_browser_geolocation.mts +1 -1
  146. package/src/plugin_browser_hotkey.mjs +1 -1
  147. package/src/plugin_browser_hotkey.mts +1 -1
  148. package/src/plugin_browser_html.mjs +1 -1
  149. package/src/plugin_browser_html.mts +1 -1
  150. package/src/plugin_browser_location.mjs +1 -1
  151. package/src/plugin_browser_location.mts +1 -1
  152. package/src/plugin_browser_speech.mjs +1 -1
  153. package/src/plugin_browser_speech.mts +1 -1
  154. package/src/plugin_browser_storage.mjs +2 -2
  155. package/src/plugin_browser_storage.mts +2 -2
  156. package/src/plugin_httpserver.mjs +3 -3
  157. package/src/plugin_httpserver.mts +3 -3
  158. package/src/plugin_keigo.mjs +2 -2
  159. package/src/plugin_keigo.mts +2 -2
  160. package/src/plugin_node.mjs +48 -48
  161. package/src/plugin_node.mts +53 -53
  162. package/src/plugin_weykturtle3d.mjs +56 -56
  163. package/src/plugin_weykturtle3d.mts +56 -56
  164. package/src/wnako3.mjs +1 -1
  165. package/src/wnako3.mts +1 -1
  166. package/src/wnako3_editor.mjs +5 -5
  167. package/src/wnako3_editor.mts +5 -5
  168. package/src/wnako3mod.mjs +2 -2
  169. package/src/wnako3mod.mts +2 -2
  170. package/test/nako3edit/index_nako3_test.mjs +282 -0
  171. package/test/nako3server/index_nako3_test.mjs +239 -0
  172. package/test/node/ai_code_generation_guide_test.mjs +29 -0
  173. package/test/node/node_version_support_test.mjs +45 -0
  174. package/test/node/search_command_test.mjs +174 -0
  175. package/tools/nako3edit/AGENTS.md +23 -0
  176. package/tools/nako3edit/index.nako3 +404 -0
  177. package/tools/nako3server/AGENTS.md +23 -0
  178. package/tools/nako3server/index.nako3 +156 -23
  179. package/core/src/nako3.mjs +0 -1021
  180. package/core/src/nako_ast.mjs +0 -4
  181. package/core/src/nako_colors.mjs +0 -77
  182. package/core/src/nako_core_version.mjs +0 -8
  183. package/core/src/nako_csv.mjs +0 -193
  184. package/core/src/nako_errors.mjs +0 -166
  185. package/core/src/nako_from_dncl.mjs +0 -285
  186. package/core/src/nako_from_dncl2.mjs +0 -347
  187. package/core/src/nako_gen.mjs +0 -2500
  188. package/core/src/nako_global.mjs +0 -138
  189. package/core/src/nako_indent.mjs +0 -442
  190. package/core/src/nako_indent_chars.mjs +0 -29
  191. package/core/src/nako_indent_inline.mjs +0 -361
  192. package/core/src/nako_josi_list.mjs +0 -47
  193. package/core/src/nako_lex_rules.mjs +0 -319
  194. package/core/src/nako_lexer.mjs +0 -794
  195. package/core/src/nako_logger.mjs +0 -221
  196. package/core/src/nako_parser3.mjs +0 -3250
  197. package/core/src/nako_parser_base.mjs +0 -403
  198. package/core/src/nako_parser_const.mjs +0 -37
  199. package/core/src/nako_prepare.mjs +0 -329
  200. package/core/src/nako_reserved_words.mjs +0 -42
  201. package/core/src/nako_source_mapping.mjs +0 -207
  202. package/core/src/nako_test.mjs +0 -37
  203. package/core/src/nako_token.mjs +0 -1
  204. package/core/src/nako_tools.mjs +0 -53
  205. package/core/src/nako_types.mjs +0 -14
  206. package/core/src/plugin_api.mjs +0 -4
  207. package/core/src/plugin_csv.mjs +0 -97
  208. package/core/src/plugin_math.mjs +0 -352
  209. package/core/src/plugin_promise.mjs +0 -102
  210. package/core/src/plugin_system.mjs +0 -3810
  211. package/core/src/plugin_test.mjs +0 -52
  212. package/core/src/plugin_toml.mjs +0 -39
@@ -1,4 +0,0 @@
1
- /**
2
- * @fileOverview プラグインAPIの型定義
3
- */
4
- export {};
@@ -1,97 +0,0 @@
1
- import { options, parse, stringify } from './nako_csv.mjs';
2
- const PluginCSV = {
3
- 'meta': {
4
- type: 'const',
5
- value: {
6
- pluginName: 'plugin_csv', // プラグインの名前
7
- description: 'CSV関連の命令を提供するプラグイン', // プラグインの説明
8
- pluginVersion: '3.6.0', // プラグインのバージョン
9
- nakoRuntime: ['wnako', 'cnako', 'phpnako'], // 対象ランタイム
10
- nakoVersion: '3.6.0' // 要求なでしこバージョン
11
- }
12
- },
13
- '初期化': {
14
- type: 'func',
15
- josi: [],
16
- pure: true,
17
- fn: function () {
18
- // 基本的に初期化不要
19
- }
20
- },
21
- // @CSV操作
22
- 'CSV取得': {
23
- type: 'func',
24
- josi: [['を', 'の', 'で']],
25
- pure: true,
26
- fn: function (str) {
27
- options.delimiter = ',';
28
- return parse(str);
29
- }
30
- },
31
- 'TSV取得': {
32
- type: 'func',
33
- josi: [['を', 'の', 'で']],
34
- pure: true,
35
- fn: function (str) {
36
- options.delimiter = '\t';
37
- return parse(str);
38
- }
39
- },
40
- '表CSV変換': {
41
- type: 'func',
42
- josi: [['を']],
43
- pure: true,
44
- fn: function (a) {
45
- options.delimiter = ',';
46
- return stringify(a);
47
- }
48
- },
49
- 'CSV変換': {
50
- type: 'func',
51
- josi: [['を']],
52
- pure: true,
53
- fn: function (a) {
54
- options.delimiter = ',';
55
- return stringify(a);
56
- }
57
- },
58
- '表TSV変換': {
59
- type: 'func',
60
- josi: [['を']],
61
- pure: true,
62
- fn: function (a) {
63
- options.delimiter = '\t';
64
- return stringify(a);
65
- }
66
- },
67
- 'TSV変換': {
68
- type: 'func',
69
- josi: [['を']],
70
- pure: true,
71
- fn: function (a) {
72
- options.delimiter = '\t';
73
- return stringify(a);
74
- }
75
- },
76
- 'CSVオプション設定': {
77
- type: 'func',
78
- josi: [['を', 'で']],
79
- pure: true,
80
- fn: function (obj) {
81
- for (const key in obj) {
82
- const value = obj[key];
83
- if (key === 'delimiter' || key === '区切文字') {
84
- options.delimiter = value;
85
- }
86
- else if (key === 'eol') {
87
- options.eol = value;
88
- }
89
- else if (key === 'auto_convert_number') {
90
- options.auto_convert_number = value;
91
- }
92
- }
93
- },
94
- return_none: true
95
- }
96
- };
97
- export default PluginCSV;
@@ -1,352 +0,0 @@
1
- export default {
2
- 'meta': {
3
- type: 'const',
4
- value: {
5
- pluginName: 'plugin_math', // プラグインの名前
6
- description: '数学関数を提供するプラグイン', // プラグインの説明
7
- pluginVersion: '3.6.0', // プラグインのバージョン
8
- nakoRuntime: ['wnako', 'cnako', 'phpnako'], // 対象ランタイム
9
- nakoVersion: '^3.6.0' // 要求なでしこバージョン
10
- }
11
- },
12
- '初期化': {
13
- type: 'func',
14
- josi: [],
15
- pure: true,
16
- fn: function () {
17
- // 初期化不要
18
- }
19
- },
20
- // @三角関数
21
- 'SIN': {
22
- type: 'func',
23
- josi: [['の']],
24
- pure: true,
25
- fn: function (v) {
26
- return Math.sin(v);
27
- }
28
- },
29
- 'COS': {
30
- type: 'func',
31
- josi: [['の']],
32
- pure: true,
33
- fn: function (v) {
34
- return Math.cos(v);
35
- }
36
- },
37
- 'TAN': {
38
- type: 'func',
39
- josi: [['の']],
40
- pure: true,
41
- fn: function (v) {
42
- return Math.tan(v);
43
- }
44
- },
45
- 'ARCSIN': {
46
- type: 'func',
47
- josi: [['の']],
48
- pure: true,
49
- fn: function (v) {
50
- return Math.asin(v);
51
- }
52
- },
53
- 'ARCCOS': {
54
- type: 'func',
55
- josi: [['の']],
56
- pure: true,
57
- fn: function (v) {
58
- return Math.acos(v);
59
- }
60
- },
61
- 'ARCTAN': {
62
- type: 'func',
63
- josi: [['の']],
64
- pure: true,
65
- fn: function (v) {
66
- return Math.atan(v);
67
- }
68
- },
69
- 'ATAN2': {
70
- type: 'func',
71
- josi: [['と'], ['の']],
72
- pure: true,
73
- fn: function (y, x) {
74
- return Math.atan2(y, x);
75
- }
76
- },
77
- '座標角度計算': {
78
- type: 'func',
79
- josi: [['の']],
80
- pure: true,
81
- fn: function (XY) {
82
- return Math.atan2(XY[1], XY[0]) / Math.PI * 180;
83
- }
84
- },
85
- 'RAD2DEG': {
86
- type: 'func',
87
- josi: [['を']],
88
- pure: true,
89
- fn: function (v) {
90
- return v / Math.PI * 180;
91
- }
92
- },
93
- 'DEG2RAD': {
94
- type: 'func',
95
- josi: [['を']],
96
- pure: true,
97
- fn: function (v) {
98
- return (v / 180) * Math.PI;
99
- }
100
- },
101
- '度変換': {
102
- type: 'func',
103
- josi: [['を']],
104
- pure: true,
105
- fn: function (v) {
106
- return v / Math.PI * 180;
107
- }
108
- },
109
- 'ラジアン変換': {
110
- type: 'func',
111
- josi: [['を']],
112
- pure: true,
113
- fn: function (v) {
114
- return (v / 180) * Math.PI;
115
- }
116
- },
117
- // @算術関数
118
- 'SIGN': {
119
- type: 'func',
120
- josi: [['の']],
121
- pure: true,
122
- fn: function (v) {
123
- return (parseFloat(v) === 0) ? 0 : (v > 0) ? 1 : -1;
124
- }
125
- },
126
- '符号': {
127
- type: 'func',
128
- josi: [['の']],
129
- pure: false,
130
- fn: function (v, sys) {
131
- return sys.__exec('SIGN', [v]);
132
- }
133
- },
134
- 'ABS': {
135
- type: 'func',
136
- josi: [['の']],
137
- pure: true,
138
- fn: function (a) {
139
- return Math.abs(a);
140
- }
141
- },
142
- '絶対値': {
143
- type: 'func',
144
- josi: [['の']],
145
- pure: true,
146
- fn: function (a) {
147
- return Math.abs(a);
148
- }
149
- },
150
- 'EXP': {
151
- type: 'func',
152
- josi: [['の']],
153
- pure: true,
154
- fn: function (a) {
155
- return Math.exp(a);
156
- }
157
- },
158
- 'HYPOT': {
159
- type: 'func',
160
- josi: [['と'], ['の']],
161
- pure: true,
162
- fn: function (a, b) {
163
- return Math.hypot(a, b);
164
- }
165
- },
166
- '斜辺': {
167
- type: 'func',
168
- josi: [['と'], ['の']],
169
- pure: true,
170
- fn: function (a, b) {
171
- return Math.hypot(a, b);
172
- }
173
- },
174
- 'LN': {
175
- type: 'func',
176
- josi: [['の']],
177
- pure: true,
178
- fn: function (a) {
179
- return Math.log(a);
180
- }
181
- },
182
- 'LOG': {
183
- type: 'func',
184
- josi: [['の']],
185
- pure: true,
186
- fn: function (a) {
187
- return Math.log(a);
188
- }
189
- },
190
- 'LOGN': {
191
- type: 'func',
192
- josi: [['で'], ['の']],
193
- pure: true,
194
- fn: function (a, b) {
195
- if (a === 2) {
196
- return Math.LOG2E * Math.log(b);
197
- }
198
- if (a === 10) {
199
- return Math.LOG10E * Math.log(b);
200
- }
201
- return Math.log(b) / Math.log(a);
202
- }
203
- },
204
- 'FRAC': {
205
- type: 'func',
206
- josi: [['の']],
207
- pure: true,
208
- fn: function (a) {
209
- return a % 1;
210
- }
211
- },
212
- '小数部分': {
213
- type: 'func',
214
- josi: [['の']],
215
- pure: true,
216
- fn: function (a) {
217
- return a % 1;
218
- }
219
- },
220
- '整数部分': {
221
- type: 'func',
222
- josi: [['の']],
223
- pure: true,
224
- fn: function (a) {
225
- return Math.trunc(a);
226
- }
227
- },
228
- '乱数': {
229
- type: 'func',
230
- josi: [['の']],
231
- pure: true,
232
- fn: function (a) {
233
- // numberの場合
234
- if (typeof a === 'number') {
235
- return Math.floor(Math.random() * a);
236
- }
237
- // 範囲オブジェクトの場合
238
- if (typeof a === 'object' && a['先頭'] !== undefined) {
239
- const min = a['先頭'];
240
- const max = a['末尾'];
241
- return Math.floor(Math.random() * (max - min + 1)) + Number(min);
242
- }
243
- // 配列の場合
244
- if (Array.isArray(a)) {
245
- const min = a[0];
246
- const max = a[1];
247
- return Math.floor(Math.random() * (max - min + 1)) + Number(min);
248
- }
249
- return undefined;
250
- }
251
- },
252
- '乱数範囲': {
253
- type: 'func',
254
- josi: [['から'], ['までの', 'の']],
255
- pure: true,
256
- fn: function (a, b) {
257
- return (Math.floor(Math.random() * (b - a + 1)) + a);
258
- }
259
- },
260
- 'SQRT': {
261
- type: 'func',
262
- josi: [['の']],
263
- pure: true,
264
- fn: function (a) {
265
- return Math.sqrt(a);
266
- }
267
- },
268
- '平方根': {
269
- type: 'func',
270
- josi: [['の']],
271
- pure: true,
272
- fn: function (a) {
273
- return Math.sqrt(a);
274
- }
275
- },
276
- // @数値切上切捨丸め
277
- 'ROUND': {
278
- type: 'func',
279
- josi: [['を']],
280
- pure: true,
281
- fn: function (v) {
282
- return Math.round(v);
283
- }
284
- },
285
- '四捨五入': {
286
- type: 'func',
287
- josi: [['を', 'の']],
288
- pure: true,
289
- fn: function (v) {
290
- return Math.round(v);
291
- }
292
- },
293
- '小数点切上': {
294
- type: 'func',
295
- josi: [['を'], ['で']],
296
- pure: true,
297
- fn: function (a, b) {
298
- const base = Math.pow(10, b);
299
- return Math.ceil(a * base) / base;
300
- }
301
- },
302
- '小数点切下': {
303
- type: 'func',
304
- josi: [['を'], ['で']],
305
- pure: true,
306
- fn: function (a, b) {
307
- const base = Math.pow(10, b);
308
- return Math.floor(a * base) / base;
309
- }
310
- },
311
- '小数点四捨五入': {
312
- type: 'func',
313
- josi: [['を'], ['で']],
314
- pure: true,
315
- fn: function (a, b) {
316
- const base = Math.pow(10, b);
317
- return Math.round(a * base) / base;
318
- }
319
- },
320
- 'CEIL': {
321
- type: 'func',
322
- josi: [['を']],
323
- pure: true,
324
- fn: function (v) {
325
- return Math.ceil(v);
326
- }
327
- },
328
- '切上': {
329
- type: 'func',
330
- josi: [['を']],
331
- pure: true,
332
- fn: function (v) {
333
- return Math.ceil(v);
334
- }
335
- },
336
- 'FLOOR': {
337
- type: 'func',
338
- josi: [['を']],
339
- pure: true,
340
- fn: function (v) {
341
- return Math.floor(v);
342
- }
343
- },
344
- '切捨': {
345
- type: 'func',
346
- josi: [['を']],
347
- pure: true,
348
- fn: function (v) {
349
- return Math.floor(v);
350
- }
351
- }
352
- };
@@ -1,102 +0,0 @@
1
- export default {
2
- 'meta': {
3
- type: 'const',
4
- value: {
5
- pluginName: 'plugin_promise', // プラグインの名前
6
- description: 'promise関連の命令を提供するプラグイン', // プラグインの説明
7
- pluginVersion: '3.6.0', // プラグインのバージョン
8
- nakoRuntime: ['wnako', 'cnako'], // 対象ランタイム
9
- nakoVersion: '^3.6.0' // 要求なでしこバージョン
10
- }
11
- },
12
- '初期化': {
13
- type: 'func',
14
- josi: [],
15
- pure: true,
16
- fn: function (sys) {
17
- if (sys.__promise === null || sys.__promise === undefined) {
18
- sys.__promise = {
19
- setLastPromise: function (promise) {
20
- sys.__setSysVar('そ', promise);
21
- return promise;
22
- }
23
- };
24
- }
25
- }
26
- },
27
- // @非同期処理の保証の定数
28
- 'そ': { type: 'const', value: '' }, // @そ
29
- // @非同期処理の保証
30
- '動時': {
31
- type: 'func',
32
- josi: [['を', 'で']],
33
- pure: true,
34
- fn: function (callback, sys) {
35
- return sys.__promise.setLastPromise(new Promise((resolve, reject) => {
36
- return callback(resolve, reject);
37
- }));
38
- },
39
- return_none: false
40
- },
41
- '成功時': {
42
- type: 'func',
43
- josi: [['を'], ['の', 'が', 'に']],
44
- pure: true,
45
- fn: function (callback, promise, sys) {
46
- return sys.__promise.setLastPromise(promise.then((result) => {
47
- sys.__setSysVar('対象', result);
48
- return callback(result);
49
- }));
50
- },
51
- return_none: false
52
- },
53
- '処理時': {
54
- type: 'func',
55
- josi: [['を'], ['の', 'が', 'に']],
56
- pure: true,
57
- fn: function (cbFunc, promise, sys) {
58
- return sys.__promise.setLastPromise(promise.then((result) => {
59
- sys.__setSysVar('対象', result);
60
- return cbFunc(true, result, sys);
61
- }, (reason) => {
62
- sys.__setSysVar('対象', reason);
63
- return cbFunc(false, reason, sys);
64
- }));
65
- },
66
- return_none: false
67
- },
68
- '失敗時': {
69
- type: 'func',
70
- josi: [['を'], ['の', 'が', 'に']],
71
- pure: true,
72
- fn: function (callback, promise, sys) {
73
- return sys.__promise.setLastPromise(promise.catch((err) => {
74
- sys.__setSysVar('対象', err);
75
- return callback(err);
76
- }));
77
- },
78
- return_none: false
79
- },
80
- '終了時': {
81
- type: 'func',
82
- josi: [['を'], ['の', 'が', 'に']],
83
- pure: true,
84
- fn: function (callback, promise, sys) {
85
- return sys.__promise.setLastPromise(promise.finally(() => {
86
- return callback();
87
- }));
88
- },
89
- return_none: false
90
- },
91
- '束': {
92
- type: 'func',
93
- josi: [['と', 'を']],
94
- isVariableJosi: true,
95
- pure: true,
96
- fn: function (...args) {
97
- const sys = args.pop();
98
- return (sys).__promise.setLastPromise(Promise.all(args));
99
- },
100
- return_none: false
101
- }
102
- };