diff --git a/notes.org b/notes.org index 2162255..54bdf33 100644 --- a/notes.org +++ b/notes.org @@ -185,6 +185,10 @@ CLOCK: [2025-05-04 dim. 14:01]--[2025-05-04 dim. 14:14] => 0:13 :EFFORT: 10 :END: -* TODO error offsets are incorrect +* DONE error offsets are incorrect * TODO remove old FromStr parser implementation + +* TODO use a better readline impl + +* TODO handle non-interactive input better diff --git a/src/tokens.rs b/src/tokens.rs index 5177532..86180fd 100644 --- a/src/tokens.rs +++ b/src/tokens.rs @@ -216,11 +216,12 @@ impl Tokenizer { } else if c.is_whitespace() { self.advance(); } else { - self.advance(); - return Err(ScanError { + let result = Err(ScanError { location: self.current_location(1), kind: ScanErrorKind::UnexpectedChar(c), }); + self.advance(); + return result; } } else { return Ok(None);