Skip to content

Commit 82da67a

Browse files
committed
Corrected relationship of macro and rust parsers
1 parent dee42c1 commit 82da67a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/macro-expansion.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
Macro expansion happens during parsing. `rustc` has two parsers, in fact: the
44
normal Rust parser, and the macro parser. During the parsing phase, the normal
5-
Rust parser will call into the macro parser when it encounters a macro
6-
definition or macro invocation (TODO: verify). The macro parser, in turn, may
7-
call back out to the Rust parser when it needs to bind a metavariable (e.g.
8-
`$my_expr`) while parsing the contents of a macro invocation. The code for macro
9-
expansion is in [`src/libsyntax/ext/tt/`][code_dir]. This chapter aims to
10-
explain how macro expansion works.
5+
Rust parser will set aside the contents of macros and their invokations. Later,
6+
before name resolution, macros are expanded using these portions of the code.
7+
The macro parser, in turn, may call the normal Rust parser when it needs to
8+
bind a metavariable (e.g. `$my_expr`) while parsing the contents of a macro
9+
invocation. The code for macro expansion is in
10+
[`src/libsyntax/ext/tt/`][code_dir]. This chapter aims to explain how macro
11+
expansion works.
1112

1213
### Example
1314

0 commit comments

Comments
 (0)