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
@@ -295,6 +295,8 @@ LINENO=0
295
295
  関数定義=「」
296
296
  戻る。
297
297
  ここまで。
298
+ Sをトリムして、Sトリムに代入。
299
+ もし、Sトリム=「」ならば、戻る。
298
300
  # いずれにも合致しない場合
299
301
  「[エラー]({カレントプラグイン}):『{関数定義}』で定義不明のエラー{改行}{S}」を表示。
300
302
  終わる。
package/core/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nadesiko3core",
3
- "version": "3.7.13",
3
+ "version": "3.7.14",
4
4
  "description": "Japanese Programming Language Nadesiko v3 core",
5
5
  "main": "index.mjs",
6
6
  "type": "module",
@@ -250,7 +250,6 @@ export class NakoCompiler {
250
250
  continue;
251
251
  }
252
252
  // 初回の読み込み
253
- // eslint-disable-next-line @typescript-eslint/no-empty-function
254
253
  dependencies[item.filePath] = { tokens: [], alias: new Set([item.value]), addPluginFile: () => { }, funclist: {}, moduleExport: {} };
255
254
  if (item.type === 'js' || item.type === 'mjs') {
256
255
  loadJS(item, tasks);
@@ -671,7 +670,6 @@ export class NakoCompiler {
671
670
  * @param [preCode]
672
671
  * @deprecated 代わりにrunAsyncメソッドを使ってください。(core #52)
673
672
  */
674
- // eslint-disable-next-line @typescript-eslint/require-await
675
673
  async _run(code, fname, isReset, isTest, preCode = '') {
676
674
  const opts = newCompilerOptions({
677
675
  resetEnv: isReset,
@@ -705,7 +703,6 @@ export class NakoCompiler {
705
703
  // 実行前に環境を初期化するイベントを実行(beforeRun)
706
704
  this.eventList.filter(o => o.eventName === 'beforeRun').map(e => e.callback(nakoGlobal));
707
705
  try {
708
- // eslint-disable-next-line no-new-func, @typescript-eslint/no-implied-eval
709
706
  const f = new Function(nakoGlobal.lastJSCode);
710
707
  f.apply(nakoGlobal);
711
708
  }
@@ -743,7 +740,6 @@ export class NakoCompiler {
743
740
  * @param options オプション
744
741
  * @returns 実行に利用したグローバルオブジェクト
745
742
  */
746
- // eslint-disable-next-line @typescript-eslint/require-await
747
743
  async runAsync(code, filename, options = undefined) {
748
744
  // コンパイル
749
745
  options = newCompilerOptions(options);
@@ -1,6 +1,6 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+
2
+
3
+
4
4
  // deno-lint-ignore-file no-explicit-any
5
5
  /**
6
6
  * nadesiko v3
@@ -70,7 +70,7 @@ export interface NakoResetOption {
70
70
  }
71
71
 
72
72
  /** コンパイラ実行オプションを生成 */
73
- export function newCompilerOptions (initObj: Partial<CompilerOptions> = {}): CompilerOptions {
73
+ export function newCompilerOptions(initObj: Partial<CompilerOptions> = {}): CompilerOptions {
74
74
  if (typeof initObj !== 'object') { initObj = {} }
75
75
  initObj.testOnly = initObj.testOnly || false
76
76
  initObj.resetEnv = initObj.resetEnv || false
@@ -99,7 +99,7 @@ export class NakoCompiler {
99
99
  // global objects
100
100
  __varslist: NakoVars[]
101
101
  __locals: NakoVars
102
- // eslint-disable-next-line no-use-before-define
102
+
103
103
  __self: NakoCompiler
104
104
  __vars: NakoVars
105
105
  __v0: NakoVars
@@ -117,7 +117,7 @@ export class NakoCompiler {
117
117
  /**
118
118
  * @param {undefined | {'useBasicPlugin':true|false}} options
119
119
  */
120
- constructor (options: NakoCompilerOption | undefined = undefined) {
120
+ constructor(options: NakoCompilerOption | undefined = undefined) {
121
121
  if (options === undefined) {
122
122
  options = { useBasicPlugin: true }
123
123
  }
@@ -172,30 +172,30 @@ export class NakoCompiler {
172
172
  }
173
173
 
174
174
  /** モジュール(名前空間)の一覧を取得する */
175
- getModList (): string[] {
175
+ getModList(): string[] {
176
176
  return this.lexer.modList
177
177
  }
178
178
 
179
- getLogger (): NakoLogger {
179
+ getLogger(): NakoLogger {
180
180
  return this.logger
181
181
  }
182
182
 
183
- getNakoFuncList (): FuncList {
183
+ getNakoFuncList(): FuncList {
184
184
  return this.nakoFuncList
185
185
  }
186
186
 
187
- getNakoFunc (name: string): FuncListItem|undefined {
187
+ getNakoFunc(name: string): FuncListItem|undefined {
188
188
  return this.nakoFuncList.get(name)
189
189
  }
190
190
 
191
- getPluginfiles (): Record<string, any> {
191
+ getPluginfiles(): Record<string, any> {
192
192
  return this.pluginfiles
193
193
  }
194
194
 
195
195
  /**
196
196
  * 基本的なプラグインを追加する
197
197
  */
198
- addBasicPlugins () {
198
+ addBasicPlugins() {
199
199
  this.addPlugin(PluginSystem)
200
200
  this.addPlugin(PluginMath)
201
201
  this.addPlugin(PluginPromise)
@@ -207,7 +207,7 @@ export class NakoCompiler {
207
207
  /**
208
208
  * loggerを新しいインスタンスで置き換える。
209
209
  */
210
- replaceLogger () {
210
+ replaceLogger() {
211
211
  const logger = this.lexer.logger = this.parser.logger = this.logger = new NakoLogger()
212
212
  return logger
213
213
  }
@@ -216,7 +216,7 @@ export class NakoCompiler {
216
216
  * ファイル内のrequire文の位置を列挙する。出力の配列はstartでソートされている。
217
217
  * @param {Token[]} tokens rawtokenizeの出力
218
218
  */
219
- static listRequireStatements (tokens: Token[]): Token[] {
219
+ static listRequireStatements(tokens: Token[]): Token[] {
220
220
  const requireStatements: Token[] = []
221
221
  for (let i = 0; i + 2 < tokens.length; i++) {
222
222
  // not (string|string_ex) '取り込み'
@@ -283,7 +283,7 @@ export class NakoCompiler {
283
283
  * @returns {Promise<unknown> | void}
284
284
  * @protected
285
285
  */
286
- _loadDependencies (code: string, filename: string, preCode: string, tools: LoaderTool) {
286
+ _loadDependencies(code: string, filename: string, preCode: string, tools: LoaderTool) {
287
287
  const dependencies: Dependencies = {}
288
288
  const compiler = new NakoCompiler({ useBasicPlugin: true })
289
289
  /**
@@ -339,7 +339,7 @@ export class NakoCompiler {
339
339
  }
340
340
 
341
341
  // 初回の読み込み
342
- // eslint-disable-next-line @typescript-eslint/no-empty-function
342
+
343
343
  dependencies[item.filePath] = { tokens: [], alias: new Set([item.value]), addPluginFile: ():void => {}, funclist: {}, moduleExport: {} }
344
344
  if (item.type === 'js' || item.type === 'mjs') {
345
345
  loadJS(item, tasks)
@@ -387,7 +387,7 @@ export class NakoCompiler {
387
387
  * @param preCode
388
388
  * @returns トークンのリスト
389
389
  */
390
- rawtokenize (code: string, line: number, filename: string, preCode = ''): Token[] {
390
+ rawtokenize(code: string, line: number, filename: string, preCode = ''): Token[] {
391
391
  if (!code.startsWith(preCode)) {
392
392
  throw new Error('codeの先頭にはpreCodeを含める必要があります。')
393
393
  }
@@ -458,7 +458,7 @@ export class NakoCompiler {
458
458
  * @param {string} filename
459
459
  * @returns コード (なでしこ)
460
460
  */
461
- converttoken (tokens: Token[], isFirst: boolean, filename: string): Token[] {
461
+ converttoken(tokens: Token[], isFirst: boolean, filename: string): Token[] {
462
462
  const tok = this.lexer.replaceTokens(tokens, isFirst, filename)
463
463
  return tok
464
464
  }
@@ -467,7 +467,7 @@ export class NakoCompiler {
467
467
  * 環境のリセット
468
468
  * {NakoResetOption|undefined}
469
469
  */
470
- reset (options: NakoResetOption|undefined = undefined) {
470
+ reset(options: NakoResetOption|undefined = undefined) {
471
471
  if (!options || options.needToClearPlugin) {
472
472
  // (メモ) #1245
473
473
  // 通常、リセット処理では、プラグインの!クリアを呼ぶ。
@@ -518,7 +518,7 @@ export class NakoCompiler {
518
518
  * @returns
519
519
  * @private
520
520
  */
521
- lexCodeToken (code: string, line: number, filename: string, startOffset: number|null): {commentTokens: Token[], tokens: Token[]} {
521
+ lexCodeToken(code: string, line: number, filename: string, startOffset: number|null): {commentTokens: Token[], tokens: Token[]} {
522
522
  // 単語に分割
523
523
  let tokens = this.rawtokenize(code, line, filename, '')
524
524
 
@@ -555,7 +555,7 @@ export class NakoCompiler {
555
555
  * @param {Set<string>} [includeGuard]
556
556
  * @returns {Token[]} 削除された取り込み文のトークン
557
557
  */
558
- replaceRequireStatements (tokens: Token[], includeGuard:Set<string> = new Set()): Token[] {
558
+ replaceRequireStatements(tokens: Token[], includeGuard:Set<string> = new Set()): Token[] {
559
559
  /** @type {TokenWithSourceMap[]} */
560
560
  const deletedTokens = []
561
561
  for (const r of NakoCompiler.listRequireStatements(tokens).reverse()) {
@@ -586,7 +586,7 @@ export class NakoCompiler {
586
586
  * @param {TokenWithSourceMap[]} tokens
587
587
  * @returns {TokenWithSourceMap[]} 削除された取り込み文のトークン
588
588
  */
589
- removeRequireStatements (tokens: Token[]): Token[] {
589
+ removeRequireStatements(tokens: Token[]): Token[] {
590
590
  /** @type {TokenWithSourceMap[]} */
591
591
  const deletedTokens = []
592
592
  for (const r of NakoCompiler.listRequireStatements(tokens).reverse()) {
@@ -603,7 +603,7 @@ export class NakoCompiler {
603
603
  }
604
604
 
605
605
  /** 字句解析を行う */
606
- lex (code: string, filename = 'main.nako3', preCode = '', syntaxHighlighting = false): LexResult {
606
+ lex(code: string, filename = 'main.nako3', preCode = '', syntaxHighlighting = false): LexResult {
607
607
  // 単語に分割
608
608
  let tokens = this.rawtokenize(code, 0, filename, preCode)
609
609
 
@@ -649,7 +649,7 @@ export class NakoCompiler {
649
649
  /**
650
650
  * コードをパースしてASTにする
651
651
  */
652
- parse (code: string, filename: string, preCode = ''): Ast {
652
+ parse(code: string, filename: string, preCode = ''): Ast {
653
653
  // 関数リストを字句解析と構文解析に登録
654
654
  this.lexer.setFuncList(this.funclist)
655
655
  this.parser.setFuncList(this.funclist)
@@ -677,13 +677,13 @@ export class NakoCompiler {
677
677
  return ast
678
678
  }
679
679
 
680
- getUsedFuncs (ast: Ast): Set<string> {
680
+ getUsedFuncs(ast: Ast): Set<string> {
681
681
  this.usedFuncs = new Set()
682
682
  this._getUsedFuncs(ast)
683
683
  return this.deleteUnNakoFuncs()
684
684
  }
685
685
 
686
- _getUsedFuncs (ast: Ast): void {
686
+ _getUsedFuncs(ast: Ast): void {
687
687
  if (!ast) { return }
688
688
  if ((ast.type === 'func' || ast.type === 'func_pointer') && ast.name) {
689
689
  this.usedFuncs.add(ast.name as string)
@@ -694,7 +694,7 @@ export class NakoCompiler {
694
694
  }
695
695
  }
696
696
 
697
- deleteUnNakoFuncs (): Set<string> {
697
+ deleteUnNakoFuncs(): Set<string> {
698
698
  for (const func of this.usedFuncs) {
699
699
  if (!this.commandlist.has(func)) {
700
700
  this.usedFuncs.delete(func)
@@ -710,7 +710,7 @@ export class NakoCompiler {
710
710
  * @param isTest テストかどうか
711
711
  * @param preCode
712
712
  */
713
- compile (code: string, filename: string, isTest = false, preCode = ''): string {
713
+ compile(code: string, filename: string, isTest = false, preCode = ''): string {
714
714
  const opt = newCompilerOptions()
715
715
  opt.testOnly = isTest
716
716
  opt.preCode = preCode
@@ -719,7 +719,7 @@ export class NakoCompiler {
719
719
  }
720
720
 
721
721
  /** parse & generate */
722
- compileFromCode (code: string, filename: string, options: CompilerOptions|undefined = undefined): NakoGenResult {
722
+ compileFromCode(code: string, filename: string, options: CompilerOptions|undefined = undefined): NakoGenResult {
723
723
  if (filename === '') { filename = 'main.nako3' }
724
724
  if (options === undefined) { options = newCompilerOptions() }
725
725
  try {
@@ -748,7 +748,7 @@ export class NakoCompiler {
748
748
  * @param opt テストかどうか
749
749
  * @param mode 一般的に 'sync' を指定
750
750
  */
751
- generateCode (ast: Ast, opt: NakoGenOptions, mode = 'sync'): NakoGenResult {
751
+ generateCode(ast: Ast, opt: NakoGenOptions, mode = 'sync'): NakoGenResult {
752
752
  // Select Code Generator #637
753
753
  // normal mode
754
754
  if (mode === 'sync') {
@@ -767,7 +767,7 @@ export class NakoCompiler {
767
767
  }
768
768
 
769
769
  /** コードジェネレータを追加する */
770
- addCodeGenerator (mode: string, obj: any) {
770
+ addCodeGenerator(mode: string, obj: any) {
771
771
  this.codeGenerateor[mode] = obj
772
772
  }
773
773
 
@@ -779,8 +779,8 @@ export class NakoCompiler {
779
779
  * @param [preCode]
780
780
  * @deprecated 代わりにrunAsyncメソッドを使ってください。(core #52)
781
781
  */
782
- // eslint-disable-next-line @typescript-eslint/require-await
783
- async _run (code: string, fname: string, isReset: boolean, isTest: boolean, preCode = ''): Promise<NakoGlobal> {
782
+
783
+ async _run(code: string, fname: string, isReset: boolean, isTest: boolean, preCode = ''): Promise<NakoGlobal> {
784
784
  const opts: CompilerOptions = newCompilerOptions({
785
785
  resetEnv: isReset,
786
786
  resetAll: isReset,
@@ -791,7 +791,7 @@ export class NakoCompiler {
791
791
  }
792
792
 
793
793
  /** 各プラグインをリセットする */
794
- clearPlugins () {
794
+ clearPlugins() {
795
795
  // 他に実行している「なでしこ」があればクリアする
796
796
  this.__globals.forEach((sys: NakoGlobal) => {
797
797
  if (!sys) { return }
@@ -807,13 +807,13 @@ export class NakoCompiler {
807
807
  * @param code JavaScriptのコード
808
808
  * @param nakoGlobal 実行環境
809
809
  */
810
- private evalJS (code: string, nakoGlobal: NakoGlobal): void {
810
+ private evalJS(code: string, nakoGlobal: NakoGlobal): void {
811
811
  this.__globalObj = nakoGlobal // 現在のnakoGlobalを記録
812
812
  this.__globalObj.lastJSCode = code
813
813
  // 実行前に環境を初期化するイベントを実行(beforeRun)
814
814
  this.eventList.filter(o => o.eventName === 'beforeRun').map(e => e.callback(nakoGlobal))
815
815
  try {
816
- // eslint-disable-next-line no-new-func, @typescript-eslint/no-implied-eval
816
+
817
817
  const f = new Function(nakoGlobal.lastJSCode)
818
818
  f.apply(nakoGlobal)
819
819
  } catch (err: any) {
@@ -834,7 +834,7 @@ export class NakoCompiler {
834
834
  * @returns 実行に利用したグローバルオブジェクト
835
835
  * @deprecated 代わりにrunAsyncメソッドを使ってください。(core #52)
836
836
  */
837
- public runSync (code: string, filename: string, options: CompilerOptions|undefined = undefined): NakoGlobal {
837
+ public runSync(code: string, filename: string, options: CompilerOptions|undefined = undefined): NakoGlobal {
838
838
  // コンパイル
839
839
  options = newCompilerOptions(options)
840
840
  const out = this.compileFromCode(code, filename, options)
@@ -852,8 +852,8 @@ export class NakoCompiler {
852
852
  * @param options オプション
853
853
  * @returns 実行に利用したグローバルオブジェクト
854
854
  */
855
- // eslint-disable-next-line @typescript-eslint/require-await
856
- public async runAsync (code: string, filename: string, options: CompilerOptions|undefined = undefined): Promise<NakoGlobal> {
855
+
856
+ public async runAsync(code: string, filename: string, options: CompilerOptions|undefined = undefined): Promise<NakoGlobal> {
857
857
  // コンパイル
858
858
  options = newCompilerOptions(options)
859
859
  const compiledCode = this.compileFromCode(code, filename, options)
@@ -864,7 +864,7 @@ export class NakoCompiler {
864
864
  return nakoGlobal
865
865
  }
866
866
 
867
- private getNakoGlobal (options: CompilerOptions, gen: NakoGen, filename: string): NakoGlobal {
867
+ private getNakoGlobal(options: CompilerOptions, gen: NakoGen, filename: string): NakoGlobal {
868
868
  // オプションを参照
869
869
  let g: NakoGlobal|null = options.nakoGlobal
870
870
  if (!g) {
@@ -886,7 +886,7 @@ export class NakoCompiler {
886
886
  * @param eventName イベント名
887
887
  * @param callback コールバック関数
888
888
  */
889
- addListener (eventName: NakoComEventName, callback: (event:any) => void) {
889
+ addListener(eventName: NakoComEventName, callback: (event:any) => void) {
890
890
  this.eventList.push({ eventName, callback })
891
891
  }
892
892
 
@@ -897,7 +897,7 @@ export class NakoCompiler {
897
897
  * @param preCode
898
898
  * @param testOnly
899
899
  */
900
- test (code: string, fname: string, preCode = '', testOnly = false) {
900
+ test(code: string, fname: string, preCode = '', testOnly = false) {
901
901
  const options = newCompilerOptions()
902
902
  options.preCode = preCode
903
903
  options.testOnly = testOnly
@@ -911,7 +911,7 @@ export class NakoCompiler {
911
911
  * @param [preCode]
912
912
  * @deprecated 代わりに runAsync を使ってください。
913
913
  */
914
- run (code: string, fname = 'main.nako3', preCode = ''): NakoGlobal {
914
+ run(code: string, fname = 'main.nako3', preCode = ''): NakoGlobal {
915
915
  const options = newCompilerOptions()
916
916
  options.preCode = preCode
917
917
  return this.runSync(code, fname, options)
@@ -923,7 +923,7 @@ export class NakoCompiler {
923
923
  * @param filename
924
924
  * @param opt? オプション
925
925
  */
926
- compileStandalone (code: string, filename: string, options?: NakoGenOptions): string {
926
+ compileStandalone(code: string, filename: string, options?: NakoGenOptions): string {
927
927
  if (options === undefined) { options = new NakoGenOptions() }
928
928
  const ast = this.parse(code, filename)
929
929
  return this.generateCode(ast, options).standalone
@@ -935,7 +935,7 @@ export class NakoCompiler {
935
935
  * @param persistent falseのとき、次以降の実行では使えない
936
936
  * @param fpath ファイルパス
937
937
  */
938
- addPlugin (po: {[key: string]: any}, persistent = true, fpath = ''): void {
938
+ addPlugin(po: {[key: string]: any}, persistent = true, fpath = ''): void {
939
939
  // __v0を取得
940
940
  const __v0 = this.__varslist[0]
941
941
  // プラグインのメタ情報をチェック (#1034) (#1647)
@@ -1035,7 +1035,7 @@ export class NakoCompiler {
1035
1035
  * @param po 関数リスト
1036
1036
  * @param persistent falseのとき、次以降の実行では使えない
1037
1037
  */
1038
- addPluginObject (objName: string, po: {[key: string]: any}, persistent = true): void {
1038
+ addPluginObject(objName: string, po: {[key: string]: any}, persistent = true): void {
1039
1039
  // metaプロパティがなければ互換性のため適当に追加
1040
1040
  if (po.meta === undefined) {
1041
1041
  po.meta = { type: 'const', value: { pluginName: objName, nakoVersion: '0.0.0' } }
@@ -1051,7 +1051,7 @@ export class NakoCompiler {
1051
1051
  * @param persistent falseのとき、次以降の実行では使えない
1052
1052
  * @deprecated 利用は非推奨
1053
1053
  */
1054
- addPluginFile (_objName: string, fpath: string, po: {[key: string]: any}, persistent = true): void {
1054
+ addPluginFile(_objName: string, fpath: string, po: {[key: string]: any}, persistent = true): void {
1055
1055
  this.addPluginFromFile(fpath, po, persistent)
1056
1056
  }
1057
1057
 
@@ -1061,7 +1061,7 @@ export class NakoCompiler {
1061
1061
  * @param po 登録するオブジェクト
1062
1062
  * @param persistent falseのとき、次以降の実行では使えない
1063
1063
  */
1064
- addPluginFromFile (fpath: string, po: { [key: string]: any }, persistent = true): void {
1064
+ addPluginFromFile(fpath: string, po: { [key: string]: any }, persistent = true): void {
1065
1065
  this.addPlugin(po, persistent, fpath)
1066
1066
  }
1067
1067
 
@@ -1073,7 +1073,7 @@ export class NakoCompiler {
1073
1073
  * @param {boolean} returnNone 値を返す関数の場合はfalseを指定
1074
1074
  * @param {boolean} asyncFn Promiseを返す関数かを指定
1075
1075
  */
1076
- addFunc (key: string, josi: FuncArgs, fn: any, returnNone = true, asyncFn = false): void {
1076
+ addFunc(key: string, josi: FuncArgs, fn: any, returnNone = true, asyncFn = false): void {
1077
1077
  const funcObj: FuncListItem = { josi, fn, type: 'func', return_none: returnNone, asyncFn, pure: true }
1078
1078
  this.funclist.set(key, funcObj)
1079
1079
  this.pluginFunclist[key] = cloneAsJSON(funcObj)
@@ -1083,7 +1083,7 @@ export class NakoCompiler {
1083
1083
  /** (非推奨) 互換性のため ... 関数を追加する
1084
1084
  * @deprecated 代わりにaddFuncを使ってください
1085
1085
  */
1086
- public setFunc (key: string, josi: FuncArgs, fn: any, returnNone = true, asyncFn = false): void {
1086
+ public setFunc(key: string, josi: FuncArgs, fn: any, returnNone = true, asyncFn = false): void {
1087
1087
  this.addFunc(key, josi, fn, returnNone, asyncFn)
1088
1088
  }
1089
1089
 
@@ -1092,14 +1092,14 @@ export class NakoCompiler {
1092
1092
  * @param key プラグイン関数の関数名
1093
1093
  * @returns プラグイン・オブジェクト
1094
1094
  */
1095
- getFunc (key: string): FuncListItem|undefined {
1095
+ getFunc(key: string): FuncListItem|undefined {
1096
1096
  return this.funclist.get(key)
1097
1097
  }
1098
1098
 
1099
1099
  /** 同期的になでしこのプログラムcodeを実行する
1100
1100
  * @deprecated 代わりにrunAsyncメソッドを使ってください。(core #52)
1101
1101
  */
1102
- private _runEx (code: string, filename: string, opts: CompilerOptions, preCode = '', nakoGlobal: NakoGlobal|undefined = undefined): NakoGlobal {
1102
+ private _runEx(code: string, filename: string, opts: CompilerOptions, preCode = '', nakoGlobal: NakoGlobal|undefined = undefined): NakoGlobal {
1103
1103
  // コンパイル
1104
1104
  opts.preCode = preCode
1105
1105
  if (nakoGlobal) { opts.nakoGlobal = nakoGlobal }
@@ -1113,7 +1113,7 @@ export class NakoCompiler {
1113
1113
  * @param [preCode]
1114
1114
  * @deprecated 代わりにrunAsyncメソッドを使ってください。(core #52)
1115
1115
  */
1116
- public runEx (code: string, fname: string, opts: CompilerOptions, preCode = '') {
1116
+ public runEx(code: string, fname: string, opts: CompilerOptions, preCode = '') {
1117
1117
  return this._runEx(code, fname, opts, preCode)
1118
1118
  }
1119
1119
 
@@ -1123,7 +1123,7 @@ export class NakoCompiler {
1123
1123
  * @param fname
1124
1124
  * @param [preCode]
1125
1125
  */
1126
- async runReset (code: string, fname = 'main.nako3', preCode = ''): Promise<NakoGlobal> {
1126
+ async runReset(code: string, fname = 'main.nako3', preCode = ''): Promise<NakoGlobal> {
1127
1127
  const opts = newCompilerOptions({ resetAll: true, resetEnv: true, preCode })
1128
1128
  return this.runAsync(code, fname, opts)
1129
1129
  }
@@ -1132,7 +1132,7 @@ export class NakoCompiler {
1132
1132
  * 新規のなでしこ変数管理オブジェクトを生成
1133
1133
  * @returns 変数管理オブジェクト
1134
1134
  */
1135
- newVaiables (initVars?: Map<string, any>): Map<string, any> {
1135
+ newVaiables(initVars?: Map<string, any>): Map<string, any> {
1136
1136
  return new Map(initVars)
1137
1137
  }
1138
1138
  }
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  /**
3
2
  * 抽象構文木( Abstract Syntax Tree )を定義したもの
4
3
  */
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+
2
2
  /**
3
3
  * 抽象構文木( Abstract Syntax Tree )を定義したもの
4
4
  */
@@ -48,7 +48,6 @@ const convertColorTextFormat = (text) => {
48
48
  let htmlColor = 'inherit'; // 文字色
49
49
  let htmlFontWeight = 'inherit'; // 文字の太さ
50
50
  // textが色情報を含まないならそれをそのまま使い、含むなら全体を <span>で囲んで、更に、ANSI escape code で囲まれた部分を対応する style を付けた <span> で囲む。
51
- // eslint-disable-next-line multiline-ternary
52
51
  const html = text === noColor ? noColor : ('<span>' + escapeHTML(text)
53
52
  // eslint-disable-next-line no-control-regex
54
53
  .replace(/\x1b\[(\d+)m/g, (_, m1str) => {
@@ -54,7 +54,7 @@ const convertColorTextFormat = (text: string) => {
54
54
  let htmlColor = 'inherit' // 文字色
55
55
  let htmlFontWeight = 'inherit' // 文字の太さ
56
56
  // textが色情報を含まないならそれをそのまま使い、含むなら全体を <span>で囲んで、更に、ANSI escape code で囲まれた部分を対応する style を付けた <span> で囲む。
57
- // eslint-disable-next-line multiline-ternary
57
+
58
58
  const html = text === noColor ? noColor : ('<span>' + escapeHTML(text)
59
59
  // eslint-disable-next-line no-control-regex
60
60
  .replace(/\x1b\[(\d+)m/g, (_, m1str) => { // ANSI escape code(の一部)にマッチして置換
@@ -1,8 +1,8 @@
1
1
  // 実際のバージョン定義 (自動生成されるので以下を編集しない)
2
2
  const coreVersion = {
3
- version: '3.7.13',
3
+ version: '3.7.14',
4
4
  major: 3,
5
5
  minor: 7,
6
- patch: 13
6
+ patch: 14
7
7
  };
8
8
  export default coreVersion;
@@ -11,9 +11,9 @@ export interface NakoCoreVersion {
11
11
  }
12
12
  // 実際のバージョン定義 (自動生成されるので以下を編集しない)
13
13
  const coreVersion: NakoCoreVersion = {
14
- version: '3.7.13',
14
+ version: '3.7.14',
15
15
  major: 3,
16
16
  minor: 7,
17
- patch: 13
17
+ patch: 14
18
18
  }
19
19
  export default coreVersion
@@ -9,7 +9,6 @@ export function resetEnv() {
9
9
  options.auto_convert_number = true;
10
10
  }
11
11
  /// 文字列が数値化どうか判定する関数
12
- // eslint-disable-next-line camelcase
13
12
  function is_numeric(str) {
14
13
  return /^-?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(str);
15
14
  }
@@ -11,19 +11,19 @@ export const options: CSVOptions = {
11
11
  auto_convert_number: true
12
12
  }
13
13
 
14
- export function resetEnv (): void {
14
+ export function resetEnv(): void {
15
15
  options.delimiter = ','
16
16
  options.eol = '\r\n'
17
17
  options.auto_convert_number = true
18
18
  }
19
19
 
20
20
  /// 文字列が数値化どうか判定する関数
21
- // eslint-disable-next-line camelcase
22
- function is_numeric (str: string): boolean {
21
+
22
+ function is_numeric(str: string): boolean {
23
23
  return /^-?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(str)
24
24
  }
25
25
 
26
- export function parse (txt: string, delimiter: string|undefined = undefined): (string|number)[][] {
26
+ export function parse(txt: string, delimiter: string|undefined = undefined): (string|number)[][] {
27
27
  // delimiter
28
28
  if (delimiter === undefined) {
29
29
  delimiter = options.delimiter
@@ -38,7 +38,7 @@ export function parse (txt: string, delimiter: string|undefined = undefined): (s
38
38
  const patToDelim = '^(.*?)([\\' + delimiter + '\\n])'
39
39
  const reToDelim = new RegExp(patToDelim)
40
40
  // if value is number then convert to float
41
- const convType = function (v: string) {
41
+ const convType = function(v: string) {
42
42
  let result: string|number = v
43
43
  if (typeof (v) === 'string') {
44
44
  if (options.auto_convert_number && is_numeric(v)) {
@@ -150,7 +150,7 @@ export function parse (txt: string, delimiter: string|undefined = undefined): (s
150
150
  }
151
151
 
152
152
  // convert 2D array to CSV string
153
- export function stringify (ary: string[][], delimiter: string|undefined = undefined, eol: string|undefined = undefined): string {
153
+ export function stringify(ary: string[][], delimiter: string|undefined = undefined, eol: string|undefined = undefined): string {
154
154
  // check arguments
155
155
  if (delimiter === undefined) {
156
156
  delimiter = options.delimiter
@@ -176,15 +176,15 @@ export function stringify (ary: string[][], delimiter: string|undefined = undefi
176
176
  return r
177
177
  }
178
178
 
179
- export function replaceEolMark (eol: string): string {
179
+ export function replaceEolMark(eol: string): string {
180
180
  eol = eol.replace(/\n\r/g, '[CRLF]')
181
181
  eol = eol.replace(/\r/g, '[CR]')
182
182
  eol = eol.replace(/\n/g, '[LF]')
183
183
  return eol
184
184
  }
185
185
 
186
- function genValueConverter (delimiter: string) {
187
- return function (s: string) {
186
+ function genValueConverter(delimiter: string) {
187
+ return function(s: string) {
188
188
  s = '' + s
189
189
  let fQuot = false
190
190
  if (s.indexOf('\n') >= 0 || s.indexOf('\r') >= 0) { fQuot = true }