Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger: Allow specification of several breakpoints from cmdline args #1075

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions debugger/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct CliArgs {
grammar_file: Option<PathBuf>,
input_file: Option<PathBuf>,
rule: Option<String>,
breakpoint: Option<String>,
breakpoints: Vec<String>,
session_file: Option<PathBuf>,
no_update: bool,
}
Expand All @@ -233,7 +233,7 @@ impl Default for CliArgs {
grammar_file: None,
input_file: None,
rule: None,
breakpoint: None,
breakpoints: Vec::new(),
session_file: None,
no_update: false,
};
Expand Down Expand Up @@ -268,7 +268,7 @@ impl Default for CliArgs {
}
"-b" | "--breakpoint" => {
if let Some(breakpoint) = iter.next() {
result.breakpoint = Some(breakpoint);
result.breakpoints.push(breakpoint);
} else {
eprintln!("Error: missing breakpoint");
std::process::exit(1);
Expand All @@ -294,7 +294,7 @@ impl Default for CliArgs {
-g, --grammar <grammar file> - load .pest grammar\n\
-i, --input <input file> - load input file\n\
-r, --rule <rule> - run rule\n\
-b, --breakpoint <rule> - breakpoint at rule\n\
-b, --breakpoint <rule> - breakpoint at rule (can be specified multiple times)\n\
-s, --session <session file> - load session history file\n\
-h, --help - print this help menu\n\
"
Expand Down Expand Up @@ -326,8 +326,8 @@ impl CliArgs {
eprintln!("Error: {}", e);
}
}
if let Some(breakpoint) = &self.breakpoint {
context.breakpoint(breakpoint);
for breakpoint in self.breakpoints {
context.breakpoint(&breakpoint);
}
if let Some(rule) = self.rule {
if let Err(e) = context.run(&rule) {
Expand Down