nadesiko3 3.7.21 → 3.7.23
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.
- package/README.md +20 -1
- package/batch/command.txt +370 -334
- package/batch/generate_command_list.mjs +102 -0
- package/batch/jsplugin2text.nako3 +1 -1
- package/batch/pickup_command.nako3 +12 -0
- package/batch/search_command.mjs +34 -0
- package/batch/search_command.nako3 +430 -0
- package/core/command/snako.mts +5 -1
- package/core/deno/snako.ts +5 -1
- package/core/package-lock.json +382 -21
- package/core/package.json +7 -4
- package/core/sample/algorithms/README.md +43 -0
- package/core/sample/algorithms/graph/dijkstra.nako3 +47 -0
- package/core/sample/algorithms/graph/kruskal.nako3 +69 -0
- package/core/sample/algorithms/math/euclidean_gcd.nako3 +15 -0
- package/core/sample/algorithms/math/sieve_of_eratosthenes.nako3 +26 -0
- package/core/sample/algorithms/search/binary_search.nako3 +17 -0
- package/core/sample/algorithms/search/breadth_first_search.nako3 +33 -0
- package/core/sample/algorithms/search/depth_first_search.nako3 +25 -0
- package/core/sample/algorithms/sort/heap_sort.nako3 +37 -0
- package/core/sample/algorithms/sort/insertion_sort.nako3 +18 -0
- package/core/sample/algorithms/sort/merge_sort.nako3 +40 -0
- package/core/sample/algorithms/sort/quick_sort.nako3 +36 -0
- package/core/sample/algorithms/string/knuth_morris_pratt.nako3 +50 -0
- package/core/sample/algorithms/string/run_length_encoding.nako3 +25 -0
- package/core/src/nako3.mts +178 -614
- package/core/src/nako_basic_plugins.mts +39 -0
- package/core/src/nako_core_version.mts +2 -2
- package/core/src/nako_csv.mts +0 -1
- package/core/src/nako_event.mts +49 -0
- package/core/src/nako_gen.mts +320 -209
- package/core/src/nako_global.mts +18 -0
- package/core/src/nako_indent_inline.mts +2 -2
- package/core/src/nako_lex_rules.mts +1 -1
- package/core/src/nako_parser3.mts +111 -166
- package/core/src/nako_parser_async.mts +165 -0
- package/core/src/nako_parser_base.mts +4 -55
- package/core/src/nako_parser_message.mts +105 -0
- package/core/src/nako_parser_operator.mts +93 -0
- package/core/src/nako_plugin_manager.mts +260 -0
- package/core/src/nako_require.mts +292 -0
- package/core/src/nako_runner.mts +208 -0
- package/core/src/nako_tokenizer.mts +221 -0
- package/core/src/plugin_csv.mts +1 -1
- package/core/src/plugin_system.mts +34 -3259
- package/core/src/plugin_system_array.mts +699 -0
- package/core/src/plugin_system_datetime.mts +368 -0
- package/core/src/plugin_system_debug.mts +403 -0
- package/core/src/plugin_system_dict.mts +85 -0
- package/core/src/plugin_system_json.mts +73 -0
- package/core/src/plugin_system_math.mts +383 -0
- package/core/src/plugin_system_regexp.mts +120 -0
- package/core/src/plugin_system_stdio.mts +86 -0
- package/core/src/plugin_system_string.mts +666 -0
- package/core/src/plugin_system_timer.mts +152 -0
- package/core/src/plugin_system_types.mts +151 -0
- package/core/src/plugin_system_url.mts +193 -0
- package/core/src/plugin_toml.mts +3 -3
- package/core/test/algorithm_samples_test.mjs +58 -0
- package/core/test/algorithms/graph/dijkstra_test.nako3 +21 -0
- package/core/test/algorithms/graph/kruskal_test.nako3 +21 -0
- package/core/test/algorithms/helper.mjs +13 -0
- package/core/test/algorithms/math/euclidean_gcd_test.nako3 +13 -0
- package/core/test/algorithms/math/sieve_of_eratosthenes_test.nako3 +10 -0
- package/core/test/algorithms/search/binary_search_test.nako3 +15 -0
- package/core/test/algorithms/search/breadth_first_search_test.nako3 +13 -0
- package/core/test/algorithms/search/depth_first_search_test.nako3 +13 -0
- package/core/test/algorithms/sort/heap_sort_test.nako3 +13 -0
- package/core/test/algorithms/sort/insertion_sort_test.nako3 +13 -0
- package/core/test/algorithms/sort/merge_sort_test.nako3 +18 -0
- package/core/test/algorithms/sort/quick_sort_test.nako3 +34 -0
- package/core/test/algorithms/string/knuth_morris_pratt_test.nako3 +16 -0
- package/core/test/algorithms/string/run_length_encoding_test.nako3 +13 -0
- package/core/test/array_test.mjs +3 -0
- package/core/test/fixtures/README.md +39 -0
- package/core/test/fixtures/make_parser_ast_golden.mjs +31 -0
- package/core/test/fixtures/parser_ast_golden.json +8027 -0
- package/core/test/fixtures/parser_corpus.mjs +120 -0
- package/core/test/func_call.mjs +18 -0
- package/core/test/func_test.mjs +28 -0
- package/core/test/indent_test.mjs +6 -0
- package/core/test/nako_basic_plugins_test.mjs +44 -0
- package/core/test/nako_event_test.mjs +127 -0
- package/core/test/nako_gen_perf_test.mjs +178 -0
- package/core/test/nako_parser_async_test.mjs +385 -0
- package/core/test/nako_parser_test.mjs +160 -0
- package/core/test/nako_plugin_manager_test.mjs +185 -0
- package/core/test/nako_require_test.mjs +153 -0
- package/core/test/nako_runner_test.mjs +174 -0
- package/core/test/nako_tokenizer_test.mjs +115 -0
- package/core/test/plugin_system_debug_test.mjs +138 -0
- package/core/test/plugin_system_split_test.mjs +179 -0
- package/core/test/plugin_system_test.mjs +6 -0
- package/core/tsconfig.json +0 -1
- package/demo/browsers.html +1 -1
- package/doc/SETUP.md +1 -1
- package/doc/ai-code-generation.md +136 -0
- package/doc/browsers.md +1 -1
- package/doc/command_list.json +16842 -0
- package/doc/search_command.md +222 -0
- package/doc/syntax-nako3.md +344 -0
- package/package.json +29 -26
- package/release/_hash.txt +40 -40
- package/release/_script-tags.txt +16 -16
- package/release/command.json +1 -1
- package/release/command.json.js +1 -1
- package/release/command_cnako3.json +1 -1
- package/release/command_list.json +1 -1
- package/release/edit_main.js +6 -6
- package/release/edit_main.js.map +3 -3
- package/release/editor.js +6 -6
- package/release/plugin_caniuse.js +1 -1
- package/release/plugin_caniuse.js.map +2 -2
- package/release/plugin_keigo.js.map +3 -3
- package/release/plugin_markup.js +46 -46
- package/release/plugin_markup.js.map +3 -3
- package/release/plugin_weykturtle3d.js +1 -1
- package/release/plugin_weykturtle3d.js.map +3 -3
- package/release/version.js +2 -2
- package/release/version_main.js +2 -2
- package/release/version_main.js.map +1 -1
- package/release/wnako3.js +219 -230
- package/release/wnako3.js.map +4 -4
- package/release/wnako3webworker.js +193 -204
- package/release/wnako3webworker.js.map +4 -4
- package/src/browsers.mjs +1 -1
- package/src/browsers.txt +0 -1
- package/src/cnako3mod.mjs +7 -2
- package/src/cnako3mod.mts +7 -2
- package/src/nako_version.mjs +2 -2
- package/src/nako_version.mts +2 -2
- package/src/plugin_browser_ajax.mjs +4 -4
- package/src/plugin_browser_ajax.mts +4 -4
- package/src/plugin_browser_audio.mjs +10 -10
- package/src/plugin_browser_audio.mts +10 -10
- package/src/plugin_browser_camera.mjs +4 -4
- package/src/plugin_browser_camera.mts +4 -4
- package/src/plugin_browser_canvas.mjs +2 -2
- package/src/plugin_browser_canvas.mts +2 -2
- package/src/plugin_browser_crypto.mjs +3 -3
- package/src/plugin_browser_crypto.mts +3 -3
- package/src/plugin_browser_dom_event.mjs +1 -1
- package/src/plugin_browser_dom_event.mts +1 -1
- package/src/plugin_browser_geolocation.mjs +1 -1
- package/src/plugin_browser_geolocation.mts +1 -1
- package/src/plugin_browser_hotkey.mjs +1 -1
- package/src/plugin_browser_hotkey.mts +1 -1
- package/src/plugin_browser_html.mjs +1 -1
- package/src/plugin_browser_html.mts +1 -1
- package/src/plugin_browser_location.mjs +1 -1
- package/src/plugin_browser_location.mts +1 -1
- package/src/plugin_browser_speech.mjs +1 -1
- package/src/plugin_browser_speech.mts +1 -1
- package/src/plugin_browser_storage.mjs +2 -2
- package/src/plugin_browser_storage.mts +2 -2
- package/src/plugin_httpserver.mjs +3 -3
- package/src/plugin_httpserver.mts +3 -3
- package/src/plugin_keigo.mjs +2 -2
- package/src/plugin_keigo.mts +2 -2
- package/src/plugin_node.mjs +48 -48
- package/src/plugin_node.mts +53 -53
- package/src/plugin_weykturtle3d.mjs +56 -56
- package/src/plugin_weykturtle3d.mts +56 -56
- package/src/wnako3.mjs +1 -1
- package/src/wnako3.mts +1 -1
- package/src/wnako3_editor.mjs +5 -5
- package/src/wnako3_editor.mts +5 -5
- package/src/wnako3mod.mjs +2 -2
- package/src/wnako3mod.mts +2 -2
- package/test/nako3edit/index_nako3_test.mjs +282 -0
- package/test/nako3server/index_nako3_test.mjs +239 -0
- package/test/node/ai_code_generation_guide_test.mjs +29 -0
- package/test/node/node_version_support_test.mjs +45 -0
- package/test/node/search_command_test.mjs +174 -0
- package/tools/nako3edit/AGENTS.md +23 -0
- package/tools/nako3edit/index.nako3 +404 -0
- package/tools/nako3server/AGENTS.md +23 -0
- package/tools/nako3server/index.nako3 +156 -23
- package/core/src/nako3.mjs +0 -1021
- package/core/src/nako_ast.mjs +0 -4
- package/core/src/nako_colors.mjs +0 -77
- package/core/src/nako_core_version.mjs +0 -8
- package/core/src/nako_csv.mjs +0 -193
- package/core/src/nako_errors.mjs +0 -166
- package/core/src/nako_from_dncl.mjs +0 -285
- package/core/src/nako_from_dncl2.mjs +0 -347
- package/core/src/nako_gen.mjs +0 -2500
- package/core/src/nako_global.mjs +0 -138
- package/core/src/nako_indent.mjs +0 -442
- package/core/src/nako_indent_chars.mjs +0 -29
- package/core/src/nako_indent_inline.mjs +0 -361
- package/core/src/nako_josi_list.mjs +0 -47
- package/core/src/nako_lex_rules.mjs +0 -319
- package/core/src/nako_lexer.mjs +0 -794
- package/core/src/nako_logger.mjs +0 -221
- package/core/src/nako_parser3.mjs +0 -3250
- package/core/src/nako_parser_base.mjs +0 -403
- package/core/src/nako_parser_const.mjs +0 -37
- package/core/src/nako_prepare.mjs +0 -329
- package/core/src/nako_reserved_words.mjs +0 -42
- package/core/src/nako_source_mapping.mjs +0 -207
- package/core/src/nako_test.mjs +0 -37
- package/core/src/nako_token.mjs +0 -1
- package/core/src/nako_tools.mjs +0 -53
- package/core/src/nako_types.mjs +0 -14
- package/core/src/plugin_api.mjs +0 -4
- package/core/src/plugin_csv.mjs +0 -97
- package/core/src/plugin_math.mjs +0 -352
- package/core/src/plugin_promise.mjs +0 -102
- package/core/src/plugin_system.mjs +0 -3810
- package/core/src/plugin_test.mjs +0 -52
- package/core/src/plugin_toml.mjs +0 -39
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// deno-lint-ignore-file no-explicit-any
|
|
2
|
+
/**
|
|
3
|
+
* なでしこ3の字句解析パイプライン
|
|
4
|
+
*
|
|
5
|
+
* NakoCompiler から字句解析とソースマップ処理を分離したモジュール (#2360)
|
|
6
|
+
* 循環参照を避けるため、このモジュールは nako3.mts を参照せず、
|
|
7
|
+
* 必要な機能は NakoTokenizerHost インターフェイス経由で受け取る。
|
|
8
|
+
*/
|
|
9
|
+
import { Token } from './nako_types.mjs'
|
|
10
|
+
import { NakoLexer } from './nako_lexer.mjs'
|
|
11
|
+
import { NakoPrepare } from './nako_prepare.mjs'
|
|
12
|
+
import { convertInlineIndent, convertIndentSyntax } from './nako_indent_inline.mjs'
|
|
13
|
+
import { convertDNCL } from './nako_from_dncl.mjs'
|
|
14
|
+
import { convertDNCL2 } from './nako_from_dncl2.mjs'
|
|
15
|
+
import { SourceMappingOfTokenization, SourceMappingOfIndentSyntax, OffsetToLineColumn, subtractSourceMapByPreCodeLength } from './nako_source_mapping.mjs'
|
|
16
|
+
import { NakoLexerError, InternalLexerError } from './nako_errors.mjs'
|
|
17
|
+
import { NakoLogger } from './nako_logger.mjs'
|
|
18
|
+
|
|
19
|
+
/** 字句解析の結果 */
|
|
20
|
+
export interface LexResult {
|
|
21
|
+
commentTokens: Token[];
|
|
22
|
+
tokens: Token[];
|
|
23
|
+
requireTokens: Token[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* NakoTokenizer がホスト(NakoCompiler)に要求する最小限の機能
|
|
28
|
+
*/
|
|
29
|
+
export interface NakoTokenizerHost {
|
|
30
|
+
getLogger (): NakoLogger;
|
|
31
|
+
/** 取り込み文を依存ファイルのトークン列で置換する */
|
|
32
|
+
replaceRequireStatements (tokens: Token[], includeGuard?: Set<string>): Token[];
|
|
33
|
+
/** 取り込み文を削除する(シンタックスハイライト用) */
|
|
34
|
+
removeRequireStatements (tokens: Token[]): Token[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* なでしこのソースコードをトークン列へ分割するクラス
|
|
39
|
+
*/
|
|
40
|
+
export class NakoTokenizer {
|
|
41
|
+
readonly prepare: NakoPrepare
|
|
42
|
+
readonly lexer: NakoLexer
|
|
43
|
+
private host: NakoTokenizerHost
|
|
44
|
+
|
|
45
|
+
constructor (host: NakoTokenizerHost) {
|
|
46
|
+
this.host = host
|
|
47
|
+
this.prepare = NakoPrepare.getInstance()
|
|
48
|
+
this.lexer = new NakoLexer(host.getLogger())
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** モジュール(名前空間)の一覧を取得する */
|
|
52
|
+
getModList (): string[] {
|
|
53
|
+
return this.lexer.modList
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* コードを単語に分割する
|
|
58
|
+
* @param code なでしこのプログラム
|
|
59
|
+
* @param line なでしこのプログラムの行番号
|
|
60
|
+
* @param filename
|
|
61
|
+
* @param preCode
|
|
62
|
+
* @returns トークンのリスト
|
|
63
|
+
*/
|
|
64
|
+
rawtokenize (code: string, line: number, filename: string, preCode = ''): Token[] {
|
|
65
|
+
if (!code.startsWith(preCode)) {
|
|
66
|
+
throw new Error('codeの先頭にはpreCodeを含める必要があります。')
|
|
67
|
+
}
|
|
68
|
+
// 名前空間のモジュールリストに自身を追加
|
|
69
|
+
const modName = NakoLexer.filenameToModName(filename)
|
|
70
|
+
const modList = this.getModList()
|
|
71
|
+
if (modList.indexOf(modName) < 0) { modList.unshift(modName) }
|
|
72
|
+
// 全角半角の統一処理
|
|
73
|
+
const preprocessed = this.prepare.convert(code)
|
|
74
|
+
const tokenizationSourceMapping = new SourceMappingOfTokenization(code.length, preprocessed)
|
|
75
|
+
const indentationSyntaxSourceMapping = new SourceMappingOfIndentSyntax(code, [], [])
|
|
76
|
+
const offsetToLineColumn = new OffsetToLineColumn(code)
|
|
77
|
+
// トークン分割
|
|
78
|
+
let tokens: Token[]
|
|
79
|
+
try {
|
|
80
|
+
tokens = this.lexer.tokenize(preprocessed.map((v) => v.text).join(''), line, filename)
|
|
81
|
+
} catch (err) {
|
|
82
|
+
if (!(err instanceof InternalLexerError)) {
|
|
83
|
+
throw err
|
|
84
|
+
}
|
|
85
|
+
// エラー位置をソースコード上の位置に変換して返す
|
|
86
|
+
const dest = indentationSyntaxSourceMapping.map(tokenizationSourceMapping.map(err.preprocessedCodeStartOffset), tokenizationSourceMapping.map(err.preprocessedCodeEndOffset))
|
|
87
|
+
const line: number|undefined = dest.startOffset === null ? err.line : offsetToLineColumn.map(dest.startOffset, false).line
|
|
88
|
+
const map = subtractSourceMapByPreCodeLength({ ...dest, line }, preCode)
|
|
89
|
+
throw new NakoLexerError(err.msg, map.startOffset, map.endOffset, map.line, filename)
|
|
90
|
+
}
|
|
91
|
+
// DNCL ver2 (core #41)
|
|
92
|
+
tokens = convertDNCL2(tokens)
|
|
93
|
+
// DNCL ver1 (#1140)
|
|
94
|
+
tokens = convertDNCL(tokens)
|
|
95
|
+
// インデント構文を変換 #596
|
|
96
|
+
tokens = convertIndentSyntax(tokens)
|
|
97
|
+
// インラインインデントを変換 #1215
|
|
98
|
+
tokens = convertInlineIndent(tokens)
|
|
99
|
+
|
|
100
|
+
// ソースコード上の位置に変換
|
|
101
|
+
tokens = tokens.map((token) => {
|
|
102
|
+
const dest = indentationSyntaxSourceMapping.map(
|
|
103
|
+
tokenizationSourceMapping.map(token.preprocessedCodeOffset || 0),
|
|
104
|
+
tokenizationSourceMapping.map((token.preprocessedCodeOffset || 0) + (token.preprocessedCodeLength || 0))
|
|
105
|
+
)
|
|
106
|
+
let line = token.line
|
|
107
|
+
let column = 0
|
|
108
|
+
if (token.type === 'eol' && dest.endOffset !== null) {
|
|
109
|
+
// eolはnako_genで `line = ${eolToken.line};` に変換されるため、
|
|
110
|
+
// 行末のeolのlineは次の行の行数を表す必要がある。
|
|
111
|
+
const out = offsetToLineColumn.map(dest.endOffset, false)
|
|
112
|
+
line = out.line
|
|
113
|
+
column = out.column
|
|
114
|
+
} else if (dest.startOffset !== null) {
|
|
115
|
+
const out = offsetToLineColumn.map(dest.startOffset, false)
|
|
116
|
+
line = out.line
|
|
117
|
+
column = out.column
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
...token,
|
|
121
|
+
...subtractSourceMapByPreCodeLength({ line, column, startOffset: dest.startOffset, endOffset: dest.endOffset }, preCode),
|
|
122
|
+
rawJosi: token.josi
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
return tokens
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 単語の属性を構文解析に先立ち補正する
|
|
130
|
+
* @param {Token[]} tokens トークンのリスト
|
|
131
|
+
* @param {boolean} isFirst 最初の呼び出しかどうか
|
|
132
|
+
* @param {string} filename
|
|
133
|
+
* @returns コード (なでしこ)
|
|
134
|
+
*/
|
|
135
|
+
converttoken (tokens: Token[], isFirst: boolean, filename: string): Token[] {
|
|
136
|
+
const tok = this.lexer.replaceTokens(tokens, isFirst, filename)
|
|
137
|
+
return tok
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* typeがcodeのトークンを単語に分割するための処理
|
|
142
|
+
* @param {string} code
|
|
143
|
+
* @param {number} line
|
|
144
|
+
* @param {string} filename
|
|
145
|
+
* @param {number | null} startOffset
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
lexCodeToken (code: string, line: number, filename: string, startOffset: number|null): {commentTokens: Token[], tokens: Token[]} {
|
|
149
|
+
// 単語に分割
|
|
150
|
+
let tokens = this.rawtokenize(code, line, filename, '')
|
|
151
|
+
|
|
152
|
+
// 文字列内位置からファイル内位置へ変換
|
|
153
|
+
if (startOffset === null) {
|
|
154
|
+
for (const token of tokens) {
|
|
155
|
+
token.startOffset = undefined
|
|
156
|
+
token.endOffset = undefined
|
|
157
|
+
}
|
|
158
|
+
} else {
|
|
159
|
+
for (const token of tokens) {
|
|
160
|
+
if (token.startOffset !== undefined) {
|
|
161
|
+
token.startOffset += startOffset
|
|
162
|
+
}
|
|
163
|
+
if (token.endOffset !== undefined) {
|
|
164
|
+
token.endOffset += startOffset
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// convertTokenで消されるコメントのトークンを残す
|
|
170
|
+
const commentTokens = tokens.filter((t) => t.type === 'line_comment' || t.type === 'range_comment')
|
|
171
|
+
.map((v) => ({ ...v })) // clone
|
|
172
|
+
|
|
173
|
+
tokens = this.converttoken(tokens, false, filename)
|
|
174
|
+
|
|
175
|
+
return { tokens, commentTokens }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** 字句解析を行う */
|
|
179
|
+
lex (code: string, filename = 'main.nako3', preCode = '', syntaxHighlighting = false): LexResult {
|
|
180
|
+
// 単語に分割
|
|
181
|
+
let tokens = this.rawtokenize(code, 0, filename, preCode)
|
|
182
|
+
|
|
183
|
+
// require文を再帰的に置換する
|
|
184
|
+
const requireStatementTokens = syntaxHighlighting ? this.host.removeRequireStatements(tokens) : this.host.replaceRequireStatements(tokens, undefined)
|
|
185
|
+
for (const t of requireStatementTokens) {
|
|
186
|
+
if (t.type === 'word' || t.type === 'not') {
|
|
187
|
+
t.type = 'require'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (requireStatementTokens.length >= 3) {
|
|
191
|
+
// modList を更新
|
|
192
|
+
for (let i = 0; i < requireStatementTokens.length; i += 3) {
|
|
193
|
+
let modName = requireStatementTokens[i + 1].value
|
|
194
|
+
modName = NakoLexer.filenameToModName(modName)
|
|
195
|
+
if (this.lexer.modList.indexOf(modName) < 0) {
|
|
196
|
+
this.lexer.modList.push(modName)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// convertTokenで消されるコメントのトークンを残す
|
|
202
|
+
const commentTokens: Token[] = tokens.filter((t) => t.type === 'line_comment' || t.type === 'range_comment')
|
|
203
|
+
.map((v) => ({ ...v })) // clone
|
|
204
|
+
|
|
205
|
+
tokens = this.converttoken(tokens, true, filename)
|
|
206
|
+
|
|
207
|
+
// 'string_ex'トークンから変換された'code'トークンを字句解析する
|
|
208
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
209
|
+
if (tokens[i] && tokens[i].type === 'code') {
|
|
210
|
+
const children = this.lexCodeToken(tokens[i].value, tokens[i].line, filename, tokens[i].startOffset || 0)
|
|
211
|
+
commentTokens.push(...children.commentTokens)
|
|
212
|
+
tokens.splice(i, 1, ...children.tokens)
|
|
213
|
+
i--
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
this.host.getLogger().trace('--- lex ---\n' + JSON.stringify(tokens, null, 2))
|
|
218
|
+
|
|
219
|
+
return { commentTokens, tokens, requireTokens: requireStatementTokens }
|
|
220
|
+
}
|
|
221
|
+
}
|
package/core/src/plugin_csv.mts
CHANGED