Corrected relationship of macro and rust parsers
This commit is contained in:
parent
41a4f43684
commit
68e84c734d
|
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
Macro expansion happens during parsing. `rustc` has two parsers, in fact: the
|
Macro expansion happens during parsing. `rustc` has two parsers, in fact: the
|
||||||
normal Rust parser, and the macro parser. During the parsing phase, the normal
|
normal Rust parser, and the macro parser. During the parsing phase, the normal
|
||||||
Rust parser will call into the macro parser when it encounters a macro
|
Rust parser will set aside the contents of macros and their invokations. Later,
|
||||||
definition or macro invocation (TODO: verify). The macro parser, in turn, may
|
before name resolution, macros are expanded using these portions of the code.
|
||||||
call back out to the Rust parser when it needs to bind a metavariable (e.g.
|
The macro parser, in turn, may call the normal Rust parser when it needs to
|
||||||
`$my_expr`) while parsing the contents of a macro invocation. The code for macro
|
bind a metavariable (e.g. `$my_expr`) while parsing the contents of a macro
|
||||||
expansion is in [`src/libsyntax/ext/tt/`][code_dir]. This chapter aims to
|
invocation. The code for macro expansion is in
|
||||||
explain how macro expansion works.
|
[`src/libsyntax/ext/tt/`][code_dir]. This chapter aims to explain how macro
|
||||||
|
expansion works.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue