line |
l |
!l |
condition |
20
|
0 |
19 |
$opt_ref //= {} |
356
|
296 |
38 |
$^H{'Keyword::Simple/keywords'} // {} |
465
|
0 |
0 |
$PPR::ERROR // '' |
517
|
122 |
36 |
$dispatcher_for{$keyword_name} //= sub {
my($src_ref) = @_;
my($package, $file, $line) = caller;
local $PPR::ERROR;
my(@candidate_IDs) = @^H{grep {/^ Keyword::Declare \s+ active:$keyword_name:/msux;} keys %^H};
my(@active_IDs) = @^H{grep {/^ Keyword::Declare \s+ active:/msux;} keys %^H};
my $lexical_keywords = @active_IDs ? join('|', reverse sort(map({$keyword_impls[$_]{'skip_matcher'};} @active_IDs))) : '(?!)';
$lexical_keywords = "(?(DEFINE) (? $lexical_keywords ) )";
my(@viable_IDs) = grep({$$src_ref =~ / \A $keyword_impls[$_]{'sig_matcher'} $lexical_keywords $PPR::GRAMMAR /msux;} @candidate_IDs);
unless (@viable_IDs) {
my $error = eval "no strict;sub{\n" . ($PPR::ERROR // '') . '}' ? " $keyword_name " . do {
my $src = $$src_ref;
$src =~ s/ \A \s*+ (\S++ [^\n]*+) \n .* /$1/sux;
$src
} : do {
my $err = $@;
$err =~ s/^/ /gmu;
$err =~ s/\(eval \d++\) line \d++/"$file line " . $PPR::ERROR->line($line);/egu;
$err
};
croak('Invalid ' . join(' or ', &uniqstr(map({$keyword_impls[$_]{'desc'};} @candidate_IDs))) . " at $file line $line.\nExpected:" . join("\n ", '', &uniqstr(map({$keyword_impls[$_]{'syntax'};} @candidate_IDs))) . "\nbut found:\n$error" . "\nCompilation failed");
};
if (@viable_IDs > 1) {
my $max_sig_len = &max(map({$keyword_impls[$_]{'sig_len'};} @viable_IDs));
@viable_IDs = grep({$keyword_impls[$_]{'sig_len'} == $max_sig_len;} @viable_IDs);
if (@viable_IDs > 1) {
@viable_IDs = _resolve_matches(@viable_IDs);
};
if (@viable_IDs > 1) {
if (my(@preferred_IDs) = grep({$keyword_impls[$_]{'prefer'};} @viable_IDs)) {
@viable_IDs = @preferred_IDs;
};
};
if (@viable_IDs > 1) {
croak('Ambiguous ' . join(' or ', &uniqstr(map({$keyword_impls[$_]{'desc'};} @viable_IDs))) . " at $file line ${line}:\n $keyword_name " . do {
my $src = $$src_ref;
$src =~ s/ \A \s*+ ( \S++ [^\n]*+) \n .* /$1/sux;
$src
} . "\nCould be:\n" . join("\n", map({" $keyword_impls[$_]{'syntax'}";} @viable_IDs)) . "\nCompilation failed");
};
};
my($ID) = @viable_IDs;
_insert_replacement_code($src_ref, $ID, $file, $line, $lexical_keywords);
}
|
668
|
2 |
166 |
$user_defined_type_for //= {map({/ \A Keyword::Declare \s* keytype: (\w+) = (.*) /msux;} keys %^H)} |
774
|
6 |
86 |
delete $obj->{'____KD___sep'} // '' |
854
|
165 |
11 |
$param->{'name'} // '' |
993
|
0 |
19 |
$keyword->{'sig_defaults'}{$argname} // '' |
1014
|
76 |
0 |
$keyword->{'generator'}->(@args) // '' |
line |
l |
!l&&r |
!l&&!r |
condition |
24
|
0 |
0 |
19 |
@_ > 2 or $arg_type ne 'HASH' |
25
|
0 |
0 |
0 |
$arg_type ||= $opt_ref |
416
|
0 |
0 |
0 |
$source_cache->{$filename} //= do {
local(*ARGV, $/);
@ARGV = $filename;
readline ARGV
} |
674
|
16 |
154 |
0 |
$user_defined_type_for->{$type} // $ACTUAL_TYPE_OF{$type} |
|
154 |
0 |
0 |
($user_defined_type_for->{$type} // $ACTUAL_TYPE_OF{$type}) // croak("Unknown type ($type) for keyword parameter.\nDid you mean: ", join(' or ', grep({lc substr($_, 0, 1) eq lc substr($type, 0, 1);} keys %ACTUAL_TYPE_OF))) |
715
|
0 |
163 |
0 |
$param->{'desc'} //= do {
my $desc = $param->{'name'} ? "<$param->{'name'}>" : '<' . join(' or ', @types) . '>';
$desc =~ tr/_/ /;
$desc
} |
728
|
0 |
7 |
0 |
$param->{'desc'} //= $param->{'name'} ? do {
my $name = "<$param->{'name'}>";
$name =~ tr/_/ /;
$name
} : $1 |
741
|
163 |
8 |
0 |
$param->{'desc'} //= $param->{'name'} ? do {
my $name = "<$param->{'name'}>";
$name =~ tr/_/ /;
$name
} : "/$match{'pattern'}/$match{'modifiers'}" |
814
|
0 |
0 |
0 |
$param->{'quantifier'} //= $param->{'sigil'} && $param->{'sigil'} eq '@' ? '*' : '?' |
817
|
19 |
3 |
154 |
$param->{'quantifier'} //= $param->{'sigil'} && $param->{'sigil'} eq '@' ? '+' : '' |
858
|
8 |
4 |
153 |
$param->{'sigil'} ne '$' || $single_matcher =~ /\(\?
|
1085
|
0 |
5 |
1 |
$partial_ordering ||= $is_narrower |