@@ -120,12 +120,27 @@ Returns the payload that was set with L<C<make>|/routine/make>.
120
120
121
121
Defined as
122
122
123
- method make(Match:D: Mu $ast)
123
+ method make(Match:D: Mu $payload)
124
+ sub make(Mu $payload)
124
125
125
- Sets the C < .ast > attribute, also known as C < .made > .
126
+ Sets the C < .ast > attribute, which will be retrieved using C < .made > .
126
127
127
128
$/.make("your payload here");
128
129
130
+ That is, it stores an arbitrary payload into the C < Match > object that can later
131
+ be retrieved via L « C < .made > |/routine/made» method.
132
+
133
+ This is typically used in a L < grammar|/language/grammars > 's actions class
134
+ methods, where a piece of data is stored by one method and then later retrieved
135
+ by another. It's up to you what data you store. It could be a tree node, L < result
136
+ of a calculation|/language/grammars#Protoregexes > , or a list of values.
137
+
138
+ The sub form operates on the current Match C < $/ > , which can be a convenient shortcut:
139
+
140
+ method my-action ($/) {
141
+ make "foo: $/";
142
+ }
143
+
129
144
= head2 method actions
130
145
131
146
method actions(Match:D: --> Mu)
@@ -226,26 +241,6 @@ Returns the part of the original string following the match.
226
241
"abc123def" ~~ m:g/\d/;
227
242
say $/.[1].postmatch; # OUTPUT: «3def»
228
243
229
- = head2 method make
230
-
231
- method make(Match:D: Mu $payload)
232
- sub make(Mu $payload)
233
-
234
- Stores an arbitrary payload into the C < Match > object that can later be retrieved
235
- via L « C < .made > |/routine/made» method.
236
-
237
- This is typically used in a L < grammar|/language/grammars > 's actions class
238
- methods, where a piece of data is stored by one method and then later retrieved
239
- by another. It's up to you what data you store. It could be a tree node, L < result
240
- of a calculation|/language/grammars#Protoregexes > , or a list of values.
241
-
242
- The sub form operates on the current C < $/ > , which can be a convenient shortcut:
243
-
244
- method my-action ($/) {
245
- make "foo: $/";
246
- }
247
-
248
-
249
244
= head2 method infix:<eqv>
250
245
251
246
Defined as:
0 commit comments