From d328e1f4fbb8ae13b675d5430ed18504be83ca17 Mon Sep 17 00:00:00 2001 From: Marcythm Date: Thu, 1 Apr 2021 18:47:27 +0800 Subject: [PATCH 1/2] fix typo in macros-by-example.md complete the missing parenthesis and move the parenthesis out of the code block into it. --- src/macros-by-example.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macros-by-example.md b/src/macros-by-example.md index e97455d0b..1f7c8b8fa 100644 --- a/src/macros-by-example.md +++ b/src/macros-by-example.md @@ -174,9 +174,9 @@ compiler knows how to expand them properly: 2. Each repetition in the transcriber must contain at least one metavariable to decide how many times to expand it. If multiple metavariables appear in the same repetition, they must be bound to the same number of fragments. For - instance, `( $( $i:ident ),* ; $( $j:ident ),* ) =>( $( ($i,$j) ),*` must + instance, `( $( $i:ident ),* ; $( $j:ident ),* ) => ( $( ($i,$j) ),* )` must bind the same number of `$i` fragments as `$j` fragments. This means that - invoking the macro with `(a, b, c; d, e, f`) is legal and expands to + invoking the macro with `(a, b, c; d, e, f)` is legal and expands to `((a,d), (b,e), (c,f))`, but `(a, b, c; d, e)` is illegal because it does not have the same number. This requirement applies to every layer of nested repetitions. From 161b6338db6c1ef7cbf64be0638a674609d3bbb4 Mon Sep 17 00:00:00 2001 From: Marcythm Date: Thu, 1 Apr 2021 19:05:10 +0800 Subject: [PATCH 2/2] Add a pair of parentheses as delimiter --- src/macros-by-example.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/macros-by-example.md b/src/macros-by-example.md index 1f7c8b8fa..fb07222b7 100644 --- a/src/macros-by-example.md +++ b/src/macros-by-example.md @@ -174,7 +174,7 @@ compiler knows how to expand them properly: 2. Each repetition in the transcriber must contain at least one metavariable to decide how many times to expand it. If multiple metavariables appear in the same repetition, they must be bound to the same number of fragments. For - instance, `( $( $i:ident ),* ; $( $j:ident ),* ) => ( $( ($i,$j) ),* )` must + instance, `( $( $i:ident ),* ; $( $j:ident ),* ) => (( $( ($i,$j) ),* ))` must bind the same number of `$i` fragments as `$j` fragments. This means that invoking the macro with `(a, b, c; d, e, f)` is legal and expands to `((a,d), (b,e), (c,f))`, but `(a, b, c; d, e)` is illegal because it does