diff --git a/src/macros_1.0/repetitions.md b/src/macros_1.0/repetitions.md index dd8d6a6..d062804 100644 --- a/src/macros_1.0/repetitions.md +++ b/src/macros_1.0/repetitions.md @@ -1,6 +1,6 @@ # Repetitions -We use `$()[delimiter]<*|?|+>` to specify metavariable repetition in both the pattern (matcher) and the expansion (transcriber). +We use `$()[delimiter]<*|?|+>` to specify metavariable repetition in both the pattern (matcher) and the expansion (transcriber). - `*`: Zero or more times - `?`: Zero or one time diff --git a/src/procedural_macros/proc_macro_crates.md b/src/procedural_macros/proc_macro_crates.md index f0a11cd..b0be70a 100644 --- a/src/procedural_macros/proc_macro_crates.md +++ b/src/procedural_macros/proc_macro_crates.md @@ -59,7 +59,7 @@ fn main() { The `input` contains the tokens enclosed by whatever delimiters (parentheses `()`, brackets `[]`, or braces `{}`) are used when calling the macro. In the example above, the input is `world`. Upon expansion, the call `hello_macro!(world)` is replaced entirely by the macro's `output`. ### The `parse_macro_input!` Macro -The `parse_macro_input!` macro parses the input `TokenStream` into a specific `syn` syntax tree node. If parsing fails, it automatically generates a high-quality compile-time error. +The `parse_macro_input!` macro parses the input `TokenStream` into a specific `syn` syntax tree node (including custom syntax tree nodes). If parsing fails, it automatically generates a high-quality compile-time error. The basic syntax is `parse_macro_input!( as )`. This convenience macro is specifically designed for use within `proc-macro` crates. diff --git a/src/procedural_macros/syntax_tree.md b/src/procedural_macros/syntax_tree.md index 96040cc..b3b7b13 100644 --- a/src/procedural_macros/syntax_tree.md +++ b/src/procedural_macros/syntax_tree.md @@ -2,7 +2,7 @@ A syntax tree is a hierarchical representation of source code. It transforms a flat, linear stream of tokens into a structured format that is easy to process and manipulate. The `syn` crate provides a complete syntax tree that can represent any valid Rust source code. We can use `syn` to define our own syntax trees; for example, we can define a syntax tree for HTML, CSS, or any other DSL. -A syntax tree is made up of syntax tree nodes. A syntax tree node can be a token, a group of tokens, or a value of a type that implements the `syn::parse::Parse` trait. +A syntax tree is made up of syntax tree nodes. A syntax tree node can be a token, a group of tokens, or any type that implements the `syn::parse::Parse` trait. ## See a Syntax Tree Node in Action