added 'map', 'pop', 'push', 'fpop', 'fpush', and 'rotate' builtins

This commit is contained in:
2026-02-27 20:37:58 -05:00
parent bdc77eda30
commit c61360865f
10 changed files with 734 additions and 44 deletions

View File

@@ -1947,13 +1947,23 @@ impl LineBuf {
return;
};
let mut level: usize = 0;
let mut last_keyword: Option<String> = None;
for tk in tokens {
if tk.flags.contains(TkFlags::KEYWORD) {
match tk.as_str() {
"then" | "do" | "in" => level += 1,
"in" => {
if last_keyword.as_deref() == Some("case") {
level += 1;
} else {
// 'in' is also used in for loops, but we already increment level on 'do' for those
// so we just skip it here
}
}
"then" | "do" => level += 1,
"done" | "fi" | "esac" => level = level.saturating_sub(1),
_ => { /* Continue */ }
}
last_keyword = Some(tk.to_string());
} else if tk.class == TkRule::BraceGrpStart {
level += 1;
} else if tk.class == TkRule::BraceGrpEnd {