nadesiko3 3.7.13 → 3.7.14

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 (127) hide show
  1. package/batch/command.txt +473 -473
  2. package/batch/jsplugin2text.nako3 +2 -0
  3. package/core/package.json +1 -1
  4. package/core/src/nako3.mjs +0 -4
  5. package/core/src/nako3.mts +55 -55
  6. package/core/src/nako_ast.mjs +0 -1
  7. package/core/src/nako_ast.mts +1 -1
  8. package/core/src/nako_colors.mjs +0 -1
  9. package/core/src/nako_colors.mts +1 -1
  10. package/core/src/nako_core_version.mjs +2 -2
  11. package/core/src/nako_core_version.mts +2 -2
  12. package/core/src/nako_csv.mjs +0 -1
  13. package/core/src/nako_csv.mts +9 -9
  14. package/core/src/nako_errors.mts +8 -8
  15. package/core/src/nako_from_dncl.mts +5 -5
  16. package/core/src/nako_from_dncl2.mjs +0 -1
  17. package/core/src/nako_from_dncl2.mts +5 -5
  18. package/core/src/nako_gen.mjs +13 -15
  19. package/core/src/nako_gen.mts +224 -220
  20. package/core/src/nako_global.mts +11 -11
  21. package/core/src/nako_indent.mts +92 -92
  22. package/core/src/nako_indent_chars.mts +1 -1
  23. package/core/src/nako_indent_inline.mjs +11 -11
  24. package/core/src/nako_indent_inline.mts +20 -20
  25. package/core/src/nako_lex_rules.mjs +0 -1
  26. package/core/src/nako_lex_rules.mts +8 -8
  27. package/core/src/nako_lexer.mjs +0 -1
  28. package/core/src/nako_lexer.mts +23 -23
  29. package/core/src/nako_logger.mjs +1 -1
  30. package/core/src/nako_logger.mts +38 -38
  31. package/core/src/nako_parser3.mjs +4 -5
  32. package/core/src/nako_parser3.mts +79 -79
  33. package/core/src/nako_parser_base.mjs +1 -1
  34. package/core/src/nako_parser_base.mts +68 -68
  35. package/core/src/nako_parser_const.mjs +0 -1
  36. package/core/src/nako_parser_const.mts +1 -1
  37. package/core/src/nako_prepare.mts +12 -12
  38. package/core/src/nako_source_mapping.mts +9 -9
  39. package/core/src/nako_token.mjs +0 -1
  40. package/core/src/nako_token.mts +2 -2
  41. package/core/src/nako_tools.mjs +0 -1
  42. package/core/src/nako_tools.mts +4 -4
  43. package/core/src/nako_types.mjs +0 -1
  44. package/core/src/nako_types.mts +3 -3
  45. package/core/src/plugin_api.mjs +0 -1
  46. package/core/src/plugin_api.mts +1 -1
  47. package/core/src/plugin_csv.mjs +0 -1
  48. package/core/src/plugin_csv.mts +7 -7
  49. package/core/src/plugin_math.mjs +0 -1
  50. package/core/src/plugin_math.mts +39 -40
  51. package/core/src/plugin_promise.mjs +1 -1
  52. package/core/src/plugin_promise.mts +9 -9
  53. package/core/src/plugin_system.mjs +1 -10
  54. package/core/src/plugin_system.mts +319 -321
  55. package/core/src/plugin_test.mjs +0 -2
  56. package/core/src/plugin_test.mts +6 -6
  57. package/core/src/plugin_toml.mjs +1 -1
  58. package/core/src/plugin_toml.mts +4 -4
  59. package/core/test/flow_test.mjs +22 -0
  60. package/package.json +31 -34
  61. package/release/_hash.txt +24 -24
  62. package/release/_script-tags.txt +16 -16
  63. package/release/command_cnako3.json +1 -1
  64. package/release/edit_main.js +33 -21
  65. package/release/edit_main.js.map +4 -4
  66. package/release/editor.js +33 -21
  67. package/release/plugin_keigo.js.map +2 -2
  68. package/release/plugin_turtle.js.map +2 -2
  69. package/release/plugin_weykturtle3d.js.map +2 -2
  70. package/release/version.js +29 -17
  71. package/release/version_main.js +29 -17
  72. package/release/version_main.js.map +4 -4
  73. package/release/wnako3.js +51 -44
  74. package/release/wnako3.js.map +3 -3
  75. package/release/wnako3webworker.js +45 -38
  76. package/release/wnako3webworker.js.map +2 -2
  77. package/src/cnako3.mts +1 -1
  78. package/src/cnako3mod.mjs +4 -7
  79. package/src/cnako3mod.mts +24 -24
  80. package/src/commander_ja.mts +8 -8
  81. package/src/deno_wrapper.mjs +0 -1
  82. package/src/deno_wrapper.mts +5 -5
  83. package/src/nako_version.mjs +2 -2
  84. package/src/nako_version.mts +2 -2
  85. package/src/plugin_browser.mjs +21 -29
  86. package/src/plugin_browser.mts +30 -35
  87. package/src/plugin_browser_ajax.mts +27 -27
  88. package/src/plugin_browser_audio.mjs +0 -1
  89. package/src/plugin_browser_audio.mts +11 -11
  90. package/src/plugin_browser_camera.mts +8 -8
  91. package/src/plugin_browser_canvas.mjs +0 -2
  92. package/src/plugin_browser_canvas.mts +34 -34
  93. package/src/plugin_browser_chart.mjs +0 -1
  94. package/src/plugin_browser_chart.mts +13 -13
  95. package/src/plugin_browser_color.mts +2 -2
  96. package/src/plugin_browser_crypto.mts +5 -5
  97. package/src/plugin_browser_dialog.mts +4 -4
  98. package/src/plugin_browser_dom_basic.mts +42 -42
  99. package/src/plugin_browser_dom_event.mjs +0 -1
  100. package/src/plugin_browser_dom_event.mts +27 -28
  101. package/src/plugin_browser_dom_parts.mjs +0 -2
  102. package/src/plugin_browser_dom_parts.mts +31 -31
  103. package/src/plugin_browser_geolocation.mts +3 -3
  104. package/src/plugin_browser_hotkey.mts +3 -3
  105. package/src/plugin_browser_html.mts +4 -4
  106. package/src/plugin_browser_in_worker.mts +1 -1
  107. package/src/plugin_browser_location.mts +2 -2
  108. package/src/plugin_browser_speech.mts +7 -7
  109. package/src/plugin_browser_storage.mts +11 -11
  110. package/src/plugin_browser_system.mts +2 -2
  111. package/src/plugin_browser_websocket.mts +6 -6
  112. package/src/plugin_httpserver.mts +17 -17
  113. package/src/plugin_keigo.mts +5 -5
  114. package/src/plugin_node.mjs +7 -48
  115. package/src/plugin_node.mts +114 -145
  116. package/src/plugin_turtle.mts +143 -143
  117. package/src/plugin_weykturtle3d.mjs +0 -3
  118. package/src/plugin_weykturtle3d.mts +135 -135
  119. package/src/plugin_weykturtle3d_three.mjs +0 -1
  120. package/src/plugin_weykturtle3d_three.mts +1 -1
  121. package/src/plugin_weykturtle3d_threeutil.mts +3 -3
  122. package/src/wnako3.mjs +0 -1
  123. package/src/wnako3.mts +1 -1
  124. package/src/wnako3_editor.mjs +0 -2
  125. package/src/wnako3_editor.mts +132 -132
  126. package/src/wnako3mod.mjs +0 -5
  127. package/src/wnako3mod.mts +19 -19
@@ -33,7 +33,7 @@ export class NakoGlobal {
33
33
  * @param compiler
34
34
  * @param gen
35
35
  */
36
- constructor (compiler: NakoCompiler, gen: NakoGen, guid = 0) {
36
+ constructor(compiler: NakoCompiler, gen: NakoGen, guid = 0) {
37
37
  this.guid = guid
38
38
  this.lastJSCode = ''
39
39
  // ユーザーのプログラムから編集される変数
@@ -70,11 +70,11 @@ export class NakoGlobal {
70
70
  this.reservedWords = compiler.reservedWords
71
71
  }
72
72
 
73
- clearLog () {
73
+ clearLog() {
74
74
  this.__varslist[0].set('表示ログ', '')
75
75
  }
76
76
 
77
- get log () {
77
+ get log() {
78
78
  let s = this.__varslist[0].get('表示ログ')
79
79
  s = s.replace(/\s+$/, '')
80
80
  return s
@@ -85,7 +85,7 @@ export class NakoGlobal {
85
85
  * @param name システム変数名
86
86
  * @param value 設定したい値
87
87
  */
88
- __setSysVar (name: string, value: any) {
88
+ __setSysVar(name: string, value: any) {
89
89
  this.__varslist[0].set(name, value)
90
90
  }
91
91
 
@@ -94,21 +94,21 @@ export class NakoGlobal {
94
94
  * @param name システム変数名
95
95
  * @returns システム変数の値
96
96
  */
97
- __getSysVar (name: string): any {
97
+ __getSysVar(name: string): any {
98
98
  return this.__varslist[0].get(name)
99
99
  }
100
100
 
101
101
  /**
102
102
  * 「ナデシコ」命令のためのメソッド
103
103
  */
104
- runEx (code: string, fname: string, opts: CompilerOptions, preCode = ''): NakoGlobal {
104
+ runEx(code: string, fname: string, opts: CompilerOptions, preCode = ''): NakoGlobal {
105
105
  // スコープを共有して実行
106
106
  opts.preCode = preCode
107
107
  opts.nakoGlobal = this
108
108
  return this.compiler.runSync(code, fname, opts)
109
109
  }
110
110
 
111
- async runAsync (code: string, fname: string, opts: CompilerOptions, preCode = ''): Promise<NakoGlobal> {
111
+ async runAsync(code: string, fname: string, opts: CompilerOptions, preCode = ''): Promise<NakoGlobal> {
112
112
  // スコープを共有して実行
113
113
  opts.preCode = preCode
114
114
  opts.nakoGlobal = this
@@ -119,7 +119,7 @@ export class NakoGlobal {
119
119
  * テスト実行のためのメソッド
120
120
  * @param {{ name: string, f: () => void }[]} tests
121
121
  */
122
- _runTests (tests: {name: string, f: () => void }[]): void {
122
+ _runTests(tests: {name: string, f: () => void }[]): void {
123
123
  let text = `${NakoColors.color.bold}テストの実行結果${NakoColors.color.reset}\n`
124
124
  let pass = 0
125
125
  let numFailures = 0
@@ -146,7 +146,7 @@ export class NakoGlobal {
146
146
  /**
147
147
  * 毎プラグインの「!クリア」関数を実行
148
148
  */
149
- clearPlugins () {
149
+ clearPlugins() {
150
150
  // 実行している関数をすべて終了させる
151
151
  // プラグインのクリア関数を呼び出す
152
152
  const clearName = '!クリア'
@@ -165,11 +165,11 @@ export class NakoGlobal {
165
165
  /**
166
166
  * 各種リセット処理
167
167
  */
168
- reset () {
168
+ reset() {
169
169
  this.clearPlugins()
170
170
  }
171
171
 
172
- destroy () {
172
+ destroy() {
173
173
  this.reset()
174
174
  }
175
175
  }
@@ -25,7 +25,7 @@ interface BlockStruct {
25
25
  /**
26
26
  * インデント構文指定があればコードを変換する
27
27
  */
28
- function convert (code: string, filename = 'main.nako3'): ConvertResult {
28
+ function convert(code: string, filename = 'main.nako3'): ConvertResult {
29
29
  // インデント構文の適用が必要か?
30
30
  if (checkNakoMode(code, INDENT_MODE_KEYWORDS)) {
31
31
  return convertForIndentMode(code, filename)
@@ -36,7 +36,7 @@ function convert (code: string, filename = 'main.nako3'): ConvertResult {
36
36
  /**
37
37
  * インデント構文指定があるかチェックする
38
38
  */
39
- function isIndentSyntaxEnabled (code: string): boolean {
39
+ function isIndentSyntaxEnabled(code: string): boolean {
40
40
  return checkNakoMode(code, INDENT_MODE_KEYWORDS)
41
41
  }
42
42
 
@@ -45,7 +45,7 @@ const defSpecialRetMark = '🍷🍷改行🍹黐黑鼘鼶齈▨🍺🍺🍶🍶'
45
45
  let SpecialRetMark = defSpecialRetMark
46
46
 
47
47
  /** code中にありえない改行マーク生成しモジュール内の変数SpecialRetMarkに設定 */
48
- export function checkSpecialRetMark (code: string): string {
48
+ export function checkSpecialRetMark(code: string): string {
49
49
  SpecialRetMark = defSpecialRetMark
50
50
  while (code.indexOf(SpecialRetMark) >= 0) {
51
51
  // 適当な文字を足してユニークにする(一応漢字領域で生成)
@@ -59,7 +59,7 @@ export function checkSpecialRetMark (code: string): string {
59
59
  * ソースコードのある1行の中のコメントを全て取り除く。
60
60
  * 事前にreplaceRetMarkによって文字列や範囲コメント内の改行文字が置換されている必要がある。
61
61
  */
62
- export function removeCommentsFromLine (src: string): string {
62
+ export function removeCommentsFromLine(src: string): string {
63
63
  const prepare = NakoPrepare.getInstance() // `※`, `//`, `/*` といったパターン全てに対応するために必要
64
64
  const len = src.length
65
65
  let result = ''
@@ -92,50 +92,50 @@ export function removeCommentsFromLine (src: string): string {
92
92
  }
93
93
  // 文字列の改行も無視する
94
94
  switch (cPrepared) {
95
- case '"':
96
- case '\'':
97
- eos = c
98
- result += c
99
- i++
100
- continue
101
- case '「':
102
- eos = '」'
103
- result += c
104
- i++
105
- continue
106
- case '『':
107
- eos = '』'
108
- result += c
109
- i++
110
- continue
111
- case '“':
112
- eos = '”'
113
- result += c
114
- i++
115
- continue
116
- case '{':
117
- eos = '}'
118
- result += c
119
- i++
120
- continue
121
- case '[':
122
- eos = ']'
123
- result += c
124
- i++
125
- continue
95
+ case '"':
96
+ case '\'':
97
+ eos = c
98
+ result += c
99
+ i++
100
+ continue
101
+ case '「':
102
+ eos = '」'
103
+ result += c
104
+ i++
105
+ continue
106
+ case '『':
107
+ eos = '』'
108
+ result += c
109
+ i++
110
+ continue
111
+ case '“':
112
+ eos = '”'
113
+ result += c
114
+ i++
115
+ continue
116
+ case '{':
117
+ eos = '}'
118
+ result += c
119
+ i++
120
+ continue
121
+ case '[':
122
+ eos = ']'
123
+ result += c
124
+ i++
125
+ continue
126
126
  }
127
127
 
128
128
  switch (ch2) {
129
- case '🌴':
130
- eos = '🌴'
131
- result += ch2
132
- i += 2
133
- continue
134
- case '🌿':
135
- eos = '🌿'
136
- result += ch2
137
- i += 2
138
- continue
129
+ case '🌴':
130
+ eos = '🌴'
131
+ result += ch2
132
+ i += 2
133
+ continue
134
+ case '🌿':
135
+ eos = '🌿'
136
+ result += ch2
137
+ i += 2
138
+ continue
139
139
  }
140
140
 
141
141
  // 行コメント
@@ -167,7 +167,7 @@ export function removeCommentsFromLine (src: string): string {
167
167
  }
168
168
 
169
169
  /** インデントモードのための変換処理 */
170
- function convertForIndentMode (code: string, filename: string): any {
170
+ function convertForIndentMode(code: string, filename: string): any {
171
171
  // returns => {{ code: string, insertedLines: number[], deletedLines: { lineNumber: number, len: number }[] }}
172
172
  const insertedLines: number[] = []
173
173
  const deletedLines: DeletedLine[] = []
@@ -279,7 +279,7 @@ function convertForIndentMode (code: string, filename: string): any {
279
279
  * count分だけ字下げする
280
280
  * @param {number} count
281
281
  */
282
- function makeIndent (count: number): string {
282
+ function makeIndent(count: number): string {
283
283
  let s = ''
284
284
  for (let i = 0; i < count; i++) {
285
285
  s += ' '
@@ -290,7 +290,7 @@ function makeIndent (count: number): string {
290
290
  /**
291
291
  * インデント部分を取り出す
292
292
  */
293
- export function getIndent (line: string): string {
293
+ export function getIndent(line: string): string {
294
294
  // eslint-disable-next-line no-irregular-whitespace
295
295
  const m = /^([  ・\t]*)/.exec(removeCommentsFromLine(line))
296
296
  if (!m) { return '' }
@@ -300,7 +300,7 @@ export function getIndent (line: string): string {
300
300
  /**
301
301
  * インデントの個数を数える
302
302
  */
303
- export function countIndent (line: string): number {
303
+ export function countIndent(line: string): number {
304
304
  let cnt = 0
305
305
  for (let i = 0; i < line.length; i++) {
306
306
  const ch = line.charAt(i)
@@ -325,7 +325,7 @@ export function countIndent (line: string): number {
325
325
  return cnt
326
326
  }
327
327
 
328
- export function replaceRetMark (src: string): string {
328
+ export function replaceRetMark(src: string): string {
329
329
  const prepare = NakoPrepare.getInstance() // `※`, `//`, `/*` といったパターン全てに対応するために必要
330
330
  const len = src.length
331
331
  let result = ''
@@ -356,50 +356,50 @@ export function replaceRetMark (src: string): string {
356
356
  }
357
357
  // 文字列の改行も無視する
358
358
  switch (cPrepared) {
359
- case '"':
360
- case '\'':
361
- eos = c
362
- result += c
363
- i++
364
- continue
365
- case '「':
366
- eos = '」'
367
- result += c
368
- i++
369
- continue
370
- case '『':
371
- eos = '』'
372
- result += c
373
- i++
374
- continue
375
- case '“':
376
- eos = '”'
377
- result += c
378
- i++
379
- continue
380
- case '{':
381
- eos = '}'
382
- result += c
383
- i++
384
- continue
385
- case '[':
386
- eos = ']'
387
- result += c
388
- i++
389
- continue
359
+ case '"':
360
+ case '\'':
361
+ eos = c
362
+ result += c
363
+ i++
364
+ continue
365
+ case '「':
366
+ eos = '」'
367
+ result += c
368
+ i++
369
+ continue
370
+ case '『':
371
+ eos = '』'
372
+ result += c
373
+ i++
374
+ continue
375
+ case '“':
376
+ eos = '”'
377
+ result += c
378
+ i++
379
+ continue
380
+ case '{':
381
+ eos = '}'
382
+ result += c
383
+ i++
384
+ continue
385
+ case '[':
386
+ eos = ']'
387
+ result += c
388
+ i++
389
+ continue
390
390
  }
391
391
 
392
392
  switch (ch2) {
393
- case '🌴':
394
- eos = '🌴'
395
- result += ch2
396
- i += 2
397
- continue
398
- case '🌿':
399
- eos = '🌿'
400
- result += ch2
401
- i += 2
402
- continue
393
+ case '🌴':
394
+ eos = '🌴'
395
+ result += ch2
396
+ i += 2
397
+ continue
398
+ case '🌿':
399
+ eos = '🌿'
400
+ result += ch2
401
+ i += 2
402
+ continue
403
403
  }
404
404
 
405
405
  // 行コメント
@@ -435,7 +435,7 @@ export function replaceRetMark (src: string): string {
435
435
  * 空白行や複数行にまたがる構文を考慮する。
436
436
  * インデント構文が有効化されていない場合にも使われる。
437
437
  */
438
- export function getBlockStructure (code: string): BlockStruct {
438
+ export function getBlockStructure(code: string): BlockStruct {
439
439
  const result: BlockStruct = {
440
440
  lines: [], // 各行のインデント量
441
441
  pairs: [],
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * なでしこ3で行頭インデントに使える文字とインデントカウント数
3
3
  */
4
- export function isIndentChars (ch: string): number {
4
+ export function isIndentChars(ch: string): number {
5
5
  const code = ch.charCodeAt(0)
6
6
  // 特別なコード
7
7
  if (ch === '\t') { return 4 }
@@ -1,6 +1,6 @@
1
1
  /** インデント構文を処理するモジュール */
2
- import { NewEmptyToken } from './nako_types.mjs';
3
2
  import { NakoIndentError } from '../src/nako_errors.mjs';
3
+ import { NewEmptyToken } from './nako_types.mjs';
4
4
  import { debugTokens, newToken } from './nako_tools.mjs';
5
5
  const IS_DEBUG = false;
6
6
  function isSkipWord(t) {
@@ -21,38 +21,38 @@ function removeJsonEol(tokens) {
21
21
  for (let i = 0; i < tokens.length; i++) {
22
22
  const t = tokens[i];
23
23
  // start of JSON
24
- if (t.type == '{') {
24
+ if (t.type === '{') {
25
25
  jsonObjLevel++;
26
- if (jsonStartIndent == -1) {
26
+ if (jsonStartIndent === -1) {
27
27
  jsonStartIndent = t.indent;
28
28
  }
29
29
  continue;
30
30
  }
31
- if (t.type == '[') {
31
+ if (t.type === '[') {
32
32
  jsonArrayLevel++;
33
- if (jsonStartIndent == -1) {
33
+ if (jsonStartIndent === -1) {
34
34
  jsonStartIndent = t.indent;
35
35
  }
36
36
  continue;
37
37
  }
38
38
  // end of JSON
39
- if (t.type == '}') {
39
+ if (t.type === '}') {
40
40
  jsonObjLevel--;
41
- if (jsonObjLevel == 0 && jsonArrayLevel == 0) {
41
+ if (jsonObjLevel === 0 && jsonArrayLevel === 0) {
42
42
  flagNeedResetIndent = true;
43
43
  }
44
44
  continue;
45
45
  }
46
- if (t.type == ']') {
46
+ if (t.type === ']') {
47
47
  jsonArrayLevel--;
48
- if (jsonObjLevel == 0 && jsonArrayLevel == 0) {
48
+ if (jsonObjLevel === 0 && jsonArrayLevel === 0) {
49
49
  flagNeedResetIndent = true;
50
50
  }
51
51
  continue;
52
52
  }
53
53
  if (jsonObjLevel > 0 || jsonArrayLevel > 0) {
54
54
  t.indent = jsonStartIndent;
55
- if (t.type == 'eol') {
55
+ if (t.type === 'eol') {
56
56
  // replace eol to comment
57
57
  t.type = 'range_comment';
58
58
  t.value = 'json::eol';
@@ -61,7 +61,7 @@ function removeJsonEol(tokens) {
61
61
  }
62
62
  if (flagNeedResetIndent) {
63
63
  t.indent = jsonStartIndent;
64
- if (t.type == 'eol') {
64
+ if (t.type === 'eol') {
65
65
  flagNeedResetIndent = false;
66
66
  jsonStartIndent = -1;
67
67
  }
@@ -1,12 +1,12 @@
1
1
  /** インデント構文を処理するモジュール */
2
2
 
3
- import { Token, NewEmptyToken } from './nako_types.mjs'
4
3
  import { NakoIndentError } from '../src/nako_errors.mjs'
4
+ import { Token, NewEmptyToken } from './nako_types.mjs'
5
5
  import { debugTokens, newToken } from './nako_tools.mjs'
6
6
 
7
7
  const IS_DEBUG = false
8
8
 
9
- function isSkipWord (t: Token): boolean {
9
+ function isSkipWord(t: Token): boolean {
10
10
  if (t.type === '違えば') { return true }
11
11
  if (t.type === 'word' && t.value === 'エラー' && t.josi === 'ならば') { return true }
12
12
  return false
@@ -21,38 +21,38 @@ function removeJsonEol(tokens: Token[]) {
21
21
  for (let i = 0; i < tokens.length; i++) {
22
22
  const t = tokens[i]
23
23
  // start of JSON
24
- if (t.type == '{') {
24
+ if (t.type === '{') {
25
25
  jsonObjLevel++
26
- if (jsonStartIndent == -1) {
26
+ if (jsonStartIndent === -1) {
27
27
  jsonStartIndent = t.indent
28
28
  }
29
29
  continue
30
30
  }
31
- if (t.type == '[') {
31
+ if (t.type === '[') {
32
32
  jsonArrayLevel++
33
- if (jsonStartIndent == -1) {
33
+ if (jsonStartIndent === -1) {
34
34
  jsonStartIndent = t.indent
35
35
  }
36
36
  continue
37
37
  }
38
38
  // end of JSON
39
- if (t.type == '}') {
39
+ if (t.type === '}') {
40
40
  jsonObjLevel--
41
- if (jsonObjLevel == 0 && jsonArrayLevel == 0) {
41
+ if (jsonObjLevel === 0 && jsonArrayLevel === 0) {
42
42
  flagNeedResetIndent = true
43
43
  }
44
44
  continue
45
45
  }
46
- if (t.type == ']') {
46
+ if (t.type === ']') {
47
47
  jsonArrayLevel--
48
- if (jsonObjLevel == 0 && jsonArrayLevel == 0) {
48
+ if (jsonObjLevel === 0 && jsonArrayLevel === 0) {
49
49
  flagNeedResetIndent = true
50
50
  }
51
51
  continue
52
52
  }
53
53
  if (jsonObjLevel > 0 || jsonArrayLevel > 0) {
54
54
  t.indent = jsonStartIndent
55
- if (t.type == 'eol') {
55
+ if (t.type === 'eol') {
56
56
  // replace eol to comment
57
57
  t.type = 'range_comment'
58
58
  t.value = 'json::eol'
@@ -61,7 +61,7 @@ function removeJsonEol(tokens: Token[]) {
61
61
  }
62
62
  if (flagNeedResetIndent) {
63
63
  t.indent = jsonStartIndent
64
- if (t.type == 'eol') {
64
+ if (t.type === 'eol') {
65
65
  flagNeedResetIndent = false
66
66
  jsonStartIndent = -1
67
67
  }
@@ -70,7 +70,7 @@ function removeJsonEol(tokens: Token[]) {
70
70
  }
71
71
 
72
72
  /** インラインインデント構文 --- 末尾の":"をインデントを考慮して"ここまで"を挿入 (#1215) */
73
- export function convertInlineIndent (tokens: Token[]): Token[] {
73
+ export function convertInlineIndent(tokens: Token[]): Token[] {
74
74
  //
75
75
  // 0:もし、A=0ならば:
76
76
  // 2: もし、B=0ならば:
@@ -147,7 +147,7 @@ export function convertInlineIndent (tokens: Token[]): Token[] {
147
147
  }
148
148
 
149
149
  /** 行ごとに分割していたトークンをくっつける */
150
- export function joinTokenLines (lines: Token[][]): Token[] {
150
+ export function joinTokenLines(lines: Token[][]): Token[] {
151
151
  const r: Token[] = []
152
152
  for (const line of lines) {
153
153
  for (const t of line) {
@@ -158,7 +158,7 @@ export function joinTokenLines (lines: Token[][]): Token[] {
158
158
  }
159
159
 
160
160
  // トークン行の最後のトークンを取得する
161
- function getLastTokenWithoutEOL (line: Token[]): Token {
161
+ function getLastTokenWithoutEOL(line: Token[]): Token {
162
162
  const len: number = line.length
163
163
  let res: Token = NewEmptyToken('?')
164
164
  if (len === 0) { return res }
@@ -173,7 +173,7 @@ function getLastTokenWithoutEOL (line: Token[]): Token {
173
173
  return res
174
174
  }
175
175
 
176
- export function splitTokens (tokens: Token[], delimiter: string): Token[][] {
176
+ export function splitTokens(tokens: Token[], delimiter: string): Token[][] {
177
177
  const result: Token[][] = []
178
178
  let line: Token[] = []
179
179
  let kakko = 0
@@ -195,7 +195,7 @@ export function splitTokens (tokens: Token[], delimiter: string): Token[][] {
195
195
  }
196
196
 
197
197
  /** トークン行が空かどうか調べる */
198
- function IsEmptyLine (line: Token[]): boolean {
198
+ function IsEmptyLine(line: Token[]): boolean {
199
199
  if (line.length === 0) { return true }
200
200
  for (let j = 0; j < line.length; j++) {
201
201
  const ty = line[j].type
@@ -206,7 +206,7 @@ function IsEmptyLine (line: Token[]): boolean {
206
206
  }
207
207
 
208
208
  /** コメントを除去した最初のトークンを返す */
209
- function GetLeftTokens (line: Token[]): Token {
209
+ function GetLeftTokens(line: Token[]): Token {
210
210
  for (let i = 0; i < line.length; i++) {
211
211
  const t = line[i].type
212
212
  if (t === 'eol' || t === 'line_comment' || t === 'range_comment') { continue }
@@ -219,7 +219,7 @@ function GetLeftTokens (line: Token[]): Token {
219
219
  const INDENT_MODE_KEYWORDS = ['!インデント構文', '!ここまでだるい', '💡インデント構文', '💡ここまでだるい']
220
220
 
221
221
  /** インデント構文 --- インデントを見て"ここまで"を自動挿入 (#596) */
222
- export function convertIndentSyntax (tokens: Token[]): Token[] {
222
+ export function convertIndentSyntax(tokens: Token[]): Token[] {
223
223
  // インデント構文の変換が必要か?
224
224
  if (!useIndentSynax(tokens)) { return tokens }
225
225
  // 『ここまで』があったらエラーを出す
@@ -321,7 +321,7 @@ export function convertIndentSyntax (tokens: Token[]): Token[] {
321
321
  return result
322
322
  }
323
323
 
324
- function useIndentSynax (tokens: Token[]) : boolean {
324
+ function useIndentSynax(tokens: Token[]) : boolean {
325
325
  // インデント構文が必要かチェック (最初の100個をチェック)
326
326
  for (let i = 0; i < tokens.length; i++) {
327
327
  if (i > 100) { break }
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  /**
3
2
  * なでしこ3字句解析のためのルール
4
3
  */
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+
2
2
  /**
3
3
  * なでしこ3字句解析のためのルール
4
4
  */
@@ -12,7 +12,7 @@ const allHiragana = /^[ぁ-ん]+$/
12
12
  const wordHasIjoIka = /^.+(以上|以下|超|未満)$/
13
13
  const wordSpecial = /^(かつ|または)/
14
14
  const errorRead = (ch: string): any => {
15
- return function () { throw new Error('突然の『' + ch + '』があります。') }
15
+ return function() { throw new Error('突然の『' + ch + '』があります。') }
16
16
  }
17
17
 
18
18
  // 数値の後の単位は自動的に省略されるルール (#994)
@@ -133,7 +133,7 @@ export const rules: NakoLexRule[] = [
133
133
  }
134
134
  ]
135
135
 
136
- export function trimOkurigana (s: string): string {
136
+ export function trimOkurigana(s: string): string {
137
137
  // ひらがなから始まらない場合、送り仮名を削除。(例)置換する
138
138
  if (!hira.test(s)) {
139
139
  return s.replace(/[ぁ-ん]+/g, '')
@@ -145,7 +145,7 @@ export function trimOkurigana (s: string): string {
145
145
  }
146
146
 
147
147
  // Utility for Rule
148
- function cbRangeComment (src: string): NakoLexParseResult {
148
+ function cbRangeComment(src: string): NakoLexParseResult {
149
149
  let res = ''
150
150
  const josi = ''
151
151
  let numEOL = 0
@@ -168,7 +168,7 @@ function cbRangeComment (src: string): NakoLexParseResult {
168
168
  /**
169
169
  * @param {string} src
170
170
  */
171
- function cbWordParser (src: string, isTrimOkurigana = true): NakoLexParseResult {
171
+ function cbWordParser(src: string, isTrimOkurigana = true): NakoLexParseResult {
172
172
  /*
173
173
  kanji = [\u3005\u4E00-\u9FCF]
174
174
  hiragana = [ぁ-ん]
@@ -246,7 +246,7 @@ function cbWordParser (src: string, isTrimOkurigana = true): NakoLexParseResult
246
246
  return { src, res, josi, numEOL: 0 }
247
247
  }
248
248
 
249
- function cbString (beginTag: string, closeTag: string, src: string): NakoLexParseResult {
249
+ function cbString(beginTag: string, closeTag: string, src: string): NakoLexParseResult {
250
250
  let res = ''
251
251
  let josi = ''
252
252
  let numEOL = 0
@@ -289,7 +289,7 @@ function cbString (beginTag: string, closeTag: string, src: string): NakoLexPars
289
289
  return { src, res, josi, numEOL }
290
290
  }
291
291
 
292
- function cbExtWord (src: string): NakoLexParseResult {
292
+ function cbExtWord(src: string): NakoLexParseResult {
293
293
  let res = ''
294
294
  let josi = ''
295
295
  let numEOL = 0
@@ -318,6 +318,6 @@ function cbExtWord (src: string): NakoLexParseResult {
318
318
  return { src, res, josi, numEOL }
319
319
  }
320
320
 
321
- function parseNumber (n: string): number {
321
+ function parseNumber(n: string): number {
322
322
  return Number(n.replace(/_/g, ''))
323
323
  }
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  // なでしこの字句解析を行う
3
2
  // 既に全角半角を揃えたコードに対して字句解析を行う
4
3
  import { opPriority } from './nako_parser_const.mjs';