summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lexer.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lexer.rs b/src/lexer.rs
index f141f81..e8ef2ac 100644
--- a/src/lexer.rs
+++ b/src/lexer.rs
@@ -55,7 +55,7 @@ pub enum Tok {
#[derive(Debug)]
pub enum LexicalError {
- Error(nom::simple_errors::Err<u32>),
+ Error(usize, nom::simple_errors::Err<u32>),
Incomplete(nom::Needed),
}
@@ -210,8 +210,9 @@ impl<'input> Iterator for Lexer<'input> {
Some(Ok((start, t, self.offset)))
}
Error(e) => {
+ let offset = self.offset;
self.offset = self.input.len();
- Some(Err(LexicalError::Error(e)))
+ Some(Err(LexicalError::Error(offset, e)))
}
Incomplete(needed) => {
Some(Err(LexicalError::Incomplete(needed)))