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
  import { NakoLogger } from './nako_logger.mjs'
3
3
  import { FuncList, FuncListItem, SourceMap, NewEmptyToken, ExportMap } from './nako_types.mjs'
4
4
  import { Ast, AstBlocks, AstOperator, AstConst, AstStrValue } from './nako_ast.mjs'
@@ -33,7 +33,7 @@ export class NakoParserBase {
33
33
  protected isExportStack: boolean[]
34
34
  protected isModifiedNodes: boolean
35
35
 
36
- constructor (logger: NakoLogger) {
36
+ constructor(logger: NakoLogger) {
37
37
  this.logger = logger
38
38
  this.stackList = [] // 関数定義の際にスタックが混乱しないように整理する
39
39
  this.tokens = []
@@ -83,13 +83,13 @@ export class NakoParserBase {
83
83
  this.init()
84
84
  }
85
85
 
86
- init () {
86
+ init() {
87
87
  this.funclist = new Map() // 関数の一覧
88
88
  this.moduleExport = new Map()
89
89
  this.reset()
90
90
  }
91
91
 
92
- reset () {
92
+ reset() {
93
93
  this.tokens = [] // 字句解析済みのトークンの一覧を保存
94
94
  this.index = 0 // tokens[] のどこまで読んだかを管理する
95
95
  this.stack = [] // 計算用のスタック ... 直接は操作せず、pushStack() popStack() を介して使う
@@ -97,11 +97,11 @@ export class NakoParserBase {
97
97
  this.genMode = 'sync' // #637, #1056
98
98
  }
99
99
 
100
- setFuncList (funclist: FuncList) {
100
+ setFuncList(funclist: FuncList) {
101
101
  this.funclist = funclist
102
102
  }
103
103
 
104
- setModuleExport (moduleexport: ExportMap) {
104
+ setModuleExport(moduleexport: ExportMap) {
105
105
  this.moduleExport = moduleexport
106
106
  }
107
107
 
@@ -109,7 +109,7 @@ export class NakoParserBase {
109
109
  * 特定の助詞を持つ要素をスタックから一つ下ろす、指定がなければ末尾を下ろす
110
110
  * @param {string[]} josiList 下ろしたい助詞の配列
111
111
  */
112
- popStack (josiList: string[]|undefined = undefined): Ast | null {
112
+ popStack(josiList: string[]|undefined = undefined): Ast | null {
113
113
  if (!josiList) {
114
114
  const t = this.stack.pop()
115
115
  if (t) { return t }
@@ -133,12 +133,12 @@ export class NakoParserBase {
133
133
  * saveStack と loadStack は対で使う。
134
134
  * 関数定義などでスタックが混乱しないように配慮するためのもの
135
135
  */
136
- saveStack () {
136
+ saveStack() {
137
137
  this.stackList.push(this.stack)
138
138
  this.stack = []
139
139
  }
140
140
 
141
- loadStack () {
141
+ loadStack() {
142
142
  this.stack = this.stackList.pop()
143
143
  }
144
144
 
@@ -146,7 +146,7 @@ export class NakoParserBase {
146
146
  * @param {string} name
147
147
  * @returns {any}変数名の情報
148
148
  */
149
- findVar (name: string): any {
149
+ findVar(name: string): any {
150
150
  // ローカル変数?
151
151
  if (this.localvars.get(name)) {
152
152
  return {
@@ -201,7 +201,7 @@ export class NakoParserBase {
201
201
  /**
202
202
  * 計算用に要素をスタックに積む
203
203
  */
204
- pushStack (item: any) {
204
+ pushStack(item: any) {
205
205
  this.logger.trace('PUSH:' + JSON.stringify(item))
206
206
  this.stack.push(item)
207
207
  }
@@ -209,18 +209,18 @@ export class NakoParserBase {
209
209
  /**
210
210
  * トークンの末尾に達したか
211
211
  */
212
- isEOF (): boolean {
212
+ isEOF(): boolean {
213
213
  return (this.index >= this.tokens.length)
214
214
  }
215
215
 
216
- getIndex (): number {
216
+ getIndex(): number {
217
217
  return this.index
218
218
  }
219
219
 
220
220
  /**
221
221
  * カーソル位置にある単語の型を確かめる
222
222
  */
223
- check (ttype: string): boolean {
223
+ check(ttype: string): boolean {
224
224
  return (this.tokens[this.index].type === ttype)
225
225
  }
226
226
 
@@ -228,7 +228,7 @@ export class NakoParserBase {
228
228
  * カーソル位置以降にある単語の型を確かめる 2単語以上に対応
229
229
  * @param a [単語1の型, 単語2の型, ... ]
230
230
  */
231
- check2 (a: any[]): boolean {
231
+ check2(a: any[]): boolean {
232
232
  for (let i = 0; i < a.length; i++) {
233
233
  const idx = i + this.index
234
234
  if (this.tokens.length <= idx) { return false }
@@ -246,7 +246,7 @@ export class NakoParserBase {
246
246
  /**
247
247
  * カーソル位置の型を確認するが、複数の種類を確かめられる
248
248
  */
249
- checkTypes (a: TokenType[]): boolean {
249
+ checkTypes(a: TokenType[]): boolean {
250
250
  const type = this.tokens[this.index].type
251
251
  return (a.indexOf(type) >= 0)
252
252
  }
@@ -255,7 +255,7 @@ export class NakoParserBase {
255
255
  * check2の高度なやつ、型名の他にコールバック関数を指定できる
256
256
  * 型にマッチしなければ false を返し、カーソルを巻き戻す
257
257
  */
258
- accept (types: any[]): boolean {
258
+ accept(types: any[]): boolean {
259
259
  const y = []
260
260
  const tmpIndex = this.index
261
261
  const rollback = () => {
@@ -265,7 +265,7 @@ export class NakoParserBase {
265
265
  for (let i = 0; i < types.length; i++) {
266
266
  if (this.isEOF()) { return rollback() }
267
267
  const type = types[i]
268
- if (type == null) { return rollback() }
268
+ if (type === null) { return rollback() }
269
269
  if (typeof type === 'string') {
270
270
  const token = this.get()
271
271
  if (token && token.type !== type) { return rollback() }
@@ -293,31 +293,31 @@ export class NakoParserBase {
293
293
  /**
294
294
  * カーソル語句を取得して、カーソルを後ろに移動する
295
295
  */
296
- get (): Token | null {
296
+ get(): Token | null {
297
297
  if (this.isEOF()) { return null }
298
298
  return this.tokens[this.index++]
299
299
  }
300
300
 
301
301
  /** カーソル語句を取得してカーソルを進める、取得できなければエラーを出す */
302
- getCur (): Token {
302
+ getCur(): Token {
303
303
  if (this.isEOF()) { throw new Error('トークンが取得できません。') }
304
304
  const t = this.tokens[this.index++]
305
305
  if (!t) { throw new Error('トークンが取得できません。') }
306
306
  return t
307
307
  }
308
308
 
309
- unget () {
309
+ unget() {
310
310
  if (this.index > 0) { this.index-- }
311
311
  }
312
312
 
313
313
  /** 解析中のトークンを返す */
314
- peek (i = 0): Token|null {
314
+ peek(i = 0): Token|null {
315
315
  if (this.isEOF()) { return null }
316
316
  return this.tokens[this.index + i]
317
317
  }
318
318
 
319
319
  /** 解析中のトークンを返す、無理なら def を返す */
320
- peekDef (def: Token|null = null): Token {
320
+ peekDef(def: Token|null = null): Token {
321
321
  if (this.isEOF()) {
322
322
  if (!def) { def = NewEmptyToken() }
323
323
  return def
@@ -328,7 +328,7 @@ export class NakoParserBase {
328
328
  /**
329
329
  * 現在のカーソル語句のソースコード上の位置を取得する。
330
330
  */
331
- peekSourceMap (t: Token|undefined = undefined): SourceMap {
331
+ peekSourceMap(t: Token|undefined = undefined): SourceMap {
332
332
  const token = (t === undefined) ? this.peek() : t
333
333
  if (token === null) {
334
334
  return { startOffset: undefined, endOffset: undefined, file: undefined, line: 0, column: 0 }
@@ -342,57 +342,57 @@ export class NakoParserBase {
342
342
  * @param {{ depth: number, typeName?: string }} opts
343
343
  * @param {boolean} debugMode
344
344
  */
345
- nodeToStr (node: Ast|Token|null, opts: {depth: number, typeName?: string}, debugMode: boolean): string {
345
+ nodeToStr(node: Ast|Token|null, opts: {depth: number, typeName?: string}, debugMode: boolean): string {
346
346
  const depth = opts.depth - 1
347
347
  const typeName = (name: string) => (opts.typeName !== undefined) ? opts.typeName : name
348
348
  const debug = debugMode ? (' debug: ' + JSON.stringify(node, null, 2)) : ''
349
349
  if (!node) { return '(NULL)' }
350
350
  switch (node.type) {
351
- case 'not':
352
- if (depth >= 0) {
353
- const subNode: Ast = (node as AstBlocks).blocks[0]
354
- return `${typeName('')}『${this.nodeToStr(subNode, { depth }, debugMode)}に演算子『not』を適用した式${debug}』`
355
- } else {
356
- return `${typeName('演算子')}『not』`
357
- }
358
- case 'op': {
359
- const node2: AstOperator = node as AstOperator
360
- let operator: string = node2.operator || ''
361
- const table:{[key: string]: string} = { eq: '=', not: '!', gt: '>', lt: '<', and: 'かつ', or: 'または' }
362
- if (operator in table) {
363
- operator = table[operator]
364
- }
365
- if (depth >= 0) {
366
- const left: string = this.nodeToStr(node2.blocks[0], { depth }, debugMode)
367
- const right: string = this.nodeToStr(node2.blocks[1], { depth }, debugMode)
368
- if (node2.operator === 'eq') {
369
- return `${typeName('')}『${left}と${right}が等しいかどうかの比較${debug}』`
370
- }
371
- return `${typeName('')}『${left}と${right}に演算子『${operator}』を適用した式${debug}』`
372
- } else {
373
- return `${typeName('演算子')}『${operator}${debug}』`
374
- }
351
+ case 'not':
352
+ if (depth >= 0) {
353
+ const subNode: Ast = (node as AstBlocks).blocks[0]
354
+ return `${typeName('')}『${this.nodeToStr(subNode, { depth }, debugMode)}に演算子『not』を適用した式${debug}』`
355
+ } else {
356
+ return `${typeName('演算子')}『not』`
375
357
  }
376
- case 'number':
377
- return `${typeName('数値')}${(node as AstConst).value}`
378
- case 'bigint':
379
- return `${typeName('巨大整数')}${(node as AstConst).value}`
380
- case 'string':
381
- return `${typeName('文字列')}『${(node as AstConst).value}${debug}』`
382
- case 'word':
383
- return `${typeName('単語')}『${(node as AstStrValue).value}${debug}』`
384
- case 'func':
385
- return `${typeName('関数')}『${node.name || (node as AstStrValue).value}${debug}』`
386
- case 'eol':
387
- return '行の末尾'
388
- case 'eof':
389
- return 'ファイルの末尾'
390
- default: {
391
- let name:any = node.name
392
- if (name) { name = (node as AstStrValue).value }
393
- if (typeof name !== 'string') { name = node.type }
394
- return `${typeName('')}『${name}${debug}』`
358
+ case 'op': {
359
+ const node2: AstOperator = node as AstOperator
360
+ let operator: string = node2.operator || ''
361
+ const table:{[key: string]: string} = { eq: '=', not: '!', gt: '>', lt: '<', and: 'かつ', or: 'または' }
362
+ if (operator in table) {
363
+ operator = table[operator]
395
364
  }
365
+ if (depth >= 0) {
366
+ const left: string = this.nodeToStr(node2.blocks[0], { depth }, debugMode)
367
+ const right: string = this.nodeToStr(node2.blocks[1], { depth }, debugMode)
368
+ if (node2.operator === 'eq') {
369
+ return `${typeName('')}『${left}と${right}が等しいかどうかの比較${debug}』`
370
+ }
371
+ return `${typeName('')}『${left}と${right}に演算子『${operator}』を適用した式${debug}』`
372
+ } else {
373
+ return `${typeName('演算子')}『${operator}${debug}』`
374
+ }
375
+ }
376
+ case 'number':
377
+ return `${typeName('数値')}${(node as AstConst).value}`
378
+ case 'bigint':
379
+ return `${typeName('巨大整数')}${(node as AstConst).value}`
380
+ case 'string':
381
+ return `${typeName('文字列')}『${(node as AstConst).value}${debug}』`
382
+ case 'word':
383
+ return `${typeName('単語')}『${(node as AstStrValue).value}${debug}』`
384
+ case 'func':
385
+ return `${typeName('関数')}『${node.name || (node as AstStrValue).value}${debug}』`
386
+ case 'eol':
387
+ return '行の末尾'
388
+ case 'eof':
389
+ return 'ファイルの末尾'
390
+ default: {
391
+ let name:any = node.name
392
+ if (name) { name = (node as AstStrValue).value }
393
+ if (typeof name !== 'string') { name = node.type }
394
+ return `${typeName('')}『${name}${debug}』`
395
+ }
396
396
  }
397
397
  }
398
398
  }
@@ -1,4 +1,3 @@
1
- /* eslint-disable quote-props */
2
1
  export const opPriority = {
3
2
  // and or
4
3
  'and': 1,
@@ -1,6 +1,6 @@
1
1
  import { TokenType } from './nako_token.mjs'
2
2
 
3
- /* eslint-disable quote-props */
3
+
4
4
  export const opPriority: {[key: string]: number} = {
5
5
  // and or
6
6
  'and': 1,
@@ -7,7 +7,7 @@ class ReplaceHistory {
7
7
  from: number
8
8
  to: number
9
9
  index: number
10
- constructor (from: number, to: number, index: number) {
10
+ constructor(from: number, to: number, index: number) {
11
11
  this.from = from
12
12
  this.to = to
13
13
  this.index = index
@@ -17,7 +17,7 @@ class ReplaceHistory {
17
17
  export class ConvertResult {
18
18
  public text: string
19
19
  public sourcePosition: number
20
- constructor (text: string, sourcePosition: number) {
20
+ constructor(text: string, sourcePosition: number) {
21
21
  this.text = text
22
22
  this.sourcePosition = sourcePosition
23
23
  }
@@ -29,16 +29,16 @@ export class ConvertResult {
29
29
  export class Replace {
30
30
  history: ReplaceHistory[]
31
31
  private code: string
32
- constructor (code: string) {
32
+ constructor(code: string) {
33
33
  this.history = []
34
34
  this.code = code
35
35
  }
36
36
 
37
- getText (): string {
37
+ getText(): string {
38
38
  return this.code
39
39
  }
40
40
 
41
- replaceAll (from: string, to: string) {
41
+ replaceAll(from: string, to: string) {
42
42
  while (true) {
43
43
  const index = this.getText().indexOf(from)
44
44
  if (index === -1) {
@@ -51,7 +51,7 @@ export class Replace {
51
51
  }
52
52
  }
53
53
 
54
- getSourcePosition (i: number): number {
54
+ getSourcePosition(i: number): number {
55
55
  // 少し遅い。パース時間1.4秒に対して0.15秒かかる。iが単調増加することを利用して高速化できるはず。
56
56
  for (const item of this.history) {
57
57
  if (i >= item.index + item.to) { // 置換範囲より後ろ
@@ -77,10 +77,10 @@ export class Replace {
77
77
  */
78
78
  export class NakoPrepare {
79
79
  // 唯一のインスタンス
80
- // eslint-disable-next-line no-use-before-define
80
+
81
81
  private static _instance: NakoPrepare
82
82
  /** 唯一のインスタンスを返す */
83
- public static getInstance (): NakoPrepare {
83
+ public static getInstance(): NakoPrepare {
84
84
  if (!NakoPrepare._instance) {
85
85
  NakoPrepare._instance = new NakoPrepare()
86
86
  }
@@ -88,7 +88,7 @@ export class NakoPrepare {
88
88
  }
89
89
 
90
90
  private convertTable: Map<number, string>
91
- private constructor () {
91
+ private constructor() {
92
92
  // 単純な変換テーブル
93
93
  this.convertTable = new Map([
94
94
  // ハイフンへの変換
@@ -150,7 +150,7 @@ export class NakoPrepare {
150
150
  /**
151
151
  * @param {string} ch
152
152
  */
153
- public convert1ch (ch: string): string {
153
+ public convert1ch(ch: string): string {
154
154
  if (!ch) { return '' }
155
155
  const c: number = ch.codePointAt(0) || 0
156
156
  // テーブルによる変換
@@ -167,7 +167,7 @@ export class NakoPrepare {
167
167
  }
168
168
 
169
169
  /** convert code */
170
- convert (code: string): ConvertResult[] {
170
+ convert(code: string): ConvertResult[] {
171
171
  if (!code) { return [] }
172
172
  const src = new Replace(code)
173
173
 
@@ -321,7 +321,7 @@ export class NakoPrepare {
321
321
  }
322
322
 
323
323
  /** なでしこのソースコードのモード(!インデント構文など)が設定されているか調べる */
324
- export function checkNakoMode (code: string, modeNames: string[]): boolean {
324
+ export function checkNakoMode(code: string, modeNames: string[]): boolean {
325
325
  // 先頭の256文字について調べる
326
326
  code = code.substring(0, 256)
327
327
  // 全角半角の揺れを吸収
@@ -14,7 +14,7 @@ export class SourceMappingOfTokenization {
14
14
  * @param {number} sourceCodeLength
15
15
  * @param {PreprocessItem[]} preprocessed
16
16
  */
17
- constructor (sourceCodeLength: number, preprocessed: PreprocessItem[]) {
17
+ constructor(sourceCodeLength: number, preprocessed: PreprocessItem[]) {
18
18
  /** @private @readonly */
19
19
  this.sourceCodeLength = sourceCodeLength
20
20
 
@@ -40,7 +40,7 @@ export class SourceMappingOfTokenization {
40
40
  * @param {number} preprocessedCodePosition
41
41
  * @returns {number}
42
42
  */
43
- map (preprocessedCodePosition: number): number {
43
+ map(preprocessedCodePosition: number): number {
44
44
  const i = this.findIndex(preprocessedCodePosition)
45
45
  return Math.min(
46
46
  this.preprocessed[i].sourcePosition + (preprocessedCodePosition - this.cumulativeSum[i]),
@@ -52,7 +52,7 @@ export class SourceMappingOfTokenization {
52
52
  * @param {number} preprocessedCodePosition
53
53
  * @returns {number}
54
54
  */
55
- findIndex (preprocessedCodePosition: number): number {
55
+ findIndex(preprocessedCodePosition: number): number {
56
56
  // 連続アクセスに対する高速化
57
57
  if (preprocessedCodePosition < this.lastPreprocessedCodePosition) {
58
58
  this.lastIndex = 0
@@ -82,7 +82,7 @@ export class SourceMappingOfIndentSyntax {
82
82
  * @param {readonly number[]} linesInsertedByIndentationSyntax
83
83
  * @param {readonly { lineNumber: number, len: number }[]} linesDeletedByIndentationSyntax
84
84
  */
85
- constructor (
85
+ constructor(
86
86
  codeAfterProcessingIndentationSyntax: string,
87
87
  linesInsertedByIndentationSyntax: number[],
88
88
  linesDeletedByIndentationSyntax: { lineNumber: number, len: number }[]
@@ -113,7 +113,7 @@ export class SourceMappingOfIndentSyntax {
113
113
  * @param {number | null} endOffset
114
114
  * @returns {{ startOffset: number | null, endOffset: number | null }}
115
115
  */
116
- map (startOffset: number | null, endOffset:number | null): { startOffset: number | null, endOffset: number | null } {
116
+ map(startOffset: number | null, endOffset:number | null): { startOffset: number | null, endOffset: number | null } {
117
117
  if (startOffset === null) {
118
118
  return { startOffset, endOffset }
119
119
  }
@@ -159,7 +159,7 @@ export class SourceMappingOfIndentSyntax {
159
159
  * @returns {number}
160
160
  * @private
161
161
  */
162
- getLineNumber (offset: number): number {
162
+ getLineNumber(offset: number): number {
163
163
  // 連続アクセスに対する高速化
164
164
  if (offset < this.lastOffset) {
165
165
  this.lastLineNumber = 0
@@ -186,7 +186,7 @@ export class OffsetToLineColumn {
186
186
  /**
187
187
  * @param {string} code
188
188
  */
189
- constructor (code: string) {
189
+ constructor(code: string) {
190
190
  /** @private @type {number[]} */
191
191
  this.lineOffsets = []
192
192
 
@@ -208,7 +208,7 @@ export class OffsetToLineColumn {
208
208
  * @param {boolean} oneBasedLineNumber trueのときlineを1から始める
209
209
  * @returns {{ line: number, column: number }}
210
210
  */
211
- map (offset: number, oneBasedLineNumber: boolean):{ line: number, column: number } {
211
+ map(offset: number, oneBasedLineNumber: boolean):{ line: number, column: number } {
212
212
  // 連続アクセスに対する高速化
213
213
  if (offset < this.lastOffset) {
214
214
  this.lastLineNumber = 0
@@ -237,7 +237,7 @@ export class OffsetToLineColumn {
237
237
  * preCodeの分、ソースマップのoffset、行数、列数を減らす。
238
238
  * @type {<T extends {line?: number, column?: number, startOffset: number | null, endOffset: number | null }>(sourceMap: T, preCode: string) => T}
239
239
  */
240
- export function subtractSourceMapByPreCodeLength (sourceMap: any, preCode: string) {
240
+ export function subtractSourceMapByPreCodeLength(sourceMap: any, preCode: string) {
241
241
  // offsetは単純に引くだけでよい
242
242
  if (typeof sourceMap.startOffset === 'number') {
243
243
  sourceMap.startOffset -= preCode.length
@@ -1,2 +1 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  export {};
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+
2
2
 
3
3
  import { FuncListItem, Ast } from './nako_types.mjs'
4
4
 
@@ -121,7 +121,7 @@ export interface Token {
121
121
  tag?: string;
122
122
  preprocessedCodeOffset?: number | undefined;
123
123
  preprocessedCodeLength?: number | undefined;
124
- // eslint-disable-next-line no-use-before-define
124
+
125
125
  name?: Token | Ast; // NakoPaserBase.nodeToStrの問題を回避するため
126
126
  start?: number;
127
127
  end?: number;
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  /**
3
2
  * よく使う処理をまとめたもの
4
3
  */
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+
2
2
  /**
3
3
  * よく使う処理をまとめたもの
4
4
  */
@@ -10,7 +10,7 @@ import { TokenType } from './nako_token.mjs'
10
10
  * @param tokens トークンの一覧
11
11
  * @returns 文字列
12
12
  */
13
- export function debugTokens (tokens: Token[]) {
13
+ export function debugTokens(tokens: Token[]) {
14
14
  const result = []
15
15
  for (let i = 0; i < tokens.length; i++) {
16
16
  const t = tokens[i]
@@ -30,7 +30,7 @@ export function debugTokens (tokens: Token[]) {
30
30
  return result.join('\n')
31
31
  }
32
32
 
33
- export function makeIndent (n: number): string {
33
+ export function makeIndent(n: number): string {
34
34
  let s = ''
35
35
  for (let i = 0; i < n; i++) {
36
36
  s += ' '
@@ -39,7 +39,7 @@ export function makeIndent (n: number): string {
39
39
  }
40
40
 
41
41
  let lastTokenInfo = NewEmptyToken()
42
- export function newToken (type: TokenType, value: any, templateToken: Token|undefined = undefined): Token {
42
+ export function newToken(type: TokenType, value: any, templateToken: Token|undefined = undefined): Token {
43
43
  if (templateToken) {
44
44
  lastTokenInfo = templateToken
45
45
  }
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  /**
3
2
  * なでしこ3 の TypeScript のための型定義
4
3
  */
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+
2
2
  /**
3
3
  * なでしこ3 の TypeScript のための型定義
4
4
  */
@@ -26,7 +26,7 @@ export interface FuncListItem {
26
26
  funcPointers?: any[];
27
27
  asyncFn?: boolean;
28
28
  isExport?: null|boolean;
29
- // eslint-disable-next-line camelcase
29
+
30
30
  return_none?: boolean;
31
31
  pure?: boolean;
32
32
  name?: string;
@@ -46,7 +46,7 @@ export interface TokenMeta {
46
46
  funcPointers: any[] | undefined;
47
47
  }
48
48
 
49
- export function NewEmptyToken (type: TokenType = '?', value: any = '', indent = -1, line = 0, file = 'main.nako3'): Token {
49
+ export function NewEmptyToken(type: TokenType = '?', value: any = '', indent = -1, line = 0, file = 'main.nako3'): Token {
50
50
  return {
51
51
  type,
52
52
  value,
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  /**
3
2
  * @fileOverview プラグインAPIの型定義
4
3
  */
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+
2
2
  /**
3
3
  * @fileOverview プラグインAPIの型定義
4
4
  */
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import { options, parse, stringify } from './nako_csv.mjs';
3
2
  const PluginCSV = {
4
3
  'meta': {
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1
+
2
2
  import { CSVOptions, options, parse, stringify } from './nako_csv.mjs'
3
3
 
4
4
  const PluginCSV = {
@@ -16,7 +16,7 @@ const PluginCSV = {
16
16
  type: 'func',
17
17
  josi: [],
18
18
  pure: true,
19
- fn: function (): void {
19
+ fn: function(): void {
20
20
  // 基本的に初期化不要
21
21
  }
22
22
  },
@@ -25,7 +25,7 @@ const PluginCSV = {
25
25
  type: 'func',
26
26
  josi: [['を', 'の', 'で']],
27
27
  pure: true,
28
- fn: function (str: string): (string | number)[][] {
28
+ fn: function(str: string): (string | number)[][] {
29
29
  options.delimiter = ','
30
30
  return parse(str)
31
31
  }
@@ -34,7 +34,7 @@ const PluginCSV = {
34
34
  type: 'func',
35
35
  josi: [['を', 'の', 'で']],
36
36
  pure: true,
37
- fn: function (str: string): (string|number)[][] {
37
+ fn: function(str: string): (string|number)[][] {
38
38
  options.delimiter = '\t'
39
39
  return parse(str)
40
40
  }
@@ -43,7 +43,7 @@ const PluginCSV = {
43
43
  type: 'func',
44
44
  josi: [['を']],
45
45
  pure: true,
46
- fn: function (a: string[][]): string {
46
+ fn: function(a: string[][]): string {
47
47
  options.delimiter = ','
48
48
  return stringify(a)
49
49
  }
@@ -52,7 +52,7 @@ const PluginCSV = {
52
52
  type: 'func',
53
53
  josi: [['を']],
54
54
  pure: true,
55
- fn: function (a: string[][]): string {
55
+ fn: function(a: string[][]): string {
56
56
  options.delimiter = '\t'
57
57
  return stringify(a)
58
58
  }
@@ -61,7 +61,7 @@ const PluginCSV = {
61
61
  type: 'func',
62
62
  josi: [['を', 'で']],
63
63
  pure: true,
64
- fn: function (obj: { [key: string]: unknown }): void {
64
+ fn: function(obj: { [key: string]: unknown }): void {
65
65
  for (const key in obj) {
66
66
  const value: unknown = obj[key]
67
67
  if (key === 'delimiter' || key === '区切文字') {
@@ -127,7 +127,6 @@ export default {
127
127
  type: 'func',
128
128
  josi: [['の']],
129
129
  pure: false,
130
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
131
130
  fn: function (v, sys) {
132
131
  return sys.__exec('SIGN', [v]);
133
132
  }