… | |
… | |
263 | my $text = $line->t; |
263 | my $text = $line->t; |
264 | |
264 | |
265 | my @matches; |
265 | my @matches; |
266 | for my $matcher (@{$self->{matchers}}) { |
266 | for my $matcher (@{$self->{matchers}}) { |
267 | my $launcher = $matcher->[1] || $self->{launcher}; |
267 | my $launcher = $matcher->[1] || $self->{launcher}; |
268 | while (($text =~ /$matcher->[0]/g)) { |
268 | while ($text =~ /$matcher->[0]/g) { |
269 | my $match = substr $text, $-[0], $+[0] - $-[0]; |
269 | my $match = substr $text, $-[0], $+[0] - $-[0]; |
270 | my @begin = @-; |
270 | my @begin = @-; |
271 | my @end = @+; |
271 | my @end = @+; |
272 | my @exec; |
272 | my @exec; |
273 | |
273 | |
… | |
… | |
276 | @exec = ($launcher, $match); |
276 | @exec = ($launcher, $match); |
277 | } else { |
277 | } else { |
278 | # It'd be nice to just access a list like ($&,$1,$2...), |
278 | # It'd be nice to just access a list like ($&,$1,$2...), |
279 | # but alas, m//g behaves differently in list context. |
279 | # but alas, m//g behaves differently in list context. |
280 | @exec = map { s/\$(\d+)|\$\{(\d+)\}/ |
280 | @exec = map { s/\$(\d+)|\$\{(\d+)\}/ |
281 | substr($text,$begin[$1||$2],$end[$1||$2]-$begin[$1||$2]) |
281 | substr $text, $begin[$1 || $2], $end[$1 || $2] - $begin[$1 || $2]) |
282 | /egx; $_ } split(/\s+/, $launcher); |
282 | /egx; $_ } split /\s+/, $launcher; |
283 | } |
283 | } |
284 | |
284 | |
285 | push @matches, [ $begin[0], $match, @exec ]; |
285 | push @matches, [ $begin[0], $match, @exec ]; |
286 | } |
286 | } |
287 | } |
287 | } |