Fixed some hangs in the lexer

This commit is contained in:
2026-02-23 19:21:57 -05:00
parent d8fda01a5c
commit 4f834e9709

View File

@@ -265,6 +265,7 @@ impl LexStream {
} }
if !found_fd && !self.flags.contains(LexFlags::LEX_UNFINISHED) { if !found_fd && !self.flags.contains(LexFlags::LEX_UNFINISHED) {
self.cursor = pos;
return Some(Err(ShErr::full( return Some(Err(ShErr::full(
ShErrKind::ParseErr, ShErrKind::ParseErr,
"Invalid redirection", "Invalid redirection",
@@ -625,6 +626,7 @@ impl LexStream {
} }
let mut new_tk = self.get_token(self.cursor..pos, TkRule::Str); let mut new_tk = self.get_token(self.cursor..pos, TkRule::Str);
if self.in_quote && !self.flags.contains(LexFlags::LEX_UNFINISHED) { if self.in_quote && !self.flags.contains(LexFlags::LEX_UNFINISHED) {
self.cursor = pos;
return Err(ShErr::full( return Err(ShErr::full(
ShErrKind::ParseErr, ShErrKind::ParseErr,
"Unterminated quote", "Unterminated quote",