nadesiko3 3.3.48 → 3.3.49

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 (105) hide show
  1. package/core/.editorconfig +6 -0
  2. package/core/.eslintrc.cjs +33 -0
  3. package/core/.github/dependabot.yml +7 -0
  4. package/core/.github/workflows/nodejs.yml +37 -0
  5. package/core/.github/workflows/super-linter.yml +61 -0
  6. package/core/.github/workflows/textlint.yml +199 -0
  7. package/core/LICENSE +21 -0
  8. package/core/README.md +66 -0
  9. package/core/batch/build_nako_version.nako3 +42 -0
  10. package/core/command/snako.mjs +105 -0
  11. package/core/command/snako.mts +116 -0
  12. package/core/index.mjs +21 -0
  13. package/core/index.mts +21 -0
  14. package/core/package.json +47 -0
  15. package/core/sample/hello.nako3 +7 -0
  16. package/core/sample/hoge.mjs +4 -0
  17. package/core/sample/hoge.mts +6 -0
  18. package/core/src/nako3.mjs +858 -0
  19. package/core/src/nako3.mts +967 -0
  20. package/core/src/nako_colors.mjs +78 -0
  21. package/core/src/nako_colors.mts +86 -0
  22. package/core/src/nako_core_version.mjs +8 -0
  23. package/core/src/nako_core_version.mts +19 -0
  24. package/core/src/nako_csv.mjs +185 -0
  25. package/core/src/nako_csv.mts +188 -0
  26. package/core/src/nako_errors.mjs +173 -0
  27. package/core/src/nako_errors.mts +197 -0
  28. package/core/src/nako_from_dncl.mjs +255 -0
  29. package/core/src/nako_from_dncl.mts +250 -0
  30. package/core/src/nako_gen.mjs +1648 -0
  31. package/core/src/nako_gen.mts +1719 -0
  32. package/core/src/nako_gen_async.mjs +1659 -0
  33. package/core/src/nako_gen_async.mts +1732 -0
  34. package/core/src/nako_global.mjs +107 -0
  35. package/core/src/nako_global.mts +138 -0
  36. package/core/src/nako_indent.mjs +445 -0
  37. package/core/src/nako_indent.mts +492 -0
  38. package/core/src/nako_josi_list.mjs +38 -0
  39. package/core/src/nako_josi_list.mts +45 -0
  40. package/core/src/nako_lex_rules.mjs +253 -0
  41. package/core/src/nako_lex_rules.mts +260 -0
  42. package/core/src/nako_lexer.mjs +609 -0
  43. package/core/src/nako_lexer.mts +612 -0
  44. package/core/src/nako_logger.mjs +199 -0
  45. package/core/src/nako_logger.mts +232 -0
  46. package/core/src/nako_parser3.mjs +2439 -0
  47. package/core/src/nako_parser3.mts +2195 -0
  48. package/core/src/nako_parser_base.mjs +370 -0
  49. package/core/src/nako_parser_base.mts +370 -0
  50. package/core/src/nako_parser_const.mjs +37 -0
  51. package/core/src/nako_parser_const.mts +37 -0
  52. package/core/src/nako_prepare.mjs +304 -0
  53. package/core/src/nako_prepare.mts +315 -0
  54. package/core/src/nako_reserved_words.mjs +38 -0
  55. package/core/src/nako_reserved_words.mts +38 -0
  56. package/core/src/nako_source_mapping.mjs +207 -0
  57. package/core/src/nako_source_mapping.mts +262 -0
  58. package/core/src/nako_test.mjs +37 -0
  59. package/core/src/nako_types.mjs +25 -0
  60. package/core/src/nako_types.mts +151 -0
  61. package/core/src/plugin_csv.mjs +49 -0
  62. package/core/src/plugin_csv.mts +50 -0
  63. package/core/src/plugin_math.mjs +328 -0
  64. package/core/src/plugin_math.mts +326 -0
  65. package/core/src/plugin_promise.mjs +91 -0
  66. package/core/src/plugin_promise.mts +91 -0
  67. package/core/src/plugin_system.mjs +2832 -0
  68. package/core/src/plugin_system.mts +2690 -0
  69. package/core/src/plugin_test.mjs +34 -0
  70. package/core/src/plugin_test.mts +34 -0
  71. package/core/test/array_test.mjs +34 -0
  72. package/core/test/basic_test.mjs +344 -0
  73. package/core/test/calc_test.mjs +140 -0
  74. package/core/test/core_module_test.mjs +23 -0
  75. package/core/test/debug_test.mjs +16 -0
  76. package/core/test/dncl_test.mjs +94 -0
  77. package/core/test/error_message_test.mjs +210 -0
  78. package/core/test/error_test.mjs +16 -0
  79. package/core/test/flow_test.mjs +373 -0
  80. package/core/test/func_call.mjs +160 -0
  81. package/core/test/func_test.mjs +149 -0
  82. package/core/test/indent_test.mjs +364 -0
  83. package/core/test/lex_test.mjs +168 -0
  84. package/core/test/literal_test.mjs +73 -0
  85. package/core/test/nako_lexer_test.mjs +35 -0
  86. package/core/test/nako_logger_test.mjs +76 -0
  87. package/core/test/nako_logger_test.mts +78 -0
  88. package/core/test/plugin_csv_test.mjs +38 -0
  89. package/core/test/plugin_promise_test.mjs +18 -0
  90. package/core/test/plugin_system_test.mjs +630 -0
  91. package/core/test/prepare_test.mjs +96 -0
  92. package/core/test/re_test.mjs +22 -0
  93. package/core/test/side_effects_test.mjs +92 -0
  94. package/core/test/variable_scope_test.mjs +149 -0
  95. package/core/tsconfig.json +101 -0
  96. package/package.json +4 -2
  97. package/release/_hash.txt +12 -12
  98. package/release/_script-tags.txt +14 -14
  99. package/release/editor.js +1 -1
  100. package/release/stats.json +1 -1
  101. package/release/version.js +1 -1
  102. package/release/wnako3.js +1 -1
  103. package/src/nako_version.mjs +2 -2
  104. package/src/nako_version.mts +2 -2
  105. package/test/async/async_basic_test.mjs +3 -3
@@ -0,0 +1,49 @@
1
+ import { options, parse, stringify } from './nako_csv.mjs';
2
+ const PluginCSV = {
3
+ '初期化': {
4
+ type: 'func',
5
+ josi: [],
6
+ pure: true,
7
+ fn: function () {
8
+ // 基本的に初期化不要
9
+ }
10
+ },
11
+ // @CSV操作
12
+ 'CSV取得': {
13
+ type: 'func',
14
+ josi: [['を', 'の', 'で']],
15
+ pure: true,
16
+ fn: function (str) {
17
+ options.delimiter = ',';
18
+ return parse(str);
19
+ }
20
+ },
21
+ 'TSV取得': {
22
+ type: 'func',
23
+ josi: [['を', 'の', 'で']],
24
+ pure: true,
25
+ fn: function (str) {
26
+ options.delimiter = '\t';
27
+ return parse(str);
28
+ }
29
+ },
30
+ '表CSV変換': {
31
+ type: 'func',
32
+ josi: [['を']],
33
+ pure: true,
34
+ fn: function (a) {
35
+ options.delimiter = ',';
36
+ return stringify(a);
37
+ }
38
+ },
39
+ '表TSV変換': {
40
+ type: 'func',
41
+ josi: [['を']],
42
+ pure: true,
43
+ fn: function (a) {
44
+ options.delimiter = '\t';
45
+ return stringify(a);
46
+ }
47
+ }
48
+ };
49
+ export default PluginCSV;
@@ -0,0 +1,50 @@
1
+ import { options, parse, stringify } from './nako_csv.mjs'
2
+
3
+ const PluginCSV = {
4
+ '初期化': {
5
+ type: 'func',
6
+ josi: [],
7
+ pure: true,
8
+ fn: function (): void {
9
+ // 基本的に初期化不要
10
+ }
11
+ },
12
+ // @CSV操作
13
+ 'CSV取得': { // @CSV形式のデータstrを強制的に二次元配列に変換して返す // @CSVしゅとく
14
+ type: 'func',
15
+ josi: [['を', 'の', 'で']],
16
+ pure: true,
17
+ fn: function (str: string): string[][] {
18
+ options.delimiter = ','
19
+ return parse(str)
20
+ }
21
+ },
22
+ 'TSV取得': { // @TSV形式のデータstrを強制的に二次元配列に変換して返す // @TSVしゅとく
23
+ type: 'func',
24
+ josi: [['を', 'の', 'で']],
25
+ pure: true,
26
+ fn: function (str: string): string[][] {
27
+ options.delimiter = '\t'
28
+ return parse(str)
29
+ }
30
+ },
31
+ '表CSV変換': { // @二次元配列AをCSV形式に変換して返す // @ひょうCSVへんかん
32
+ type: 'func',
33
+ josi: [['を']],
34
+ pure: true,
35
+ fn: function (a: string[][]): string {
36
+ options.delimiter = ','
37
+ return stringify(a)
38
+ }
39
+ },
40
+ '表TSV変換': { // @二次元配列AをTSV形式に変換して返す // @ひょうTSVへんかん
41
+ type: 'func',
42
+ josi: [['を']],
43
+ pure: true,
44
+ fn: function (a: string[][]): string {
45
+ options.delimiter = '\t'
46
+ return stringify(a)
47
+ }
48
+ }
49
+ }
50
+ export default PluginCSV
@@ -0,0 +1,328 @@
1
+ /** plugin_math */
2
+ export default {
3
+ '初期化': {
4
+ type: 'func',
5
+ josi: [],
6
+ pure: true,
7
+ fn: function () {
8
+ // 初期化不要
9
+ }
10
+ },
11
+ // @三角関数
12
+ 'SIN': {
13
+ type: 'func',
14
+ josi: [['の']],
15
+ pure: true,
16
+ fn: function (v) {
17
+ return Math.sin(v);
18
+ }
19
+ },
20
+ 'COS': {
21
+ type: 'func',
22
+ josi: [['の']],
23
+ pure: true,
24
+ fn: function (v) {
25
+ return Math.cos(v);
26
+ }
27
+ },
28
+ 'TAN': {
29
+ type: 'func',
30
+ josi: [['の']],
31
+ pure: true,
32
+ fn: function (v) {
33
+ return Math.tan(v);
34
+ }
35
+ },
36
+ 'ARCSIN': {
37
+ type: 'func',
38
+ josi: [['の']],
39
+ pure: true,
40
+ fn: function (v) {
41
+ return Math.asin(v);
42
+ }
43
+ },
44
+ 'ARCCOS': {
45
+ type: 'func',
46
+ josi: [['の']],
47
+ pure: true,
48
+ fn: function (v) {
49
+ return Math.acos(v);
50
+ }
51
+ },
52
+ 'ARCTAN': {
53
+ type: 'func',
54
+ josi: [['の']],
55
+ pure: true,
56
+ fn: function (v) {
57
+ return Math.atan(v);
58
+ }
59
+ },
60
+ 'ATAN2': {
61
+ type: 'func',
62
+ josi: [['と'], ['の']],
63
+ pure: true,
64
+ fn: function (y, x) {
65
+ return Math.atan2(y, x);
66
+ }
67
+ },
68
+ '座標角度計算': {
69
+ type: 'func',
70
+ josi: [['の']],
71
+ pure: true,
72
+ fn: function (XY) {
73
+ return Math.atan2(XY[1], XY[0]) * 180 / Math.PI;
74
+ }
75
+ },
76
+ 'RAD2DEG': {
77
+ type: 'func',
78
+ josi: [['を']],
79
+ pure: true,
80
+ fn: function (v) {
81
+ return v / Math.PI * 180;
82
+ }
83
+ },
84
+ 'DEG2RAD': {
85
+ type: 'func',
86
+ josi: [['を']],
87
+ pure: true,
88
+ fn: function (v) {
89
+ return (v / 180) * Math.PI;
90
+ }
91
+ },
92
+ '度変換': {
93
+ type: 'func',
94
+ josi: [['を']],
95
+ pure: true,
96
+ fn: function (v) {
97
+ return v / Math.PI * 180;
98
+ }
99
+ },
100
+ 'ラジアン変換': {
101
+ type: 'func',
102
+ josi: [['を']],
103
+ pure: true,
104
+ fn: function (v) {
105
+ return (v / 180) * Math.PI;
106
+ }
107
+ },
108
+ // @算術関数
109
+ 'SIGN': {
110
+ type: 'func',
111
+ josi: [['の']],
112
+ pure: true,
113
+ fn: function (v) {
114
+ return (parseFloat(v) === 0) ? 0 : (v > 0) ? 1 : -1;
115
+ }
116
+ },
117
+ '符号': {
118
+ type: 'func',
119
+ josi: [['の']],
120
+ pure: false,
121
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
122
+ fn: function (v, sys) {
123
+ return sys.__exec('SIGN', [v]);
124
+ }
125
+ },
126
+ 'ABS': {
127
+ type: 'func',
128
+ josi: [['の']],
129
+ pure: true,
130
+ fn: function (a) {
131
+ return Math.abs(a);
132
+ }
133
+ },
134
+ '絶対値': {
135
+ type: 'func',
136
+ josi: [['の']],
137
+ pure: true,
138
+ fn: function (a) {
139
+ return Math.abs(a);
140
+ }
141
+ },
142
+ 'EXP': {
143
+ type: 'func',
144
+ josi: [['の']],
145
+ pure: true,
146
+ fn: function (a) {
147
+ return Math.exp(a);
148
+ }
149
+ },
150
+ 'HYPOT': {
151
+ type: 'func',
152
+ josi: [['と'], ['の']],
153
+ pure: true,
154
+ fn: function (a, b) {
155
+ return Math.hypot(a, b);
156
+ }
157
+ },
158
+ '斜辺': {
159
+ type: 'func',
160
+ josi: [['と'], ['の']],
161
+ pure: true,
162
+ fn: function (a, b) {
163
+ return Math.hypot(a, b);
164
+ }
165
+ },
166
+ 'LN': {
167
+ type: 'func',
168
+ josi: [['の']],
169
+ pure: true,
170
+ fn: function (a) {
171
+ return Math.log(a);
172
+ }
173
+ },
174
+ 'LOG': {
175
+ type: 'func',
176
+ josi: [['の']],
177
+ pure: true,
178
+ fn: function (a) {
179
+ return Math.log(a);
180
+ }
181
+ },
182
+ 'LOGN': {
183
+ type: 'func',
184
+ josi: [['で'], ['の']],
185
+ pure: true,
186
+ fn: function (a, b) {
187
+ if (a === 2) {
188
+ return Math.LOG2E * Math.log(b);
189
+ }
190
+ if (a === 10) {
191
+ return Math.LOG10E * Math.log(b);
192
+ }
193
+ return Math.log(b) / Math.log(a);
194
+ }
195
+ },
196
+ 'FRAC': {
197
+ type: 'func',
198
+ josi: [['の']],
199
+ pure: true,
200
+ fn: function (a) {
201
+ return a % 1;
202
+ }
203
+ },
204
+ '小数部分': {
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 Math.trunc(a);
218
+ }
219
+ },
220
+ '乱数': {
221
+ type: 'func',
222
+ josi: [['の']],
223
+ pure: true,
224
+ fn: function (a) {
225
+ return Math.floor(Math.random() * a);
226
+ }
227
+ },
228
+ '乱数範囲': {
229
+ type: 'func',
230
+ josi: [['から'], ['までの', 'の']],
231
+ pure: true,
232
+ fn: function (a, b) {
233
+ return (Math.floor(Math.random() * (b - a + 1)) + a);
234
+ }
235
+ },
236
+ 'SQRT': {
237
+ type: 'func',
238
+ josi: [['の']],
239
+ pure: true,
240
+ fn: function (a) {
241
+ return Math.sqrt(a);
242
+ }
243
+ },
244
+ '平方根': {
245
+ type: 'func',
246
+ josi: [['の']],
247
+ pure: true,
248
+ fn: function (a) {
249
+ return Math.sqrt(a);
250
+ }
251
+ },
252
+ // @数値切上切捨丸め
253
+ 'ROUND': {
254
+ type: 'func',
255
+ josi: [['を']],
256
+ pure: true,
257
+ fn: function (v) {
258
+ return Math.round(v);
259
+ }
260
+ },
261
+ '四捨五入': {
262
+ type: 'func',
263
+ josi: [['を', 'の']],
264
+ pure: true,
265
+ fn: function (v) {
266
+ return Math.round(v);
267
+ }
268
+ },
269
+ '小数点切上': {
270
+ type: 'func',
271
+ josi: [['を'], ['で']],
272
+ pure: true,
273
+ fn: function (a, b) {
274
+ const base = Math.pow(10, b);
275
+ return Math.ceil(a * base) / base;
276
+ }
277
+ },
278
+ '小数点切下': {
279
+ type: 'func',
280
+ josi: [['を'], ['で']],
281
+ pure: true,
282
+ fn: function (a, b) {
283
+ const base = Math.pow(10, b);
284
+ return Math.floor(a * base) / base;
285
+ }
286
+ },
287
+ '小数点四捨五入': {
288
+ type: 'func',
289
+ josi: [['を'], ['で']],
290
+ pure: true,
291
+ fn: function (a, b) {
292
+ const base = Math.pow(10, b);
293
+ return Math.round(a * base) / base;
294
+ }
295
+ },
296
+ 'CEIL': {
297
+ type: 'func',
298
+ josi: [['を']],
299
+ pure: true,
300
+ fn: function (v) {
301
+ return Math.ceil(v);
302
+ }
303
+ },
304
+ '切上': {
305
+ type: 'func',
306
+ josi: [['を']],
307
+ pure: true,
308
+ fn: function (v) {
309
+ return Math.ceil(v);
310
+ }
311
+ },
312
+ 'FLOOR': {
313
+ type: 'func',
314
+ josi: [['を']],
315
+ pure: true,
316
+ fn: function (v) {
317
+ return Math.floor(v);
318
+ }
319
+ },
320
+ '切捨': {
321
+ type: 'func',
322
+ josi: [['を']],
323
+ pure: true,
324
+ fn: function (v) {
325
+ return Math.floor(v);
326
+ }
327
+ }
328
+ };