Skip to content

Commit abfc9f2

Browse files
committed
clarify that count, index and length expand to integer literals
1 parent 6ad0b1d commit abfc9f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

text/0000-macro-metavar-expr.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ expansion like:
105105
${count(x)} $( $x )*
106106
```
107107

108-
the expression `${count(x)}` will expand to the number of times the `$( $x )*`
109-
repetition will repeat.
108+
the expression `${count(x)}` will expand to an integer literal equal to the
109+
number of times the `$( $x )*` repetition will repeat. For example, if
110+
the metavariable `$x` repeats four times then it will expand to the integer
111+
literal `4`.
110112

111113
If repetitions are nested, then an optional depth parameter can be used to
112114
limit the number of nested repetitions that are counted. For example, a macro
@@ -126,7 +128,7 @@ of repetitions of `$x`.
126128
Within a repetition, the `${index()}` and `${length()}` metavariable
127129
expressions give the index of the current repetition and the length of the
128130
repetition (i.e., the number of times it will repeat). The index value ranges
129-
from `0` to `length - 1`.
131+
from `0` to `length - 1`, and the expanded values are integer literals.
130132

131133
For nested repetitions, the `${index()}` and `${length()}` metavariable
132134
expressions expand to the inner-most index and length respectively.

0 commit comments

Comments
 (0)