vickenty / lang-c

Lightweight C parser for Rust
Apache License 2.0
202 stars 30 forks source link

Incorrect span in large file #32

Closed mahkoh closed 2 years ago

mahkoh commented 3 years ago

https://gist.githubusercontent.com/mahkoh/ecda9bec5acf0aaf4d1a51b559240c9d/raw/0819fa073244cf6b35b6afcccb8ee1917bcb163d/include.c

This file does not parse and the parser says that the error is in line 45695. But this line is unrelated. The error is in line 45772.

vickenty commented 3 years ago

If you use dump to parse the file, it runs cppon the input file first. So the reported line numbers are referring to the pre-processed input, not the original file, which explains the difference.

An option to skip pre-processor in dump would help with this.