implemented 'getopts' builtin

This commit is contained in:
2026-03-01 21:16:33 -05:00
parent 2ea44c55e9
commit 5a62f72947
9 changed files with 344 additions and 25 deletions

View File

@@ -1061,11 +1061,13 @@ pub fn lookahead(pat: &str, mut chars: Chars) -> Option<usize> {
pub fn case_pat_lookahead(mut chars: Peekable<Chars>) -> Option<usize> {
let mut pos = 0;
while let Some(ch) = chars.next() {
pos += 1;
pos += ch.len_utf8();
match ch {
_ if is_hard_sep(ch) => return None,
'\\' => {
chars.next();
if let Some(esc) = chars.next() {
pos += esc.len_utf8();
}
}
')' => return Some(pos),
'(' => return None,