| 1 | 53 | ▶ | use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | package Lingy::Regex; | ||||||||||
| 3 | |||||||||||
| 4 | 53 | ▶ | use Lingy::Common; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | # need these things: | ||||||||||
| 7 | # * if-some | ||||||||||
| 8 | # * "sequence destructuring bindings" | ||||||||||
| 9 | |||||||||||
| 10 | 15 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 11 | 15 | my ($class, $scalar) = @_; | |||||||||
| 12 | 15 | bless qr/$scalar/, $class; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 7 | ▶ | sub find { | ||||||||
|
Subroutine
find: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 16 | 7 | ▶ | return nil unless $_[1] =~ $_[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 5 | ▶ | return string($&) unless defined $1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 3 | my ($i, @capture) = (1, string($&)); | |||||||||
| 19 | { | ||||||||||
| 20 | 53 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 3 | ▶ | while (defined (my $value = ${"$i"})) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 6 | push @capture, string($value); | |||||||||
| 23 | 6 | $i++; | |||||||||
| 24 | } | ||||||||||
| 25 | } | ||||||||||
| 26 | 3 | VECTOR->new([@capture]); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 4 | ▶ | sub matches { | ||||||||
|
Subroutine
matches: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 30 | 4 | find REGEX->new("\\A$_[0]\\z"), $_[1]; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 1 | ▶ | sub pattern { | ||||||||
|
Subroutine
pattern: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 34 | 1 | __PACKAGE__->new(@_); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 53 | 1; | |||||||||