Shifting and naming.

This commit is contained in:
2025-10-11 14:46:02 -07:00
parent 55df27de98
commit 9ea6868938
9 changed files with 478 additions and 377 deletions

View File

@@ -89,7 +89,7 @@ impl fmt::Display for Token {
pub enum Lexer<'a> {
Working(LexerState<'a>),
Errored(LexerError),
Done(usize),
Done,
}
struct LexerState<'a> {
@@ -120,7 +120,7 @@ impl<'a> Iterator for Lexer<'a> {
fn next(&mut self) -> Option<Self::Item> {
match self {
Lexer::Done(_) => None,
Lexer::Done => None,
Lexer::Errored(e) => Some(Err(e.clone())),
Lexer::Working(state) => match state.next_token() {
Err(e) => {
@@ -130,7 +130,7 @@ impl<'a> Iterator for Lexer<'a> {
}
Ok(None) => {
*self = Lexer::Done(state.stream.offset());
*self = Lexer::Done;
None
}