Closed HKalbasi closed 10 months ago
Sorry for the late reply.
I don't think there is a way to extract original byte positions of tokens - the external preprocessor only provides line numbers. There is a way to map spans to filename and line number though, see https://docs.rs/lang-c/latest/lang_c/loc/fn.get_location_for_offset.html
Is it possible to convert an
Span
of this library to a(Filename, Span)
in the original files in the disk? I'm trying to show some info about the C code using ariadne crate, and I'm currently using the pre-processed text using thesource
field ofParse
, but I would like to do that conversion to make the spans show correct line number and file names.