Fix how negative literals are handled to be in line with Rust #132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Literals are resolved internally to
num::BigInt
, so they have no size limitation at compile time. Only at the point that they are treated as something, like a tuple index (usize) or a literal number (i64).This fixes parsing so that it is in line with Rust. This has been an outstanding issue with the
quote!
macro, in that-10
would be treated as- 10
(note the space), which wouldn't parse. Now it does parse.This has the nice side effect that the
rune!
macro can mostly just consume a token stream from Rust now, since Rune mostly accepts the same stringified tokens as Rust. So many test cases now look like this:Note: this currently "cheats" by calling
stringify!
, but could just as well usequote!
internally.The exception is the ones dealing with string templates, since they are whitespace sensitive and have no corollary in Rust. For these we maintain the
rune_s!
test macro that works likerune!
did before:This also changes a bunch of the plumbing for
ast::Pat
, since these used to rely on literals parsing in a different manner. Of note is that they also parse attributes now.