Closed brockelmore closed 1 year ago
I use a parser which reports code locations as byte spans instead of char spans. It would be nice if via config we could specify byte offsets instead of char offsets.
One way would be in this line:
https://github.com/zesterer/ariadne/blob/ccd465160129d2546d67f7ee78727a4098a64330/src/source.rs#L94
to switch to:
let len = line.chars().fold(0, |mut acc, i| {acc += i.len_utf8(); acc });
based on the configuration. Of note, this actually fixes some of the spacing issues like in #41 if the location producer also uses bytes.
This will probably happen at some point, when I have more time to work on the crate. See #8.
Oh sorry I tried to find an issue for this but missed this! Thanks, will close this one.
I use a parser which reports code locations as byte spans instead of char spans. It would be nice if via config we could specify byte offsets instead of char offsets.
One way would be in this line:
https://github.com/zesterer/ariadne/blob/ccd465160129d2546d67f7ee78727a4098a64330/src/source.rs#L94
to switch to:
based on the configuration. Of note, this actually fixes some of the spacing issues like in #41 if the location producer also uses bytes.