Skip to content

Commit

Permalink
Add byte a offset to the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
jturner314 authored and Ethiraric committed Mar 19, 2024
1 parent bd931e1 commit 9a1fc25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ impl fmt::Display for ScanError {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(
formatter,
"{} at line {} column {}",
"{} at byte {} line {} column {}",
self.info,
self.mark.index,
self.mark.line,
self.mark.col + 1
self.mark.col + 1,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ key1:a2
);
assert_eq!(
error.to_string(),
"mapping values are not allowed in this context at line 4 column 4"
"mapping values are not allowed in this context at byte 26 line 4 column 4"
);
}

Expand Down

0 comments on commit 9a1fc25

Please sign in to comment.