-
-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overlapping token spans #1266
Comments
Looking more closely, my best guess is that it's parsing I couldn't quite figure out the boundaries in Is it possible to turn this off? Anyways, it seems like, since these are overlapping spans for a single synthetic element, it would be safe (as in, no panic) to just ignore line/cols that go backwards. |
I ended up needing the original comments anyways so I basically
|
Glad that you figured it out! |
Sorry if it wasn't explicit above, but there were three asks here:
There was also a meta-ask about clarifying this project's stance on verbatim vs abstract parsing (i.e. on principal will it discard source information to normalize it, or will it try to preserve source information but end up with semantically identical source trees having different representations: final commas, doc comments, etc). Does this library have a principaled stance on this, or is it ad hoc? I'm happy to create separate issues for these if that would help. |
|
I was using code derived from the comment extraction snippet you left in another issue (not sure where now), and ended up with a panic since tokens from a token stream produced out of order token span bounds. FWIW there's other confusing bits about the output, so there might be something else going on here (like
#
tokens in the stream that don't appear in the source code).I used this script to check for out of order line/columns in in this source file.
It basically checks if for any 2 consecutive line/columns, the former comes after the latter.
It fails on
bin/lib.rs
:which is this section of the code
(first line is 368)
So I guess
Worst case, I could probably just ignore anything out of order. As long as it isn't the end of a non-whitespace text section it shouldn't cause fatal problems, maybe just losing some comments...
The text was updated successfully, but these errors were encountered: