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

Support non-number suffixes #2

Closed
LukasKalbertodt opened this issue May 24, 2021 · 2 comments · Fixed by #10
Closed

Support non-number suffixes #2

LukasKalbertodt opened this issue May 24, 2021 · 2 comments · Fixed by #10

Comments

@LukasKalbertodt
Copy link
Owner

I randomly stumbled upon this section of the reference talking about how all literal tokens can have suffixes, not only number literals. I wasn't aware of that at all. Rust errors if such a token ever ends up in actual Rust code, but they are valid as input to proc macros.

This library should support those.

@wycats
Copy link

wycats commented Oct 4, 2021

I second this. And further, I think that litrs should aspire to this invariant: every valid proc_macro2::Literal that parses from source should validly parse into a litrs::Literal.

@LukasKalbertodt
Copy link
Owner Author

Yes, in principle I want litrs to exactly accept what the Rust compiler accepts. I don't want any grammar difference. However, (a) proc_macro2 is an external crate so there can be differences to the compiler, and (b) the actual Rust token grammar is not as fixed and perfect as one hopes. For example, see this PR I once created. There are a couple of these case that you only notice when you really get into the details.

Anyway, non-number suffixes I certainly want. I personally did not need them yet and haven't found the time to implement it here, but it will happen eventually. If you need that now and wanna send a PR, that'd be welcome as well ;-)

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

Successfully merging a pull request may close this issue.

2 participants