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
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+
2
2
  /**
3
3
  * nadesiko v3 parser
4
4
  */
@@ -17,7 +17,7 @@ export class NakoParser extends NakoParserBase {
17
17
  /**
18
18
  * 構文解析を実行する
19
19
  */
20
- parse (tokens: Token[], filename: string): Ast {
20
+ parse(tokens: Token[], filename: string): Ast {
21
21
  this.reset()
22
22
  this.tokens = tokens
23
23
  this.modName = NakoLexer.filenameToModName(filename)
@@ -38,7 +38,7 @@ export class NakoParser extends NakoParserBase {
38
38
  }
39
39
 
40
40
  /** パーサーの一番最初に呼び出す構文規則 */
41
- startParser (): Ast {
41
+ startParser(): Ast {
42
42
  const b: Ast = this.ySentenceList()
43
43
  const c: Token|null = this.get()
44
44
  if (c && c.type !== 'eof') {
@@ -51,7 +51,7 @@ export class NakoParser extends NakoParserBase {
51
51
  /** 何もしない
52
52
  * @returns {Ast}
53
53
  */
54
- yNop (): Ast {
54
+ yNop(): Ast {
55
55
  return {
56
56
  type: 'nop',
57
57
  josi: '',
@@ -61,7 +61,7 @@ export class NakoParser extends NakoParserBase {
61
61
  }
62
62
 
63
63
  /** 複数文を返す */
64
- ySentenceList (): AstBlocks {
64
+ ySentenceList(): AstBlocks {
65
65
  const blocks = []
66
66
  let line = -1
67
67
  const map = this.peekSourceMap()
@@ -80,7 +80,7 @@ export class NakoParser extends NakoParserBase {
80
80
  }
81
81
 
82
82
  /** 余剰スタックのレポートを作る */
83
- makeStackBalanceReport (): string {
83
+ makeStackBalanceReport(): string {
84
84
  const words: string[] = []
85
85
  this.stack.forEach((t) => {
86
86
  let w = this.nodeToStr(t, { depth: 1 }, false)
@@ -109,7 +109,7 @@ export class NakoParser extends NakoParserBase {
109
109
  return `未解決の単語があります: [${desc}]\n次の命令の可能性があります:\n${descFunc}`
110
110
  }
111
111
 
112
- yEOL (): AstEol | null {
112
+ yEOL(): AstEol | null {
113
113
  // 行末のチェック #1009
114
114
  const eol = this.get()
115
115
  if (!eol) { return null }
@@ -129,7 +129,7 @@ export class NakoParser extends NakoParserBase {
129
129
  }
130
130
 
131
131
  /** @returns {Ast | null} */
132
- ySentence (): Ast | null {
132
+ ySentence(): Ast | null {
133
133
  const map: SourceMap = this.peekSourceMap()
134
134
 
135
135
  // 最初の語句が決まっている構文
@@ -197,14 +197,14 @@ export class NakoParser extends NakoParserBase {
197
197
  }
198
198
 
199
199
  /** [廃止] 非同期モード #11 @returns {Ast} */
200
- yASyncMode (): Ast {
200
+ yASyncMode(): Ast {
201
201
  this.logger.error('『非同期モード』構文は廃止されました(https://nadesi.com/v3/doc/go.php?1028)。', this.peek())
202
202
  const map = this.peekSourceMap()
203
203
  return { type: 'eol', ...map, end: this.peekSourceMap() }
204
204
  }
205
205
 
206
206
  /** set DNCL mode */
207
- yDNCLMode (ver: number): Ast {
207
+ yDNCLMode(ver: number): Ast {
208
208
  const map = this.peekSourceMap()
209
209
  if (ver === 1) {
210
210
  // 配列インデックスは1から
@@ -220,14 +220,14 @@ export class NakoParser extends NakoParserBase {
220
220
  }
221
221
 
222
222
  /** @returns {Ast} */
223
- ySetGenMode (mode: string): Ast {
223
+ ySetGenMode(mode: string): Ast {
224
224
  const map = this.peekSourceMap()
225
225
  this.genMode = mode
226
226
  return { type: 'eol', ...map, end: this.peekSourceMap() }
227
227
  }
228
228
 
229
229
  /** @returns {Ast} */
230
- yExportDefault (mode: string): Ast {
230
+ yExportDefault(mode: string): Ast {
231
231
  const map = this.peekSourceMap()
232
232
  this.isExportDefault = mode === '公開'
233
233
  this.moduleExport.set(this.modName, this.isExportDefault)
@@ -235,13 +235,13 @@ export class NakoParser extends NakoParserBase {
235
235
  }
236
236
 
237
237
  /** @returns {AstStrValue} */
238
- ySetMode (mode: string): AstStrValue {
238
+ ySetMode(mode: string): AstStrValue {
239
239
  const map = this.peekSourceMap()
240
240
  return { type: 'run_mode', value: mode, ...map, end: this.peekSourceMap() }
241
241
  }
242
242
 
243
243
  /** @returns {AstBlocks} */
244
- yBlock (): AstBlocks {
244
+ yBlock(): AstBlocks {
245
245
  const map = this.peekSourceMap()
246
246
  const blocks = []
247
247
  if (this.check('ここから')) { this.get() }
@@ -253,7 +253,7 @@ export class NakoParser extends NakoParserBase {
253
253
  return { type: 'block', blocks, josi: '', ...map, end: this.peekSourceMap() }
254
254
  }
255
255
 
256
- yDefFuncReadArgs (): Ast[]|null {
256
+ yDefFuncReadArgs(): Ast[]|null {
257
257
  if (!this.check('(')) { return null }
258
258
  const a: Ast[] = []
259
259
  this.get() // skip '('
@@ -269,18 +269,18 @@ export class NakoParser extends NakoParserBase {
269
269
  return a
270
270
  }
271
271
 
272
- yDefTest (): Ast|null {
272
+ yDefTest(): Ast|null {
273
273
  return this.yDefFuncCommon('def_test')
274
274
  }
275
275
 
276
- yDefFunc (): Ast|null {
276
+ yDefFunc(): Ast|null {
277
277
  return this.yDefFuncCommon('def_func')
278
278
  }
279
279
 
280
280
  /** ユーザー関数の定義
281
281
  * @returns {AstDefFunc | null}
282
282
  */
283
- yDefFuncCommon (type: NodeType): AstDefFunc | null {
283
+ yDefFuncCommon(type: NodeType): AstDefFunc | null {
284
284
  if (!this.check(type)) { // yDefFuncから呼ばれれば def_func なのかをチェックする
285
285
  return null
286
286
  }
@@ -296,7 +296,7 @@ export class NakoParser extends NakoParserBase {
296
296
  this.get()
297
297
  const funcAttribute: Token|null = this.get()
298
298
  if (this.check('}')) { this.get() } else { throw NakoSyntaxError.fromNode('関数の属性の指定が正しくありません。『{』と『}』で囲む必要があります。', def) }
299
- if (funcAttribute != null) {
299
+ if (funcAttribute !== null) {
300
300
  if (funcAttribute.value === '公開') { isExport = true }
301
301
  if (funcAttribute.value === '非公開') { isExport = false }
302
302
  if (funcAttribute.value === 'エクスポート') { isExport = true }
@@ -388,7 +388,7 @@ export class NakoParser extends NakoParserBase {
388
388
  }
389
389
 
390
390
  /** 「もし」文の条件を取得 */
391
- yIFCond (): Ast {
391
+ yIFCond(): Ast {
392
392
  const map = this.peekSourceMap()
393
393
  let a: Ast | null = this.yGetArg()
394
394
  if (!a) {
@@ -467,12 +467,12 @@ export class NakoParser extends NakoParserBase {
467
467
 
468
468
  /** もし文
469
469
  * @returns {AstIf | null} */
470
- yIF (): AstIf | null {
470
+ yIF(): AstIf | null {
471
471
  const map = this.peekSourceMap()
472
472
  // 「もし」があれば「もし」文である
473
473
  if (!this.check('もし')) { return null }
474
474
  const mosi:Token|null = this.get() // skip もし
475
- if (mosi == null) { return null }
475
+ if (mosi === null) { return null }
476
476
  while (this.check('comma')) { this.get() } // skip comma
477
477
  // 「もし」文の条件を取得
478
478
  let expr: Ast | null = null
@@ -487,7 +487,7 @@ export class NakoParser extends NakoParserBase {
487
487
  /** 「もし」文の「もし」以降の判定 ... 「もし」がなくても条件分岐は動くようになっている
488
488
  * @returns {AstIf | null}
489
489
  */
490
- yIfThen (expr: Ast, map: SourceMap): AstIf | null {
490
+ yIfThen(expr: Ast, map: SourceMap): AstIf | null {
491
491
  // 「もし」文の 真偽のブロックを取得
492
492
  let trueBlock: Ast = this.yNop()
493
493
  let falseBlock: Ast = this.yNop()
@@ -534,7 +534,7 @@ export class NakoParser extends NakoParserBase {
534
534
  }
535
535
  }
536
536
 
537
- ySpeedMode (): AstBlocks | null {
537
+ ySpeedMode(): AstBlocks | null {
538
538
  const map: SourceMap = this.peekSourceMap()
539
539
  if (!this.check2(['string', '実行速度優先'])) {
540
540
  return null
@@ -588,7 +588,7 @@ export class NakoParser extends NakoParserBase {
588
588
  }
589
589
  }
590
590
 
591
- yPerformanceMonitor (): AstBlocks | null {
591
+ yPerformanceMonitor(): AstBlocks | null {
592
592
  const map = this.peekSourceMap()
593
593
  if (!this.check2(['string', 'パフォーマンスモニタ適用'])) {
594
594
  return null
@@ -642,7 +642,7 @@ export class NakoParser extends NakoParserBase {
642
642
  }
643
643
 
644
644
  /** [廃止] #1611 「逐次実行」構文 @returns {Ast | null} */
645
- yTikuji (): Ast|null {
645
+ yTikuji(): Ast|null {
646
646
  if (!this.check('逐次実行')) { return null }
647
647
  const tikuji = this.getCur() // skip
648
648
  this.logger.error('『逐次実行』構文は廃止されました(https://nadesi.com/v3/doc/go.php?944)。', tikuji)
@@ -653,7 +653,7 @@ export class NakoParser extends NakoParserBase {
653
653
  * 1つ目の値を与え、その後に続く計算式を取得し、優先規則に沿って並び替えして戻す
654
654
  * @param {Ast} firstValue
655
655
  */
656
- yGetArgOperator (firstValue: Ast): Ast|null {
656
+ yGetArgOperator(firstValue: Ast): Ast|null {
657
657
  const args:Ast[] = [firstValue]
658
658
  while (!this.isEOF()) {
659
659
  // 演算子がある?
@@ -683,7 +683,7 @@ export class NakoParser extends NakoParserBase {
683
683
  * @param kara
684
684
  * @returns {AstCallFunc | null}
685
685
  */
686
- yRange (kara: Ast): AstCallFunc | null {
686
+ yRange(kara: Ast): AstCallFunc | null {
687
687
  // 範囲オブジェクト?
688
688
  if (!this.check('…')) { return null }
689
689
  const map = this.peekSourceMap()
@@ -709,7 +709,7 @@ export class NakoParser extends NakoParserBase {
709
709
  /**
710
710
  * 表示(関数)を返す 「??」のエイリアスで利用 (#1745)
711
711
  */
712
- yDebugPrint (): AstCallFunc | null {
712
+ yDebugPrint(): AstCallFunc | null {
713
713
  const map = this.peekSourceMap()
714
714
  const t = this.get() // skip '??'
715
715
  if (!t || t.value !== '??') {
@@ -733,7 +733,7 @@ export class NakoParser extends NakoParserBase {
733
733
  }
734
734
  }
735
735
 
736
- yGetArg (): Ast|null {
736
+ yGetArg(): Ast|null {
737
737
  // 値を一つ読む
738
738
  const value1 = this.yValue()
739
739
  if (value1 === null) { return null }
@@ -743,7 +743,7 @@ export class NakoParser extends NakoParserBase {
743
743
  return this.yGetArgOperator(value1)
744
744
  }
745
745
 
746
- infixToPolish (list: Ast[]): Ast[] {
746
+ infixToPolish(list: Ast[]): Ast[] {
747
747
  // 中間記法から逆ポーランドに変換
748
748
  const priority = (t: Ast) => {
749
749
  if (opPriority[t.type]) { return opPriority[t.type] }
@@ -775,7 +775,7 @@ export class NakoParser extends NakoParserBase {
775
775
  }
776
776
 
777
777
  /** @returns {Ast | null} */
778
- infixToAST (list: Ast[]): Ast | null {
778
+ infixToAST(list: Ast[]): Ast | null {
779
779
  if (list.length === 0) { return null }
780
780
  // 逆ポーランドを構文木に
781
781
  const josi = list[list.length - 1].josi
@@ -813,7 +813,7 @@ export class NakoParser extends NakoParserBase {
813
813
  return ans
814
814
  }
815
815
 
816
- yGetArgParen (y: Ast[]): Ast[] { // C言語風呼び出しでカッコの中を取得
816
+ yGetArgParen(y: Ast[]): Ast[] { // C言語風呼び出しでカッコの中を取得
817
817
  let isClose = false
818
818
  const si = this.stack.length
819
819
  while (!this.isEOF()) {
@@ -842,7 +842,7 @@ export class NakoParser extends NakoParserBase {
842
842
  }
843
843
 
844
844
  /** @returns {AstRepeatTimes | null} */
845
- yRepeatTime (): AstRepeatTimes | null {
845
+ yRepeatTime(): AstRepeatTimes | null {
846
846
  const map = this.peekSourceMap()
847
847
  if (!this.check('回')) { return null }
848
848
  this.get() // skip '回'
@@ -876,7 +876,7 @@ export class NakoParser extends NakoParserBase {
876
876
  }
877
877
 
878
878
  /** @returns {AstWhile | null} */
879
- yWhile (): AstWhile | null { // 「*の間」文
879
+ yWhile(): AstWhile | null { // 「*の間」文
880
880
  const map = this.peekSourceMap()
881
881
  if (!this.check('間')) { return null }
882
882
  this.get() // skip '間'
@@ -906,7 +906,7 @@ export class NakoParser extends NakoParserBase {
906
906
  }
907
907
 
908
908
  /** @returns {AstAtohantei | null} */
909
- yAtohantei (): AstAtohantei |null {
909
+ yAtohantei(): AstAtohantei |null {
910
910
  const map = this.peekSourceMap()
911
911
  if (this.check('後判定')) { this.get() } // skip 後判定
912
912
  if (this.check('繰返')) { this.get() } // skip 繰り返す
@@ -943,7 +943,7 @@ export class NakoParser extends NakoParserBase {
943
943
  }
944
944
 
945
945
  /** @returns {AstFor | null} */
946
- yFor (): AstFor | null {
946
+ yFor(): AstFor | null {
947
947
  const errorForArguments = '『繰り返す』文でAからBまでの指定がありません。'
948
948
  let flagDown = true // AからBまでの時、A>=Bを許容するかどうか
949
949
  let flagUp = true // AからBまでの時、A<=Bを許容するかどうか
@@ -991,7 +991,7 @@ export class NakoParser extends NakoParserBase {
991
991
  }
992
992
  if (vFrom === null || vTo === null) {
993
993
  // 『AからBの範囲を繰り返す』構文のとき (#1704)
994
- if (vFrom == null && vTo && (vTo.type === 'func' && vTo.name === '範囲')) {
994
+ if (vFrom === null && vTo && (vTo.type === 'func' && vTo.name === '範囲')) {
995
995
  // ok
996
996
  } else {
997
997
  throw NakoSyntaxError.fromNode(errorForArguments, kurikaesu)
@@ -1035,7 +1035,7 @@ export class NakoParser extends NakoParserBase {
1035
1035
  }
1036
1036
 
1037
1037
  /** @returns {AstBlocks | null} */
1038
- yReturn (): AstBlocks | null {
1038
+ yReturn(): AstBlocks | null {
1039
1039
  const map = this.peekSourceMap()
1040
1040
  if (!this.check('戻る')) { return null }
1041
1041
  this.get() // skip '戻る'
@@ -1053,7 +1053,7 @@ export class NakoParser extends NakoParserBase {
1053
1053
  }
1054
1054
 
1055
1055
  /** @returns {AstForeach | null} */
1056
- yForEach (): AstForeach |null {
1056
+ yForEach(): AstForeach |null {
1057
1057
  const map = this.peekSourceMap()
1058
1058
  if (!this.check('反復')) { return null }
1059
1059
  this.get() // skip '反復'
@@ -1100,7 +1100,7 @@ export class NakoParser extends NakoParserBase {
1100
1100
  /** 条件分岐構文
1101
1101
  * @returns {AstSwitch | null}
1102
1102
  */
1103
- ySwitch (): AstSwitch | null {
1103
+ ySwitch(): AstSwitch | null {
1104
1104
  const map = this.peekSourceMap()
1105
1105
  if (!this.check('条件分岐')) { return null }
1106
1106
  const joukenbunki = this.get() // skip '条件分岐'
@@ -1179,7 +1179,7 @@ export class NakoParser extends NakoParserBase {
1179
1179
  /** 無名関数
1180
1180
  * @returns {AstDefFunc|null}
1181
1181
  */
1182
- yMumeiFunc (): AstDefFunc | null { // 無名関数の定義
1182
+ yMumeiFunc(): AstDefFunc | null { // 無名関数の定義
1183
1183
  const map = this.peekSourceMap()
1184
1184
  if (!this.check('def_func')) { return null }
1185
1185
  const defToken = this.get()
@@ -1222,7 +1222,7 @@ export class NakoParser extends NakoParserBase {
1222
1222
  }
1223
1223
 
1224
1224
  /** 代入構文 */
1225
- yDainyu (): AstBlocks | null {
1225
+ yDainyu(): AstBlocks | null {
1226
1226
  const map = this.peekSourceMap()
1227
1227
  const dainyu = this.get() // 代入
1228
1228
  if (dainyu === null) { return null }
@@ -1262,7 +1262,7 @@ export class NakoParser extends NakoParserBase {
1262
1262
  }
1263
1263
 
1264
1264
  /** 定める構文 */
1265
- ySadameru (): AstBlocks | null {
1265
+ ySadameru(): AstBlocks | null {
1266
1266
  const map = this.peekSourceMap()
1267
1267
  const sadameru = this.get() // 定める
1268
1268
  if (sadameru === null) { return null }
@@ -1299,7 +1299,7 @@ export class NakoParser extends NakoParserBase {
1299
1299
  } as AstDefVar
1300
1300
  }
1301
1301
 
1302
- yIncDec (): AstBlocks | null {
1302
+ yIncDec(): AstBlocks | null {
1303
1303
  const map = this.peekSourceMap()
1304
1304
  const action = this.get() // (増やす|減らす)
1305
1305
  if (action === null) { return null }
@@ -1338,7 +1338,7 @@ export class NakoParser extends NakoParserBase {
1338
1338
  }
1339
1339
  }
1340
1340
 
1341
- yCall (): Ast | null {
1341
+ yCall(): Ast | null {
1342
1342
  if (this.isEOF()) { return null }
1343
1343
 
1344
1344
  // スタックに積んでいく
@@ -1427,7 +1427,7 @@ export class NakoParser extends NakoParserBase {
1427
1427
  }
1428
1428
 
1429
1429
  /** @returns {Ast | null} */
1430
- yCallFunc (): Ast | null {
1430
+ yCallFunc(): Ast | null {
1431
1431
  const map = this.peekSourceMap()
1432
1432
  const callToken = this.get()
1433
1433
  if (!callToken) { return null }
@@ -1518,7 +1518,7 @@ export class NakoParser extends NakoParserBase {
1518
1518
  const space = this.namespaceStack.pop()
1519
1519
  if (space) { this.modName = space }
1520
1520
  const isexport = this.isExportStack.pop()
1521
- if (isexport != null) { this.isExportDefault = isexport }
1521
+ if (isexport !== null && isexport !== undefined) { this.isExportDefault = isexport }
1522
1522
  }
1523
1523
 
1524
1524
  // 言い切りならそこで一度切る
@@ -1536,7 +1536,7 @@ export class NakoParser extends NakoParserBase {
1536
1536
  }
1537
1537
 
1538
1538
  /** @returns {Ast | null} */
1539
- yLet (): AstBlocks | null {
1539
+ yLet(): AstBlocks | null {
1540
1540
  const map = this.peekSourceMap()
1541
1541
  // 通常の変数
1542
1542
  if (this.check2(['word', 'eq'])) {
@@ -1851,7 +1851,7 @@ export class NakoParser extends NakoParserBase {
1851
1851
  * @param {Ast} node
1852
1852
  * @returns
1853
1853
  */
1854
- checkArrayIndex (node: Ast): Ast {
1854
+ checkArrayIndex(node: Ast): Ast {
1855
1855
  // 配列が0から始まるのであればそのまま返す
1856
1856
  if (this.arrayIndexFrom === 0) { return node }
1857
1857
  // 配列が1から始まるのであれば演算を加えて返す
@@ -1872,7 +1872,7 @@ export class NakoParser extends NakoParserBase {
1872
1872
  * 配列のインデックスを逆順にするのを考慮するか
1873
1873
  * @param {Ast[]| null} ary
1874
1874
  */
1875
- checkArrayReverse (ary: Ast[] | null): Ast[] {
1875
+ checkArrayReverse(ary: Ast[] | null): Ast[] {
1876
1876
  if (!ary) { return [] }
1877
1877
  if (!this.flagReverseArrayIndex) { return ary }
1878
1878
  // 二次元以上の配列変数のアクセスを[y][x]ではなく[x][y]と順序を変更する
@@ -1881,7 +1881,7 @@ export class NakoParser extends NakoParserBase {
1881
1881
  }
1882
1882
 
1883
1883
  /** @returns {AstLetArray | null} */
1884
- yLetArrayAt (map: SourceMap): AstLetArray | null {
1884
+ yLetArrayAt(map: SourceMap): AstLetArray | null {
1885
1885
  // 一次元配列
1886
1886
  if (this.accept(['word', '@', this.yValue, 'eq', this.yCalc])) {
1887
1887
  const astValue = this.y[4]
@@ -1954,7 +1954,7 @@ export class NakoParser extends NakoParserBase {
1954
1954
  }
1955
1955
 
1956
1956
  /** @returns {Ast | null} */
1957
- yLetArrayBracket (map: SourceMap): AstBlocks|null {
1957
+ yLetArrayBracket(map: SourceMap): AstBlocks|null {
1958
1958
  // 一次元配列
1959
1959
  if (this.accept(['word', '[', this.yCalc, ']', 'eq', this.yCalc])) {
1960
1960
  const astValue = this.y[5]
@@ -2091,9 +2091,9 @@ export class NakoParser extends NakoParserBase {
2091
2091
  }
2092
2092
  // 二次元配列 + 二次元オブジェクトプロパティ構文 --- word[a][b]$c$d = e
2093
2093
  if (this.accept([
2094
- 'word', '[', this.yCalc, ']', '[', this.yCalc, ']', // 0...6
2095
- '$', 'word', '$', 'word', 'eq', this.yCalc // 7...12
2096
- ])) {
2094
+ 'word', '[', this.yCalc, ']', '[', this.yCalc, ']', // 0...6
2095
+ '$', 'word', '$', 'word', 'eq', this.yCalc // 7...12
2096
+ ])) {
2097
2097
  const astVarName = this.y[0]
2098
2098
  const astIndex1 = this.y[2]
2099
2099
  const astIndex2 = this.y[5]
@@ -2116,7 +2116,7 @@ export class NakoParser extends NakoParserBase {
2116
2116
  }
2117
2117
 
2118
2118
  /** @returns {Ast | null} */
2119
- yCalc (): Ast|null {
2119
+ yCalc(): Ast|null {
2120
2120
  const map = this.peekSourceMap()
2121
2121
  if (this.check('eol')) { return null }
2122
2122
  // 値を一つ読む
@@ -2161,7 +2161,7 @@ export class NakoParser extends NakoParserBase {
2161
2161
  }
2162
2162
 
2163
2163
  /** @returns {Ast | null} */
2164
- yValueKakko (): Ast | null {
2164
+ yValueKakko(): Ast | null {
2165
2165
  if (!this.check('(')) { return null }
2166
2166
  const t = this.get() // skip '('
2167
2167
  if (!t) { throw new Error('[System Error] check したのに get できない') }
@@ -2187,7 +2187,7 @@ export class NakoParser extends NakoParserBase {
2187
2187
  return this.yRefArrayValue(v)
2188
2188
  }
2189
2189
 
2190
- yConst (tok: Token, map: SourceMap): Ast {
2190
+ yConst(tok: Token, map: SourceMap): Ast {
2191
2191
  // ['number', 'bigint', 'string']
2192
2192
  const astConst: AstConst = {
2193
2193
  type: tok.type as NodeType,
@@ -2199,7 +2199,7 @@ export class NakoParser extends NakoParserBase {
2199
2199
  }
2200
2200
 
2201
2201
  /** @returns {Ast | null} */
2202
- yValue (): Ast | null {
2202
+ yValue(): Ast | null {
2203
2203
  const map = this.peekSourceMap()
2204
2204
 
2205
2205
  // カンマなら飛ばす #877
@@ -2327,7 +2327,7 @@ export class NakoParser extends NakoParserBase {
2327
2327
  return null
2328
2328
  }
2329
2329
 
2330
- yValueWordGetIndex (ast: Ast): boolean {
2330
+ yValueWordGetIndex(ast: Ast): boolean {
2331
2331
  if (!ast.index) { ast.index = [] }
2332
2332
  // word @ a, b, c
2333
2333
  if (this.check('@')) {
@@ -2424,7 +2424,7 @@ export class NakoParser extends NakoParserBase {
2424
2424
  return false
2425
2425
  }
2426
2426
 
2427
- yValueWordGetProp (ast: Ast): boolean {
2427
+ yValueWordGetProp(ast: Ast): boolean {
2428
2428
  if (!ast.index) { ast.index = [] }
2429
2429
 
2430
2430
  if (this.accept(['$', 'word', '$', 'word'])) {
@@ -2457,7 +2457,7 @@ export class NakoParser extends NakoParserBase {
2457
2457
  }
2458
2458
 
2459
2459
  /** @returns {Ast | null} */
2460
- yValueFuncPointer (): Ast|null {
2460
+ yValueFuncPointer(): Ast|null {
2461
2461
  const map = this.peekSourceMap()
2462
2462
  if (this.check('func_pointer')) {
2463
2463
  const t = this.getCur()
@@ -2474,7 +2474,7 @@ export class NakoParser extends NakoParserBase {
2474
2474
  }
2475
2475
 
2476
2476
  /** @returns {Ast | null} */
2477
- yValueWord (): Ast|null {
2477
+ yValueWord(): Ast|null {
2478
2478
  const map = this.peekSourceMap()
2479
2479
  if (this.check('word')) {
2480
2480
  const t = this.getCur()
@@ -2522,7 +2522,7 @@ export class NakoParser extends NakoParserBase {
2522
2522
  }
2523
2523
 
2524
2524
  /** 変数を生成 */
2525
- createVar (word: Token|Ast, isConst: boolean, isExport: boolean): Token|Ast {
2525
+ createVar(word: Token|Ast, isConst: boolean, isExport: boolean): Token|Ast {
2526
2526
  let gname: string = (word as AstStrValue).value
2527
2527
  const typeName: FuncListItemType = isConst ? 'const' : 'var'
2528
2528
  if (this.funcLevel === 0) {
@@ -2544,7 +2544,7 @@ export class NakoParser extends NakoParserBase {
2544
2544
  * @param {Ast|Token} word
2545
2545
  * @return {Ast|Token}
2546
2546
  */
2547
- getVarName (word: Token|Ast): Token|Ast {
2547
+ getVarName(word: Token|Ast): Token|Ast {
2548
2548
  // check word name
2549
2549
  const f = this.findVar((word as AstStrValue).value)
2550
2550
  if (f) {
@@ -2557,7 +2557,7 @@ export class NakoParser extends NakoParserBase {
2557
2557
  }
2558
2558
 
2559
2559
  /** 変数名を検索して解決する */
2560
- getVarNameRef (word: Token): Token {
2560
+ getVarNameRef(word: Token): Token {
2561
2561
  // check word name
2562
2562
  const f = this.findVar(word.value)
2563
2563
  if (!f) { // 変数が見つからない
@@ -2571,14 +2571,14 @@ export class NakoParser extends NakoParserBase {
2571
2571
  }
2572
2572
 
2573
2573
  /** 複数の変数名を検索して解決する */
2574
- createVarList (words: Token[], isConst: boolean, isExport: boolean): Token[] {
2574
+ createVarList(words: Token[], isConst: boolean, isExport: boolean): Token[] {
2575
2575
  for (let i = 0; i < words.length; i++) {
2576
2576
  words[i] = this.createVar(words[i], isConst, isExport) as Token
2577
2577
  }
2578
2578
  return words
2579
2579
  }
2580
2580
 
2581
- yJSONObjectValue (): Ast[] {
2581
+ yJSONObjectValue(): Ast[] {
2582
2582
  // 戻り値の形式
2583
2583
  // Astblocks.blocks = [key1, value1, key2, value2, key3, value3 ...]
2584
2584
  const a: Ast[] = []
@@ -2613,13 +2613,13 @@ export class NakoParser extends NakoParserBase {
2613
2613
  }
2614
2614
 
2615
2615
  // 辞書型変数の取得
2616
- yJSONObject (): AstBlocks | Ast | null {
2616
+ yJSONObject(): AstBlocks | Ast | null {
2617
2617
  const a: Ast | AstBlocks | null = this.yJSONObjectRaw()
2618
2618
  if (!a) { return null }
2619
2619
  return this.yRefArrayValue(a)
2620
2620
  }
2621
2621
 
2622
- yJSONObjectRaw (): AstBlocks | null {
2622
+ yJSONObjectRaw(): AstBlocks | null {
2623
2623
  const map = this.peekSourceMap()
2624
2624
  if (this.accept(['{', '}'])) {
2625
2625
  return {
@@ -2651,7 +2651,7 @@ export class NakoParser extends NakoParserBase {
2651
2651
  return null
2652
2652
  }
2653
2653
 
2654
- yJSONArrayValue (): Ast[] {
2654
+ yJSONArrayValue(): Ast[] {
2655
2655
  if (this.check('eol')) { this.get() }
2656
2656
  // Arrayの最初の値
2657
2657
  const v1 = this.yCalc()
@@ -2671,7 +2671,7 @@ export class NakoParser extends NakoParserBase {
2671
2671
  }
2672
2672
 
2673
2673
  // 配列や(値)の直後にある配列アクセスやプロパティアクセスを調べる
2674
- yRefArrayValue (value: Ast): Ast | AstBlocks | null {
2674
+ yRefArrayValue(value: Ast): Ast | AstBlocks | null {
2675
2675
  let val: Ast = value
2676
2676
  for (;;) {
2677
2677
  // 配列の直後に@や[]があるか?
@@ -2712,7 +2712,7 @@ export class NakoParser extends NakoParserBase {
2712
2712
  return val
2713
2713
  }
2714
2714
 
2715
- yJSONArray (): AstBlocks | Ast | null {
2715
+ yJSONArray(): AstBlocks | Ast | null {
2716
2716
  // 配列を得る
2717
2717
  const a: Ast | null = this.yJSONArrayRaw()
2718
2718
  if (!a) { return null }
@@ -2720,7 +2720,7 @@ export class NakoParser extends NakoParserBase {
2720
2720
  }
2721
2721
 
2722
2722
  /** @returns {AstBlocks | null} */
2723
- yJSONArrayRaw (): AstBlocks | null {
2723
+ yJSONArrayRaw(): AstBlocks | null {
2724
2724
  const map = this.peekSourceMap()
2725
2725
  if (this.accept(['[', ']'])) {
2726
2726
  return {
@@ -2753,7 +2753,7 @@ export class NakoParser extends NakoParserBase {
2753
2753
  }
2754
2754
 
2755
2755
  /** エラー監視構文 */
2756
- yTryExcept (): AstBlocks | null {
2756
+ yTryExcept(): AstBlocks | null {
2757
2757
  const map = this.peekSourceMap()
2758
2758
  if (!this.check('エラー監視')) { return null }
2759
2759
  const kansi = this.getCur() // skip エラー監視
@@ -2783,7 +2783,7 @@ export class NakoParser extends NakoParserBase {
2783
2783
  }
2784
2784
 
2785
2785
  /** 関数ごとにasyncFnが必要か確認する */
2786
- _checkAsyncFn (node: Ast): boolean {
2786
+ _checkAsyncFn(node: Ast): boolean {
2787
2787
  if (!node) { return false }
2788
2788
  // 関数定義があれば関数
2789
2789
  if (node.type === 'def_func' || node.type === 'def_test' || node.type === 'func_obj') {
@@ -2847,7 +2847,7 @@ export class NakoParser extends NakoParserBase {
2847
2847
  /** TokenをそのままNodeに変換するメソッド(ただし簡単なものだけ対応)
2848
2848
  * @returns {Ast[]}
2849
2849
  */
2850
- _tokensToNodes (tokens: Token[]): Ast[] {
2850
+ _tokensToNodes(tokens: Token[]): Ast[] {
2851
2851
  const nodes: Ast[] = []
2852
2852
  for (const token of tokens) {
2853
2853
  nodes.push(this._tokenToNode(token))
@@ -2858,7 +2858,7 @@ export class NakoParser extends NakoParserBase {
2858
2858
  /** TokenをそのままNodeに変換するメソッド(ただし簡単なものだけ対応)
2859
2859
  * @returns {Ast}
2860
2860
  */
2861
- _tokenToNode (token: Token): Ast {
2861
+ _tokenToNode(token: Token): Ast {
2862
2862
  const map = this.peekSourceMap(token)
2863
2863
  if (token.type === 'string' || token.type === 'number' || token.type === 'bigint') {
2864
2864
  return this.yConst(token, map)
@@ -233,7 +233,7 @@ export class NakoParserBase {
233
233
  return rollback();
234
234
  }
235
235
  const type = types[i];
236
- if (type == null) {
236
+ if (type === null) {
237
237
  return rollback();
238
238
  }
239
239
  if (typeof type === 'string') {