Closed johshoff closed 7 years ago
Pertaining to issue #3
syn is a crate that implements parsing of rust code with nom. If we would be able to reuse the identifier parser from syn, that would be perfect. A cursory look seems to indicate that they do not publicly export the identifier nom parser, but they do export one with a slightly different interface: parse_ident.
In the meantime, I might merge this just to get support for underscore.
I have fixed the travis config. I think you need to rebase on top of master for the inline travis check to pass.
I fixed this by completely rewriting the parser, incidentally using syn to verify the identifier names
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)