implemented most variable parameter expansion builtins

This commit is contained in:
2025-05-12 16:14:06 -04:00
parent 2666670939
commit bbb8162201
4 changed files with 198 additions and 8 deletions

View File

@@ -339,6 +339,33 @@ impl LexStream {
pos += ch.len_utf8();
}
}
'$' if chars.peek() == Some(&'{') => {
pos += 2;
chars.next();
let mut brace_count = 0;
while let Some(brc_ch) = chars.next() {
match brc_ch {
'\\' => {
pos += 1;
if let Some(next_ch) = chars.next() {
pos += next_ch.len_utf8()
}
}
'{' => {
pos += 1;
brace_count += 1;
}
'}' => {
pos += 1;
brace_count -= 1;
if brace_count == 0 {
break
}
}
_ => pos += ch.len_utf8()
}
}
}
'$' if chars.peek() == Some(&'(') => {
pos += 2;
chars.next();