Support underscore in variable names #6
Closed
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.
Implement a function to grab a rust identifier. This is more proof of concept than ultimate solution.
I tried using macros, but without succeeding. Along the lines of
take_while!(is_identifier_character)
. There might also be solutions using nom's regexps. This solution is more or less lifted from nom's implementation ofalphanumeric
. They probably implemented it in rust for a reason. Not sure if it's for speed or if macros weren't sufficient for them either.Also, implementation aside, this does not actually correctly implement a correct rust identifier parser. That is a lot more complicated:https://doc.rust-lang.org/reference.html#identifiers (which is even disputed)