Fixed conditional block parsing not handling command chains

This commit is contained in:
2026-01-29 05:01:26 -05:00
parent 0e28b7bf49
commit 8933153c2b

View File

@@ -984,7 +984,7 @@ impl ParseStream {
loop { loop {
let prefix_keywrd = if cond_nodes.is_empty() { "if" } else { "elif" }; let prefix_keywrd = if cond_nodes.is_empty() { "if" } else { "elif" };
let Some(cond) = self.parse_block(true)? else { let Some(cond) = self.parse_cmd_list()? else {
self.panic_mode(&mut node_tks); self.panic_mode(&mut node_tks);
return Err(parse_err_full( return Err(parse_err_full(
&format!("Expected an expression after '{prefix_keywrd}'"), &format!("Expected an expression after '{prefix_keywrd}'"),
@@ -1164,7 +1164,7 @@ impl ParseStream {
node_tks.push(loop_tk); node_tks.push(loop_tk);
self.catch_separator(&mut node_tks); self.catch_separator(&mut node_tks);
let Some(cond) = self.parse_block(true)? else { let Some(cond) = self.parse_cmd_list()? else {
self.panic_mode(&mut node_tks); self.panic_mode(&mut node_tks);
return Err(parse_err_full( return Err(parse_err_full(
&format!("Expected an expression after '{loop_kind}'"), // It also implements Display &format!("Expected an expression after '{loop_kind}'"), // It also implements Display