erg_common/
help_messages.rs1use crate::switch_lang;
2
3pub fn command_message<'a>() -> &'a str {
5 switch_lang!(
6 "japanese" =>
7 "\
8USAGE:
9 erg [OPTIONS] [COMMAND] [ARGS]...
10
11ARGS:
12 <script> スクリプトファイルからプログラムを読み込む
13 <script>に渡す引数を入力する
14
15OPTIONS
16 --help/-?/-h このhelpを表示
17 --version/-V バージョンを表示
18 --verbose 0|1|2 冗長性レベルを指定
19 --opt-level/-o 0|1|2|3 最適化レベルを指定
20 --python-version/-p (uint 32 number) Pythonバージョンを指定
21 --py-server-timeout (uint 64 number) PythonのREPLサーバーのタイムアウト時間を指定
22 --dump-as-pyc .pycファイルにダンプ
23 --mode (mode) 指定モードで実行(詳細は--mode --helpを参照)
24 --code/-c (string) 文字列として渡したプログラムを実行
25 --module/-m (string) モジュールを実行
26
27COMMAND
28 lex 字句解析
29 parse 構文解析
30 typecheck|tc 型検査
31 check 全ての検査(所有権検査, 副作用検査などを含む)
32 compile コンパイル
33 transpile トランスパイル
34 run|exec 実行(デフォルト)
35 server 言語サーバーを起動
36 lint Lintを実行
37 pack パッケージング管理",
38
39 "simplified_chinese" =>
40 "\
41USAGE:
42 erg [OPTIONS] [COMMAND] [ARGS]...
43
44ARGS:
45 <script> 从脚本文件读取程序
46 参数也可以指定要传递给 <script>
47
48OPTIONS
49 --help/-?/-h 显示帮助
50 --version/-V 显示版本
51 --verbose 0|1|2 指定细致程度
52 --opt-level/-o 0|1|2|3 指定优化级别
53 --python-version/-p (uint 32 number) Python 版本
54 --py-server-timeout (uint 64 number) 指定等待 REPL 输出的秒数
55 --dump-as-pyc 转储为 .pyc 文件
56 --mode (mode) 执行模式 (更多信息见`--mode --help`)
57 --code/-c (string) 作为字符串传入程序
58 --module/-m (string) 要执行的模块
59
60COMMAND
61 lex 字词解析
62 parse 语法解析
63 typecheck|tc 类型检查
64 check 全部检查(包括所有权检查, 副作用检查等)
65 compile 编译
66 transpile 转译
67 run|exec 执行(默认模式)
68 server 执行语言服务器
69 lint 执行 Lint
70 pack 执行打包管理",
71
72 "traditional_chinese" =>
73 "\
74USAGE:
75 erg [OPTIONS] [COMMAND] [ARGS]...
76
77ARGS:
78 <script> 從腳本檔案讀取程式
79 參數也可以指定要傳遞給 <script>
80
81OPTIONS
82 --help/-?/-h 顯示幫助
83 --version/-V 顯示版本
84 --verbose 0|1|2 指定細緻程度
85 --opt-level/-o 0|1|2|3 指定優化級別
86 --python-version/-p (uint 32 number) Python 版本
87 --py-server-timeout (uint 64 number) 指定等待 REPL 輸出的秒數
88 --dump-as-pyc 轉儲為 .pyc 文件
89 --mode (mode) 執行模式 (更多信息見`--mode --help`)
90 --code/-c (string) 作為字串傳入程式
91 --module/-m (string) 要執行的模塊
92
93COMMAND
94 lex 字詞解析
95 parse 語法解析
96 typecheck|tc 型檢查
97 check 全部檢查(包括所有權檢查, 副作用檢查等)
98 compile 編譯
99 transpile 轉譯
100 run|exec 執行(預設模式)
101 server 執行語言伺服器
102 lint 執行 Lint
103 pack 執行打包管理",
104
105 "english" =>
106 "\
107USAGE:
108 erg [OPTIONS] [COMMAND] [ARGS]...
109
110ARGS:
111 <script> program read from script file
112 Arguments can also be specified to be passed to the <script>
113
114OPTIONS
115 --help/-?/-h show this help
116 --version/-V show version
117 --verbose 0|1|2 verbosity level
118 --opt-level/-o 0|1|2|3 optimization level
119 --python-version/-p (uint 32 number) Python version
120 --py-server-timeout (uint 64 number) timeout for the Python REPL server
121 --dump-as-pyc dump as .pyc file
122 --mode (mode) execution mode (See `--mode --help` for details)
123 --code/-c (string) program passed in as string
124 --module/-m (string) module to be executed
125
126COMMAND
127 lex lexical analysis
128 parse syntax analysis
129 typecheck|tc type check
130 check full check (including ownership check, effect check, etc.)
131 compile compile
132 transpile transpile
133 run|exec execute (default mode)
134 server start Erg language server
135 lint lint
136 pack run package manager",
137 )
138}
139
140pub fn mode_message<'a>() -> &'a str {
141 switch_lang!(
142 "japanese" =>
143 "\
144USAGE:
145 erg --mode [lex | parse | lower | check | compile | exec | read | lint | pack] [SUBCOMMAND] [ARGS]...
146
147lex
148 <filename>.erやREPLなどから入力を受け取り、字句を解析
149 解析結果をTokenStreamとして返す
150
151parse
152 lexを実行し、TokenStreamを獲得して構文を解析
153 脱糖しAST(抽象構文木)を返す
154
155typecheck/lower
156 parseを実行し、ASTを獲得
157 名前解決、型検査・型推論をしてHIR(高レベル中間表現)を返す
158
159check
160 lowerを実行
161 副作用、所有権を確認しHIRを返す
162
163compile
164 checkを実行
165 HIRからバイトコードを生成し、<filename>.pycを出力する
166
167transpile
168 checkを実行
169 HIRからPythonスクリプトを生成し、<filename>.pyを出力
170
171run/exec
172 compileを実行し、更に<filename>.pycを実行
173
174read
175 <filename>.pycをデシリアライズしコードオブジェクトの情報をダンプ
176
177lint
178 プログラムをLintする
179
180pack
181 パッケージ管理",
182
183 "simplified_chinese" =>
184 "\
185USAGE:
186 erg --mode [lex | parse | lower | check | compile | exec | read] [SUBCOMMAND] [ARGS]...
187
188lex
189 从 <filename>.er, REPL 等接受输入, 并标记文本
190 以 TokenStream 形式返回分析结果
191
192parse
193 执行 lex, 获取 TokenStream, 并解析语法
194 将多模式定义语句的语法糖按匹配转换并返回 AST(抽象语法树)
195
196typecheck/lower
197 执行 parse
198 解析名称、检查类型和推断, 并返回 HIR(高级中间表示)
199
200check
201 执行 lower
202 检查副作用、所有权并返回 HIR
203
204compile
205 运行 check 以获取检查完成的 AST
206 编译 AST 并返回 <文件名>.pyc
207
208transpile
209 运行 check 以获取检查完成的 AST
210 将 AST 转换为 Python 代码并返回 <文件名>.py
211
212run/exec
213 运行 check 以获取检查完成的 AST
214 在执行 <文件名>.pyc 后删除 <文件名>.pyc
215
216read
217 反序列化 <文件名>.pyc 和 dump
218
219lint
220 Lint 程序
221
222pack
223 包管理",
224
225 "traditional_chinese" =>
226 "\
227USAGE:
228 erg --mode [lex | parse | lower | check | compile | exec | read] [SUBCOMMAND] [ARGS]...
229
230lex
231 從 <檔名>.er, REPL 等接受輸入, 並標記文字
232 以 TokenStream 形式返回分析結果
233
234parse
235 執行 lex, 獲取 TokenStream, 並解析語法
236 將多模式定義語句的語法糖按匹配轉換並返回 AST(抽象語法樹)
237
238typecheck/lower
239 執行 parse
240 解析名稱、檢查類型和推斷, 並返回 HIR(高級中間表示)
241
242check
243 執行 lower
244 檢查副作用、所有權並返回 HIR
245
246compile
247 運行 check 以獲取檢查完成的 AST
248 編譯 AST 並返回 <檔名>.pyc
249
250transpile
251 運行 check 以獲取檢查完成的 AST
252 從 HIR 生成 Python 腳本並返回 <檔名>.py
253
254exec
255 運行check以獲取檢查完成的 AST
256 在執行 <檔名>.pyc 後删除 <檔名>.pyc
257
258read
259 反序列化 <檔名>.pyc 和 dump
260
261lint
262 Lint 程式
263
264pack
265 封裝管理",
266
267 "english" =>
268 "\
269USAGE:
270 erg --mode [lex | parse | lower | check | compile | exec | read] [SUBCOMMAND] [ARGS]...
271
272lex
273 Receive input from <filename>.er, REPL, etc. and lex the text
274 Returns the analysis results as a TokenStream
275
276parse
277 Executes lex to get TokenStream, and parses it
278 Degenerate and return AST (Abstract Syntax Tree)
279
280typecheck/lower
281 Execute parse to obtain AST
282 Performs name resolution, type checking, and type inference, and returns HIR (High-level Intermediate Representation)
283
284check
285 Execute lower
286 Checks for side-effects, ownership, and returns HIR
287
288compile
289 Execute check
290 Generates bytecode from HIR and outputs <filename>.pyc
291
292transpile
293 Execute check
294 Generates Python script from HIR and outputs <filename>.py
295
296run/exec
297 Execute compile and then <filename>.pyc
298
299read
300 Deserialize <filename>.pyc and dump code object information
301
302lint
303 Lint the program
304
305pack
306 Package management",
307 )
308}
309
310pub const OPTIONS: &[&str] = &[
311 "--build-features",
312 "-c",
313 "--code",
314 "--check",
315 "--compile",
316 "--dest",
317 "--dump-as-pyc",
318 "--language-server",
319 "--no-std",
320 "--help",
321 "-?",
322 "-h",
323 "--hex-py-magic-num",
324 "--hex-python-magic-number",
325 "--mode",
326 "--module",
327 "-m",
328 "--optimization-level",
329 "--opt-level",
330 "-o",
331 "--output-dir",
332 "--ping",
333 "--ps1",
334 "--ps2",
335 "--python-version",
336 "-p",
337 "--py-server-timeout",
338 "--py-command",
339 "--python-command",
340 "--py-magic-num",
341 "--python-magic-number",
342 "--quiet-startup",
343 "--quiet-repl",
344 "--show-type",
345 "-t",
346 "--target-version",
347 "--version",
348 "-V",
349 "--verbose",
350];