Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit 69a40ba

Browse files
committed
新增调试配置初始化和帮助信息,更新用法提示,提升调试选项的可用性和用户体验。
1 parent 660ca56 commit 69a40ba

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/main.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mod ast;
99
mod parser;
1010
mod interpreter;
1111
mod analyzer;
12+
mod debug_config;
1213
use interpreter::jit;
1314

1415
use ast::Program;
@@ -178,11 +179,11 @@ fn format_execution_time(duration_ms: f64) -> String {
178179

179180
fn main() {
180181
let args: Vec<String> = std::env::args().collect();
181-
182+
182183
if args.len() < 2 {
183184
println!("用法: {} <文件路径> [选项]", args[0]);
184185
println!("");
185-
println!("选项:");
186+
println!("传统选项:");
186187
println!(" --cn-parser 显示详细的解析信息");
187188
println!(" --cn-lexer 显示词法分析信息");
188189
println!(" --cn-debug 启用调试模式");
@@ -193,13 +194,20 @@ fn main() {
193194
println!(" --cn-time 显示程序执行时间");
194195
println!(" --cn-rwlock 🚀 v0.6.2 显示读写锁性能统计");
195196
println!("");
197+
println!("🆕 v0.7.4 细粒度调试选项:");
198+
debug_config::print_debug_help();
199+
println!("");
196200
println!("示例:");
197201
println!(" {} hello.cn", args[0]);
198202
println!(" {} hello.cn --cn-time", args[0]);
199-
println!(" {} hello.cn --cn-return --cn-time", args[0]);
203+
println!(" {} hello.cn --debug-jit", args[0]);
204+
println!(" {} hello.cn --debug-lifetime --cn-time", args[0]);
200205
return;
201206
}
202207

208+
// v0.7.4新增:初始化调试配置
209+
debug_config::init_debug_config(&args);
210+
203211
let file_path = &args[1];
204212
let debug_parser = args.iter().any(|arg| arg == "--cn-parser");
205213
let debug_lexer = args.iter().any(|arg| arg == "--cn-lexer");

0 commit comments

Comments
 (0)