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