error: local ambiguity: multiple parsing options: built-in NTs ident ('slot') or 1 other options.
As keywords cannot be used in place of identifiers, would it make sense to fix the matcher? This would allow more useful repeating syntaxes in macros, without a need to put parentheses or other cludges around places where identifiers are expected.
The input to a macro is lexical (tokens) and keywords are not part of
Rust’s lexical syntax. This is for simplicity and consistency: syntax
extensions don’t need to handle keywords (which may not be special in their
own syntax) differently. I think you might be right that matchers ought to
be Rust-keyword-sensitive. I’ll think about it, it would be complex to
implement.
I’d prefer the matcher system to be more cleverer. I mean, if you’re got a repeat followed by something, it should be smart enough to say “well, both match, but then I’d never be able to terminate, so I’ll stop repeating”.
Heck, just a nicer way of stopping repetitions. I have to admit I went the lazy route with the scan*! macros, and just added negative lookahead assertions to the syntax. A little ugly, but works just fine.