Skip to content
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

Ability to map subspans of a LitStr into subspans of the backing Literal #1219

Open
Nemo157 opened this issue Sep 20, 2022 · 0 comments
Open

Comments

@Nemo157
Copy link

Nemo157 commented Sep 20, 2022

In order to create accurate subspans into a LitStr there needs to be some way to map offsets from the string value into offsets of the Literal. As an example for the literal r#"\x7Ba}" the string value is {a}, the a character has the range 1..2 which has to be mapped to 7..8, or the { character has the range 0..1 which has to be mapped to 3..7.

#621 is tangentially related, but that only applies if the literal is parsed through syn::Parse. If instead the string value is being parsed via another parser that is able to give back subranges those need to be manually mapped somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant