| 1 | package YAPE::Regex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use YAPE::Regex::Element; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Text::Balanced 'extract_codeblock'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | $VERSION = '4.00'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | my $valid_POSIX = qr{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | alpha | alnum | ascii | cntrl | digit | graph | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | lower | print | punct | space | upper | word | xdigit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | }x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | my $ok_cc_REx = qr{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | \\([0-3][0-7]{2}) | # octal escapes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | \\x([a-fA-F0-9]{2}|\{[a-fA-F0-9]+\}) | # hex escapes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | \\c(.) | # control characters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | \\([nrftbae]) | # known \X sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | \\N\{([^\}]+)\} | # named characters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | (\\[wWdDsS]) | # regex macros | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | \\[Pp]([A-Za-z]|\{[a-zA-Z]+\}) | # utf8 macros | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | \[:\^?([a-zA-Z]+):\] | # POSIX macros | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | \\?(.) # anything else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | }xs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | my %pat = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | Pcomment => qr{ \( \? \# ( [^)]* ) \) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | Xcomment => qr{ \# [^\S\n]* ( .* \n ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | Pflags => qr{ \( \? ([isxm]*)-?([ismx]*) \) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | Pahead => qr{ \( \? ( [=!] ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | Pbehind => qr{ \( \? < ( [=!] ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | Pcond => qr{ \( \? (?: \( (\d+) \) | (?= \( \? (?: <? [=!] | \?? \{ ) ) ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | Pcut => qr{ \( \? > }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | Pgroup => qr{ \( \? ([isxm]*)-?([ismx]*) : }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | Pcapture => qr{ \( (?! \? ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | Pcode => qr{ \( \? (?= \{ ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | Plater => qr{ \( \? \? (?= \{ ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | Pclose => qr{ \) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | quant => qr{ ( (?: [+*?] | \{ \d+ ,? \d* \} ) ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ngreed => qr{ ( \? ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | anchor => qr{ ( \\ [ABbGZz] | [\^\$] ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | macro => qr{ \\ ( [dDwWsS] ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | oct => qr{ \\ ( [0-3] [0-7] [0-7] ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | hex => qr{ \\ x ( [a-fA-F0-9]{2} ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | utf8hex => qr{ \\ x \{ ( [a-fA-F0-9]+ ) \} }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | backref => qr{ \\ ( [1-9] \d* ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ctrl => qr{ \\ c ( . ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | named => qr{ \\ N \{ ( [^\}]+ ) \} }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | Cchar => qr{ \\ C }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | slash => qr{ \\ ( . ) }xs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | any => qr{ \. }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | class => qr{ \\ ([Pp]) ( [A-Za-z] | \{ [a-zA-Z]+ \} ) | \[ ( \^? ) ( \]? [^][\\]* (?: (?: \[:\w+:\] | \[ (?!:) | \\. ) [^][\\]* )* ) \] }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | nws => qr{ ( (?: [^\s^\$|\\+*?()\[.\{]+ | \{ (?! \d+ ,? \d* \} ) )+ ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | reg => qr{ ( (?: [^^\$|\\+*?()\[.\{] | \{ (?! \d+ ,? \d* \} ) )+ ) }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | alt => qr{ \| }x, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=7 SCAR=23.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | my @obj = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | anchor macro oct hex utf8hex backref ctrl named Cchar slash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | any class text alt comment whitespace flags lookahead lookbehind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | conditional group capture code later close cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | for my $class ('YAPE::Regex', @_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | (my $file = $class . ".pm") =~ s!::!/!g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | ▶ | require $file and $class->import if not $INC{$file}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$INC{$file} || require $file && $class->import
require $file and $class->import
MC/DC0%0/3
$INC{$file} || require $file && $class->import
$INC{$file}
require $file
$class->import
Truth table0%0/4
A || B and C
A= $INC{$file}B= require $fileC= $class->import
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | ▶ | if ($class ne 'YAPE::Regex') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | push @{"${class}::ISA"}, 'YAPE::Regex'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | push @{"${class}::${_}::ISA"}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | "YAPE::Regex::$_", "${class}::Element" for @obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | push @{"${class}::${_}::ISA"}, 'YAPE::Regex::Element' for @obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 12 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=25.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 12 | my ($class, $regex) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 12 | ▶ | croak "no regex given to $class->new" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $regex or length $regex == 0
MC/DC0%0/2
not defined $regex or length $regex == 0
not defined $regex
length $regex == 0
Truth table33%1/3
not(A) or B
A= not defined $regexB= length $regex == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | if not defined $regex or length($regex) == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 12 | ▶ | eval { local $^W; $regex = qr/$regex/ } if ref($regex) ne 'Regexp'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 12 | ▶ | $regex = "(?-imsx:$regex)" if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # Make the qr stringification introduced in 5.13.6 look like the old | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # qr stringification. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 12 | ▶ | if ($regex =~ / ^ \( \? \^ ([imsx]+) (: .*) $ /x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $switches = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $rest = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $inverted = invert($switches); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | if (length $inverted) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $regex = "(?$switches-$inverted$rest"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $regex = "(?imsx$rest"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | elsif ($regex =~ / ^ \( \? \^ : /x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 9 | $regex =~ s/\^/-imsx/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 12 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | TREE => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | TREE_STACK => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | CAPTURE => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | CONTENT => "$regex", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | DEPTH => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 12 | $self->{CURRENT} = $self->{TREE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 12 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub invert { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
invert: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # Given an input string which looks like modifiers (ismx), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # return the inverse string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # For example, if the input is 'ix', return 'ms'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my %mods = map { $_ => 1 } qw(i m s x); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | delete $mods{$_} for (split //, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return join '', keys %mods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub state { $_[0]{STATE} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
state: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | ▶ | sub error { $_[0]{ERROR} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub depth { $_[0]{DEPTH} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
depth: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | ▶ | sub chunk { substr $_[0]{CONTENT}, 0, $_[1] || 30 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chunk: called CC=2 SCAR=7.6
Pod
documented
Condition50%1/2
$_[1] || 30
MC/DC0%0/1
$_[1] || 30
$_[1]
Truth table50%1/2
A
A= $_[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 10 | ▶ | sub done { $_[0]{STATE} eq 'done' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
done: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub root { $_[0]{TREE}[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
root: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub top { $_[0]{TREE}[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
top: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 12 | ▶ | sub parse { 1 while $_[0]->next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 10 | ▶ | sub display { $_[0]->parse; $_[0]{TREE}[0]->fullstring if $_[0]->done; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
display: called CC=2 SCAR=7.2
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 111 | ▶ | sub next { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: called CC=95 SCAR=69.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 111 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 111 | ▶ | $self->{STATE} = 'done', return unless length $self->{CONTENT}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 101 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^(\s+)//
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
MC/DC0%0/3
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^(\s+)//
@{$self->{"TREE_STACK"};}
$self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
$self->{"CONTENT"} =~ s/^(\s+)//
Truth table50%2/4
A and B and C
A= @{$self->{"TREE_STACK"};}B= $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}C= $self->{"CONTENT"} =~ s/^(\s+)//
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 101 | @{$self->{TREE_STACK}} and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | $self->{TREE_STACK}[-1]{MODE}{x} and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | $self->{CONTENT} =~ s/^(\s+)// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my $node = (ref($self) . "::whitespace")->new($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 101 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Pcomment}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my $node = (ref($self) . "::comment")->new($1,0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $self->{STATE} = 'comment'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 101 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^$pat{"Xcomment"}//
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
MC/DC0%0/3
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^$pat{"Xcomment"}//
@{$self->{"TREE_STACK"};}
$self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
$self->{"CONTENT"} =~ s/^$pat{"Xcomment"}//
Truth table50%2/4
A and B and C
A= @{$self->{"TREE_STACK"};}B= $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}C= $self->{"CONTENT"} =~ s/^$pat{"Xcomment"}//
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 101 | @{ $self->{TREE_STACK} } and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | $self->{TREE_STACK}[-1]{MODE}{x} and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | $self->{CONTENT} =~ s/^$pat{Xcomment}// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my $node = (ref($self) . "::comment")->new($1,1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $self->{STATE} = 'comment'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 101 | ▶ | if ($self->{CONTENT} =~ s/^$pat{anchor}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $node = (ref($self) . "::anchor")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $self->{STATE} = 'anchor'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 101 | ▶ | if ($self->{CONTENT} =~ s/^$pat{macro}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my $node = (ref($self) . "::macro")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $self->{STATE} = 'macro'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 101 | ▶ | if ($self->{CONTENT} =~ s/^$pat{oct}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my $node = (ref($self) . "::oct")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $self->{STATE} = 'oct'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 101 | ▶ | if ($self->{CONTENT} =~ s/^$pat{hex}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 1 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 1 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 1 | my $node = (ref($self) . "::hex")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 1 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 1 | $self->{STATE} = 'hex'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 1 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 100 | ▶ | if ($self->{CONTENT} =~ s/^$pat{utf8hex}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my $node = (ref($self) . "::utf8hex")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $self->{STATE} = 'utf8hex'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 100 | ▶ | if ($self->{CONTENT} =~ s/^$pat{backref}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | my $node = (ref($self) . "::backref")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | # this code is special for YAPE::Regex::Reverse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 1 | ▶ | if ($self->isa('YAPE::Regex::Reverse')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | if ($quant eq '*' or $quant eq '+') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$quant eq "*" or $quant eq "+"
MC/DC0%0/2
$quant eq "*" or $quant eq "+"
$quant eq "*"
$quant eq "+"
Truth table0%0/3
A or B
A= $quant eq "*"B= $quant eq "+"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $node = (ref($self) . "::group")->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | $node->{NGREED} = '?' if $quant eq '*'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | $node->{CONTENT} = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | (ref($self) . "::backref")->new($match,'*'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | (ref($self) . "::backref")->new($match), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | ▶ | elsif ($quant and $quant ne '?') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$quant and $quant ne "?"
MC/DC0%0/2
$quant and $quant ne "?"
$quant
$quant ne "?"
Truth table0%0/3
A and B
A= $quantB= $quant ne "?"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my ($l,$u) = $quant =~ /(\d+),(\d*)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $node = (ref($self) . "::group")->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | $node->{NGREED} = '?' if not $l; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | $l-- if $l; $u-- if $u; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | $node->{CONTENT} = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | (ref($self) . "::backref")->new($match,"{$l,$u}"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | (ref($self) . "::backref")->new($match), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | $self->{STATE} = 'backref'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 1 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 99 | ▶ | if ($self->{CONTENT} =~ s/^$pat{ctrl}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my $node = (ref($self) . "::ctrl")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $self->{STATE} = 'ctrl'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 99 | ▶ | if ($self->{CONTENT} =~ s/^$pat{named}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | my $node = (ref($self) . "::named")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $self->{STATE} = 'named'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 99 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Cchar}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $node = (ref($self) . "::Cchar")->new($quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $self->{STATE} = 'Cchar'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 99 | ▶ | if ($self->{CONTENT} =~ s/^$pat{class}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 6 | ▶ | my ($neg,$match) = defined($1) ? ($1,$2) : ($3,$4); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 6 | ▶ | $match =~ tr/{}//d if defined $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 6 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 6 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 6 | ▶ | return unless $self->_ok_class($match); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 6 | my $node = (ref($self) . "::class")->new($match,$neg,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 6 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 6 | $self->{STATE} = 'class'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 6 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 93 | ▶ | if ($self->{CONTENT} =~ s/^$pat{slash}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my $node = (ref($self) . "::slash")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $self->{STATE} = 'slash'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 93 | ▶ | if ($self->{CONTENT} =~ s/^$pat{any}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my $node = (ref($self) . "::any")->new($quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $self->{STATE} = 'any'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 93 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^$pat{"nws"}//
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
MC/DC0%0/3
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^$pat{"nws"}//
@{$self->{"TREE_STACK"};}
$self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
$self->{"CONTENT"} =~ s/^$pat{"nws"}//
Truth table50%2/4
A and B and C
A= @{$self->{"TREE_STACK"};}B= $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}C= $self->{"CONTENT"} =~ s/^$pat{"nws"}//
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 93 | @{ $self->{TREE_STACK} } and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | $self->{TREE_STACK}[-1]{MODE}{x} and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | $self->{CONTENT} =~ s/^$pat{nws}// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | if (length($match) > 1 and $self->{CONTENT} =~ /^(?:$pat{Pcomment}|$pat{Xcomment}|\s+)*$pat{quant}/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
length $match > 1 and $self->{"CONTENT"} =~ /^(?:$pat{"Pcomment"}|$pat{"Xcomment"}|\s+)*$pat{"quant"}/
MC/DC0%0/2
length $match > 1 and $self->{"CONTENT"} =~ /^(?:$pat{"Pcomment"}|$pat{"Xcomment"}|\s+)*$pat{"quant"}/
length $match > 1
$self->{"CONTENT"} =~ /^(?:$pat{"Pcomment"}|$pat{"Xcomment"}|\s+)*$pat{"quant"}/
Truth table0%0/3
A and B
A= length $match > 1B= $self->{"CONTENT"} =~ /^(?:$pat{"Pcomment"}|$pat{"Xcomment"}|\s+)*$pat{"quant"}/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $self->{CONTENT} = chop($match) . $self->{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $node = (ref($self) . "::text")->new($match,"",""); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | $node = (ref($self) . "::text")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $self->{STATE} = 'text'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 93 | ▶ | if ($self->{CONTENT} =~ s/^$pat{reg}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 26 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 26 | my $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 26 | ▶ | if (length($match) > 1 and $self->{CONTENT} =~ /^$pat{quant}/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
length $match > 1 and $self->{"CONTENT"} =~ /^$pat{"quant"}/
MC/DC0%0/2
length $match > 1 and $self->{"CONTENT"} =~ /^$pat{"quant"}/
length $match > 1
$self->{"CONTENT"} =~ /^$pat{"quant"}/
Truth table66%2/3
A and B
A= length $match > 1B= $self->{"CONTENT"} =~ /^$pat{"quant"}/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $self->{CONTENT} = chop($match) . $self->{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $node = (ref($self) . "::text")->new($match,"",""); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 26 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 26 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 25 | $node = (ref($self) . "::text")->new($match,$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 25 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 25 | $self->{STATE} = 'text'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 25 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 67 | ▶ | if ($self->{CONTENT} =~ s/^$pat{alt}//) {{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 4 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]->type eq "cond" and $self->{"TREE_STACK"}[-1]{"OPTS"} == 2
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]->type eq "cond"
MC/DC0%0/3
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]->type eq "cond" and $self->{"TREE_STACK"}[-1]{"OPTS"} == 2
@{$self->{"TREE_STACK"};}
$self->{"TREE_STACK"}[-1]->type eq "cond"
$self->{"TREE_STACK"}[-1]{"OPTS"} == 2
Truth table50%2/4
A and B and C
A= @{$self->{"TREE_STACK"};}B= $self->{"TREE_STACK"}[-1]->type eq "cond"C= $self->{"TREE_STACK"}[-1]{"OPTS"} == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 4 | @{ $self->{TREE_STACK} } and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | $self->{TREE_STACK}[-1]->type eq 'cond' and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | $self->{TREE_STACK}[-1]{OPTS} == 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | $self->{CONTENT} = '|' . $self->{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 4 | my $node = (ref($self) . "::alt")->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 4 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]->type eq "cond"
MC/DC50%1/2
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]->type eq "cond"
@{$self->{"TREE_STACK"};}
$self->{"TREE_STACK"}[-1]->type eq "cond"
Truth table66%2/3
A and B
A= @{$self->{"TREE_STACK"};}B= $self->{"TREE_STACK"}[-1]->type eq "cond"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 4 | @{ $self->{TREE_STACK} } and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | $self->{TREE_STACK}[-1]->type eq 'cond' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 1 | $self->{TREE_STACK}[-1]{OPTS}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 1 | $self->{CURRENT} = $self->{TREE_STACK}[-1]{FALSE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 3 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 4 | $self->{STATE} = 'alt'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 4 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 63 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Pflags}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my ($add,$sub) = ($1,$2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my $mode = $self->{TREE_STACK}[-1]{MODE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | @{$mode}{split //, $add} = (1) x length($add); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | delete @{$mode}{split //, $sub}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | my $node = (ref($self) . "::flags")->new($add,$sub); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | $self->{STATE} = 'flags'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 63 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Pcond}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 7 | ▶ | if (defined $1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 1 | my $node = (ref($self) . "::conditional")->new($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 1 | $node->{MODE} = { %{ $self->{TREE_STACK}[-1]{MODE} } } if | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 1 | ▶ | @{ $self->{TREE_STACK} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 1 | push @{ $self->{TREE_STACK} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 1 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 1 | $self->{CURRENT} = $node->{TRUE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 1 | $self->{DEPTH}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 1 | $self->{STATE} = "cond($1)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 1 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 6 | my $node = (ref($self) . "::conditional")->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 6 | $node->{MODE} = { %{ $self->{TREE_STACK}[-1]{MODE} } } if | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 6 | ▶ | @{ $self->{TREE_STACK} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 6 | push @{ $self->{TREE_STACK} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 6 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 6 | $self->{CURRENT} = $node->{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 6 | $self->{DEPTH}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 6 | $self->{STATE} = "cond(assert)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 6 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 56 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Pcut}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | my $node = (ref($self) . "::cut")->new([],$quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $node->{MODE} = { %{ $self->{TREE_STACK}[-1]{MODE} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | push @{ $self->{TREE_STACK} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | $self->{CURRENT} = $node->{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $self->{DEPTH}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $self->{STATE} = 'cut'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 56 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Pahead}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 3 | ▶ | my $node = (ref($self) . "::lookahead")->new($1 eq '=' ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 3 | $node->{MODE} = { %{ $self->{TREE_STACK}[-1]{MODE} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 3 | push @{ $self->{TREE_STACK} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 3 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 3 | $self->{CURRENT} = $node->{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 3 | $self->{DEPTH}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 3 | $self->{STATE} = 'lookahead(' . ('neg','pos')[$1 eq '='] . ')'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 3 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 53 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Pbehind}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 3 | ▶ | my $node = (ref($self) . "::lookbehind")->new($1 eq '=' ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 3 | $node->{MODE} = { %{ $self->{TREE_STACK}[-1]{MODE} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 3 | push @{ $self->{TREE_STACK} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 3 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 3 | $self->{CURRENT} = $node->{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 3 | $self->{DEPTH}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 3 | $self->{STATE} = 'lookbehind(' . ('neg','pos')[$1 eq '='] . ')'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 3 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 50 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Pgroup}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 13 | my ($add,$sub) = ($1,$2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 13 | ▶ | my $node = (ref($self) . "::group")->new($add || "",$sub || ""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$add || ''
$sub || ''
MC/DC100%1/1
$add || ''
$add
MC/DC100%1/1
$sub || ''
$sub
Truth table100%2/2
A
A= $add
Truth table100%2/2
A
A= $sub
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 1 | $node->{MODE} = { %{ $self->{TREE_STACK}[-1]{MODE} } } if | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 13 | ▶ | @{ $self->{TREE_STACK} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 13 | @{$node->{MODE}}{split //, $add} = (1) x length($add); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 13 | delete @{$node->{MODE}}{split //, $sub}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 13 | push @{ $self->{TREE_STACK} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 13 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 13 | $self->{CURRENT} = $node->{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 13 | $self->{DEPTH}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 13 | $self->{STATE} = 'group'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 13 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 37 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Pcapture}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 2 | my $node = (ref($self) . "::capture")->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 2 | $node->{MODE} = { %{ $self->{TREE_STACK}[-1]{MODE} } } if | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 2 | ▶ | @{ $self->{TREE_STACK} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 2 | push @{ $self->{TREE_STACK} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 2 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 2 | push @{ $self->{CAPTURE} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 2 | $self->{CURRENT} = $node->{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 2 | $self->{DEPTH}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 2 | $self->{STATE} = 'capture(' . @{ $self->{CAPTURE} } . ')'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 2 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 35 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Pcode}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 2 | ▶ | my ($code,$left) = extract_codeblock($self->{CONTENT}) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $self->{ERROR} = 'bad code in (?{ ... }) assertion'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | $self->{STATE} = 'error'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 2 | $self->{CONTENT} = $left; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 2 | my $node = (ref($self) . "::code")->new($code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 2 | push @{ $self->{TREE_STACK} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 2 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 2 | $self->{DEPTH}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 2 | $self->{STATE} = 'code'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 2 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 33 | ▶ | if ($self->{CONTENT} =~ s/^$pat{Plater}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 2 | ▶ | my ($code,$left) = extract_codeblock($self->{CONTENT}) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | $self->{ERROR} = 'bad code in (??{ ... }) assertion'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $self->{STATE} = 'error'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 2 | $self->{CONTENT} = $left; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 2 | my $node = (ref($self) . "::later")->new($code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 2 | push @{ $self->{TREE_STACK} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 2 | push @{ $self->{CURRENT} }, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 2 | $self->{DEPTH}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 2 | $self->{STATE} = 'later'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 2 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 31 | ▶ | if ($self->{DEPTH}-- and $self->{CONTENT} =~ s/^$pat{Pclose}//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"DEPTH"}-- and $self->{"CONTENT"} =~ s/^$pat{"Pclose"}//
MC/DC50%1/2
$self->{"DEPTH"}-- and $self->{"CONTENT"} =~ s/^$pat{"Pclose"}//
$self->{"DEPTH"}--
$self->{"CONTENT"} =~ s/^$pat{"Pclose"}//
Truth table66%2/3
A and B
A= $self->{"DEPTH"}--B= $self->{"CONTENT"} =~ s/^$pat{"Pclose"}//
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 30 | my ($quant,$ngreed) = $self->_get_quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 30 | ▶ | return if $quant eq -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 30 | my $node = (ref($self) . "::close")->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 30 | $self->{CURRENT} = pop @{ $self->{TREE_STACK} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 30 | $node->{QUANT} = $self->{CURRENT}{QUANT} = $quant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 30 | $node->{NGREED} = $self->{CURRENT}{NGREED} = $ngreed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | # this code is special to YAPE::Regex::Reverse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 30 | ▶ | if ($self->isa('YAPE::Regex::Reverse')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | if ($quant eq '*' or $quant eq '+') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$quant eq "*" or $quant eq "+"
MC/DC0%0/2
$quant eq "*" or $quant eq "+"
$quant eq "*"
$quant eq "+"
Truth table0%0/3
A or B
A= $quant eq "*"B= $quant eq "+"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | my $old = $self->{CURRENT}{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | $self->{CURRENT}{CONTENT} = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | (ref($self) . "::group")->new, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | (ref($self) . "::capture")->new, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | $self->{CURRENT}{NGREED} = '?' if $quant eq '*'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | $self->{CURRENT}{CONTENT}[0]{CONTENT} = $old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | $self->{CURRENT}{CONTENT}[0]{QUANT} = '*'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $self->{CURRENT}{CONTENT}[1]{CONTENT} = $old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | $self->{CAPTURE}[-1] = $self->{CURRENT}{CONTENT}[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | bless $self->{CURRENT}, (ref($self) . '::group'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | ▶ | elsif ($quant and $quant ne '?') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$quant and $quant ne "?"
MC/DC0%0/2
$quant and $quant ne "?"
$quant
$quant ne "?"
Truth table0%0/3
A and B
A= $quantB= $quant ne "?"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | my ($l,$u) = $quant =~ /(\d+),(\d*)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | my $old = $self->{CURRENT}{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | $self->{CURRENT}{CONTENT} = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | (ref($self) . "::group")->new, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | (ref($self) . "::capture")->new, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | $self->{CURRENT}{NGREED} = '?' if not $l; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | $l-- if $l; $u-- if $u; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $self->{CURRENT}{CONTENT}[0]{CONTENT} = $old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $self->{CURRENT}{CONTENT}[0]{QUANT} = "{$l,$u}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | $self->{CURRENT}{CONTENT}[1]{CONTENT} = $old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | $self->{CAPTURE}[-1] = $self->{CURRENT}{CONTENT}[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | bless $self->{CURRENT}, (ref($self) . '::group'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 30 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]->type eq "cond" and $self->{"TREE_STACK"}[-1]{"OPTS"} == 1
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]->type eq "cond"
MC/DC66%2/3
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]->type eq "cond" and $self->{"TREE_STACK"}[-1]{"OPTS"} == 1
@{$self->{"TREE_STACK"};}
$self->{"TREE_STACK"}[-1]->type eq "cond"
$self->{"TREE_STACK"}[-1]{"OPTS"} == 1
Truth table75%3/4
A and B and C
A= @{$self->{"TREE_STACK"};}B= $self->{"TREE_STACK"}[-1]->type eq "cond"C= $self->{"TREE_STACK"}[-1]{"OPTS"} == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 30 | @{ $self->{TREE_STACK} } and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | $self->{TREE_STACK}[-1]->type eq 'cond' and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | $self->{TREE_STACK}[-1]{OPTS} == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 6 | $self->{CURRENT} = $self->{TREE_STACK}[-1]{TRUE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 24 | $self->{CURRENT} = $self->{TREE_STACK}[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 24 | $self->{CURRENT} = $self->{CURRENT}{CONTENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 30 | $self->{STATE} = 'close'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 30 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 1 | my $token = $self->chunk(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 1 | $self->{ERROR} = "unexpected token '$token' during '$self->{STATE}'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 1 | $self->{STATE} = 'error'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | sub extract { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extract: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | $self->parse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | my @nodes = @{ $self->{CAPTURE} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | return sub { shift @nodes }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 64 | ▶ | sub _get_quant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_quant: called CC=17 SCAR=35.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 64 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 64 | my ($quant,$ngreed) = ("",""); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 64 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
$self->{"CONTENT"} =~ s/^($pat{"Pcomment"})?$pat{"quant"}// or @{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"quant"}//
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"quant"}//
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
MC/DC25%1/4
$self->{"CONTENT"} =~ s/^($pat{"Pcomment"})?$pat{"quant"}// or @{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"quant"}//
$self->{"CONTENT"} =~ s/^($pat{"Pcomment"})?$pat{"quant"}//
@{$self->{"TREE_STACK"};}
$self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
$self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"quant"}//
Truth table40%2/5
A or B and C and D
A= $self->{"CONTENT"} =~ s/^($pat{"Pcomment"})?$pat{"quant"}//B= @{$self->{"TREE_STACK"};}C= $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}D= $self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"quant"}//
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | $self->{CONTENT} =~ s/^($pat{Pcomment})?$pat{quant}// or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 57 | (@{ $self->{TREE_STACK} } and $self->{TREE_STACK}[-1]{MODE}{x} and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | $self->{CONTENT} =~ s/^($pat{Xcomment}?\s*)?$pat{quant}//) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 7 | $quant = $+; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 7 | ▶ | if ($quant =~ /^\{(\d+),(\d+)\}/ and $1 > $2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$quant =~ /^\{(\d+),(\d+)\}/ and $1 > $2
MC/DC100%2/2
$quant =~ /^\{(\d+),(\d+)\}/ and $1 > $2
$quant =~ /^\{(\d+),(\d+)\}/
$1 > $2
Truth table100%3/3
A and B
A= $quant =~ /^\{(\d+),(\d+)\}/B= $1 > $2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 1 | $self->{ERROR} = "upper bound lower than lower bound ($quant)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 1 | $self->{STATE} = 'error'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 1 | return -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 6 | ▶ | $self->{CONTENT} = $1 . $self->{CONTENT} if $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | my ($ws) = $1 if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 63 | @{ $self->{TREE_STACK} } and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | $self->{TREE_STACK}[-1]{MODE}{x} and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 63 | ▶ | $self->{CONTENT} =~ s/^(\s+)//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^(\s+)//
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
MC/DC0%0/3
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^(\s+)//
@{$self->{"TREE_STACK"};}
$self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
$self->{"CONTENT"} =~ s/^(\s+)//
Truth table25%1/4
A and B and C
A= @{$self->{"TREE_STACK"};}B= $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}C= $self->{"CONTENT"} =~ s/^(\s+)//
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 63 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"ngreed"}// or $self->{"CONTENT"} =~ s/^($pat{"Pcomment"})?$pat{"ngreed"}//
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"ngreed"}//
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
MC/DC0%0/4
@{$self->{"TREE_STACK"};} and $self->{"TREE_STACK"}[-1]{"MODE"}{"x"} and $self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"ngreed"}// or $self->{"CONTENT"} =~ s/^($pat{"Pcomment"})?$pat{"ngreed"}//
@{$self->{"TREE_STACK"};}
$self->{"TREE_STACK"}[-1]{"MODE"}{"x"}
$self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"ngreed"}//
$self->{"CONTENT"} =~ s/^($pat{"Pcomment"})?$pat{"ngreed"}//
Truth table14%1/7
A and B and C or D
A= @{$self->{"TREE_STACK"};}B= $self->{"TREE_STACK"}[-1]{"MODE"}{"x"}C= $self->{"CONTENT"} =~ s/^($pat{"Xcomment"}?\s*)?$pat{"ngreed"}//D= $self->{"CONTENT"} =~ s/^($pat{"Pcomment"})?$pat{"ngreed"}//
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 63 | (@{ $self->{TREE_STACK} } and $self->{TREE_STACK}[-1]{MODE}{x} and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | $self->{CONTENT} =~ s/^($pat{Xcomment}?\s*)?$pat{ngreed}//) or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | $self->{CONTENT} =~ s/^($pat{Pcomment})?$pat{ngreed}// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | $ngreed = $+; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | $self->{CONTENT} = $1 . $self->{CONTENT} if $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 63 | ▶ | $self->{CONTENT} = $ws . $self->{CONTENT} if $ws; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 63 | return ($quant,$ngreed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 6 | ▶ | sub _ok_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ok_class: called CC=25 SCAR=55.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 6 | my ($self,$class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 6 | ▶ | while ($class =~ s/^($ok_cc_REx)//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 30 | my $c1 = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 30 | ▶ | my $a = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | defined($2) ? oct($2) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | defined($3) ? hex(($3 =~ /(\w+)/)[0]) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | defined($4) ? ord($4) - 64 : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | defined($5) ? ord(eval qq{"\\$5"}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | defined($6) ? ord(eval qq{use charnames ':full'; "\\N{$6}"}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | defined($10) ? ord($10) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 30 | my ($utf8,$posix) = ($8,$9); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 30 | ▶ | $utf8 =~ tr/{}//d if defined $utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 30 | ▶ | if (defined($posix) and $posix !~ $valid_POSIX) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $posix and not $posix =~ /$valid_POSIX/
MC/DC0%0/2
defined $posix and not $posix =~ /$valid_POSIX/
defined $posix
not $posix =~ /$valid_POSIX/
Truth table33%1/3
A and not(B)
A= defined $posixB= not $posix =~ /$valid_POSIX/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | $self->{ERROR} = "unknown POSIX class $c1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | $self->{STATE} = 'error'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 30 | ▶ | if ($class =~ s/^-($ok_cc_REx)//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | my $c2 = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | ▶ | my $b = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | defined($2) ? oct($2) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | defined($3) ? hex(($3 =~ /(\w+)/)[0]) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | defined($4) ? ord($4) - 64 : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | defined($5) ? ord(eval qq{"\\$5"}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | defined($6) ? ord(eval qq{use charnames ':full'; "\\N{$6}"}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | defined($10) ? ord($10) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | my ($utf8,$posix) = ($8,$9); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | ▶ | $utf8 =~ tr/{}//d if defined $utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | ▶ | if (defined($posix) and $posix !~ $valid_POSIX) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $posix and not $posix =~ /$valid_POSIX/
MC/DC0%0/2
defined $posix and not $posix =~ /$valid_POSIX/
defined $posix
not $posix =~ /$valid_POSIX/
Truth table0%0/3
A and not(B)
A= defined $posixB= not $posix =~ /$valid_POSIX/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | $self->{ERROR} = "unknown POSIX class $c2"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | $self->{STATE} = 'error'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | ▶ | if ($a == -1 or $b == -1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$a == -1 or $b == -1
MC/DC0%0/2
$a == -1 or $b == -1
$a == -1
$b == -1
Truth table0%0/3
A or B
A= $a == -1B= $b == -1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | carp qq{false [] range "$c1-$c2"} if $^W; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | elsif ($a > $b) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | $self->{ERROR} = "invalid [] range $c1-$c2"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | $self->{STATE} = 'error'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 6 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | YAPE::Regex - Yet Another Parser/Extractor for Regular Expressions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | This document refers to YAPE::Regex version 4.00. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | use YAPE::Regex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | my $regex = qr/reg(ular\s+)?exp?(ression)?/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | my $parser = YAPE::Regex->new($regex); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | # here is the tokenizing part | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | while (my $chunk = $parser->next) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | # ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | =head1 C<YAPE> MODULES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | The C<YAPE> hierarchy of modules is an attempt at a unified means of parsing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | and extracting content. It attempts to maintain a generic interface, to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | promote simplicity and reusability. The API is powerful, yet simple. The | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | modules do tokenization (which can be intercepted) and build trees, so that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | extraction of specific nodes is doable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | This module is yet another (?) parser and tree-builder for Perl regular | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | expressions. It builds a tree out of a regex, but at the moment, the extent of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | the extraction tool for the tree is quite limited (see L<Extracting Sections>). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | However, the tree can be useful to extension modules. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | =head1 USAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | In addition to the base class, C<YAPE::Regex>, there is the auxiliary class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | C<YAPE::Regex::Element> (common to all C<YAPE> base classes) that holds the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | individual nodes' classes. There is documentation for the node classes in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | that module's documentation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | =head2 Methods for C<YAPE::Regex> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | =item * C<use YAPE::Regex;> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | =item * C<use YAPE::Regex qw( MyExt::Mod );> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | If supplied no arguments, the module is loaded normally, and the node classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | are given the proper inheritence (from C<YAPE::Regex::Element>). If you supply | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | a module (or list of modules), C<import> will automatically include them (if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | needed) and set up I<their> node classes with the proper inheritence -- that is, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | it will append C<YAPE::Regex> to C<@MyExt::Mod::ISA>, and C<YAPE::Regex::xxx> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | to each node class's C<@ISA> (where C<xxx> is the name of the specific node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | class). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | package MyExt::Mod; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | use YAPE::Regex 'MyExt::Mod'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | # does the work of: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | # @MyExt::Mod::ISA = 'YAPE::Regex' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | # @MyExt::Mod::text::ISA = 'YAPE::Regex::text' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | # ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | =item * C<my $p = YAPE::Regex-E<gt>new($REx);> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | Creates a C<YAPE::Regex> object, using the contents of C<$REx> as a regular | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | expression. The C<new> method will I<attempt> to convert C<$REx> to a compiled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | regex (using C<qr//>) if C<$REx> isn't already one. If there is an error in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | the regex, this will fail, but the parser will pretend it was ok. It will then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | report the bad token when it gets to it, in the course of parsing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | =item * C<my $text = $p-E<gt>chunk($len);> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | Returns the next C<$len> characters in the input string; C<$len> defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 30 characters. This is useful for figuring out why a parsing error occurs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | =item * C<my $done = $p-E<gt>done;> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | Returns true if the parser is done with the input string, and false otherwise. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | =item * C<my $errstr = $p-E<gt>error;> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | Returns the parser error message. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | =item * C<my $backref = $p-E<gt>extract;> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | Returns a code reference that returns the next back-reference in the regex. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | For more information on enhancements in upcoming versions of this module, check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | L<Extracting Sections>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | =item * C<my $node = $p-E<gt>display(...);> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | Returns a string representation of the entire content. It calls the C<parse> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | method in case there is more data that has not yet been parsed. This calls the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | C<fullstring> method on the root nodes. Check the C<YAPE::Regex::Element> docs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | on the arguments to C<fullstring>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | =item * C<my $node = $p-E<gt>next;> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | Returns the next token, or C<undef> if there is no valid token. There will be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | an error message (accessible with the C<error> method) if there was a problem in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | the parsing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | =item * C<my $node = $p-E<gt>parse;> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | Calls C<next> until all the data has been parsed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | =item * C<my $node = $p-E<gt>root;> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | Returns the root node of the tree structure. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | =item * C<my $state = $p-E<gt>state;> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | Returns the current state of the parser. It is one of the following values: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | C<alt>, C<anchor>, C<any>, C<backref>, C<capture(N)>, C<Cchar>, C<class>, C<close>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | C<code>, C<comment>, C<cond(TYPE)>, C<ctrl>, C<cut>, C<done>, C<error>, C<flags>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | C<group>, C<hex>, C<later>, C<lookahead(neg|pos)>, C<lookbehind(neg|pos)>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | C<macro>, C<named>, C<oct>, C<slash>, C<text>, and C<utf8hex>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | For C<capture(N)>, I<N> will be the number the captured pattern represents. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | For C<cond(TYPE)>, I<TYPE> will either be a number representing the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | back-reference that the conditional depends on, or the string C<assert>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | For C<lookahead> and C<lookbehind>, one of C<neg> and C<pos> will be there, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | depending on the type of assertion. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | =item * C<my $node = $p-E<gt>top;> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | Synonymous to C<root>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | =head2 Extracting Sections | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | While extraction of nodes is the goal of the C<YAPE> modules, the author is at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | a loss for words as to what needs to be extracted from a regex. At the current | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | time, all the C<extract> method does is allow you access to the regex's set of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | back-references: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | my $extor = $parser->extract; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | while (my $backref = $extor->()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | # ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | C<japhy> is very open to suggestions as to the approach to node extraction (in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | how the API should look, in addition to what should be proffered). Preliminary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | ideas include extraction keywords like the output of B<-Dr> (or the C<re> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | module's C<debug> option). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | =head1 EXTENSIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | =item * C<YAPE::Regex::Explain> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | Presents an explanation of a regular expression, node by node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | =item * C<YAPE::Regex::Reverse> (Not released) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | Reverses the nodes of a regular expression. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | =head1 TO DO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | This is a listing of things to add to future versions of this module. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | =head2 API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | =item * Create a robust C<extract> method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | Open to suggestions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | Following is a list of known or reported bugs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | =head2 Pending | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | =item * C<use charnames ':full'> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | To understand C<\N{...}> properly, you must be using 5.6.0 or higher. However, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | the parser only knows how to resolve full names (those made using C<use charnames | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | ':full'>). There might be an option in the future to specify a class name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | The C<YAPE::Regex::Element> documentation, for information on the node classes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | Also, C<Text::Balanced>, Damian Conway's excellent module, used for the matching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | of C<(?{ ... })> and C<(??{ ... })> blocks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | The original author is Jeff "japhy" Pinyan (CPAN ID: PINYAN). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | Gene Sullivan (gsullivan@cpan.org) is a co-maintainer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | This module is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | it under the same terms as Perl itself. See L<perlartistic>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||