Rust single

durch  |  22-Apr-2017 00:00

We call such extensions "macros by example" or simply "macros".

Currently, macros can expand to expressions, statements, items, or patterns.

Two examples of simple paths consisting of only identifier components: A number of minor features of Rust are not central enough to have their own syntax, and yet are not implementable as functions.

Instead, they are given names, and invoked through a consistent syntax: allows users to define syntax extension in a declarative way.

(A .) The macro expander looks up macro invocations by name, and tries each macro rule in turn. Matching and transcription are closely related to each other, and we will describe them together.

The macro expander matches and transcribes every token that does not begin with a In the transcriber, the designator is already known, and so only the name of a matched nonterminal comes after the dollar sign.

The job of the transcriber is to sort that structure out.

Forum-Mitarbeiter anzeigen