Skip to content

Commit

Permalink
Add a loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Dec 19, 2023
1 parent 7977d0b commit 60ede9d
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/elements/command/if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,21 @@ impl IfCommand {
return None;
}

/*
loop {
let mut then_script = None;
if command::eat_inner_script(feeder, core, "then", vec!["elif"], &mut if_script) {
}else if command::eat_inner_script(feeder, core, "then", vec!["fi"], &mut if_script) {
if command::eat_inner_script(feeder, core, "then", vec!["fi", "else", "elif"], &mut then_script) {
ans.text.push_str("then");
ans.text.push_str(&then_script.as_mut().unwrap().get_text());
ans.then_scripts.push(then_script.unwrap());
}else{
return None;
}
}*/

let mut then_script = None;
if command::eat_inner_script(feeder, core, "then", vec!["fi"], &mut then_script) {
ans.text.push_str("then");
ans.text.push_str(&then_script.as_mut().unwrap().get_text());
ans.text.push_str(&feeder.consume(2)); //fi
ans.then_scripts.push(then_script.unwrap());
if feeder.starts_with("fi") {
ans.text.push_str(&feeder.consume(2));
break;
}

}else{
return None;
}

loop {
Expand Down

0 comments on commit 60ede9d

Please sign in to comment.