A question about macro parsing


Why is self.parse_path(NoTypesAllowed) used to parse macro invocations? Each it is preceded by self.look_ahead(1, |t| *t == token::Not), effectivelly enforcing than it is a plain ident.

Iā€™m trying to understand what different kinds of paths are used for, and it is a bit confusing :smile:

One more thing adds to confusion: only two variants of PathParsingMode are actually used for parse_qualified_path, and (modulo parsing idents as macros) only two other variants are used for parse_path.



I probably wrote that, but my memories are vague. I suspect that my thinking was that, in the future, it would be nice to be able to invoke macros like path::to::my::macro!(), but I needed some way to enforce that, for now, macro invocations were just a single identifier. That may not be a good justification for the code being the way it is!


closed #3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.