@@ -13,11 +13,11 @@ role NQPCursorRole {
13
13
method from () { $ ! from }
14
14
method pos () { $ ! pos }
15
15
16
- method MATCH () {
16
+ method CAPHASH () {
17
17
my $ caps := nqp ::hash();
18
18
if $ ! cstack {
19
19
my % caplist := $ ! regexsub . nqpattr(' caps' );
20
- for % caplist {
20
+ for % caplist {
21
21
$ caps {$ _ . key } := nqp ::list() if $ _ . value >= 2 ;
22
22
}
23
23
for $ ! cstack -> $ subcur {
@@ -29,7 +29,7 @@ role NQPCursorRole {
29
29
}
30
30
}
31
31
}
32
- $ ! match := self . MATCHBUILD( $ ! orig , $ ! from , $ ! pos , $ caps ) ;
32
+ $ caps ;
33
33
}
34
34
35
35
method ! cursor_init ($ target , : $ p = 0 , : $ c ) {
@@ -255,21 +255,22 @@ class NQPMatch is NQPCapture {
255
255
}
256
256
257
257
class NQPCursor does NQPCursorRole {
258
- method MATCHBUILD ( $ orig , $ from , $ to , % caps ) {
258
+ method MATCH ( ) {
259
259
my $ match := NQPMatch. new ();
260
- nqp ::bindattr($ match , NQPMatch, ' $!orig' , $ orig );
261
- nqp ::bindattr_i($ match , NQPMatch, ' $!from' , $ from );
262
- nqp ::bindattr_i($ match , NQPMatch, ' $!to' , $ to );
260
+ nqp ::bindattr($ match , NQPMatch, ' $!orig' , nqp ::getattr( self , NQPCursor, ' $! orig' ) );
261
+ nqp ::bindattr_i($ match , NQPMatch, ' $!from' , nqp ::getattr_i( self , NQPCursor, ' $! from' ) );
262
+ nqp ::bindattr_i($ match , NQPMatch, ' $!to' , nqp ::getattr_i( self , NQPCursor, ' $!pos ' ) );
263
263
my $ list := $ match . list;
264
264
my $ hash := $ match . hash;
265
- for % caps {
265
+ for self . CAPHASH {
266
266
my $ key := $ _ . key ;
267
267
nqp ::iscclass(pir::const::CCLASS_NUMERIC, $ key , 0 )
268
268
?? nqp ::bindpos($ list , $ key , $ _ . value )
269
269
!! nqp ::bindkey($ hash , $ key , $ _ . value );
270
270
}
271
271
$ match ;
272
272
}
273
+
273
274
method Bool () is parrot_vtable(' get_bool' ) {
274
275
! nqp ::isnull(nqp ::getattr(self , $ ? CLASS , ' $!match' ))
275
276
&& nqp ::istrue(nqp ::getattr(self , $ ? CLASS , ' $!match' ));
0 commit comments