| 1 | package Treex::PML::Schema::List; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 9 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 9 | $VERSION='2.29'; # version template | |||||||||||||||||||||||||||
| 9 | } | ||||||||||||||||||||||||||||
| 10 | 9 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 9 | ▶ | use UNIVERSAL::DOES; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 9 | ▶ | use Treex::PML::Schema::Constants; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 9 | ▶ | use base qw( Treex::PML::Schema::Decl ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head1 NAME | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | Treex::PML::Schema::List - implements declaration of a list. | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head1 INHERITANCE | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | This class inherits from L<Treex::PML::Schema::Decl>. | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =head1 METHODS | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | See the super-class for the complete list. | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =over 3 | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =item $decl->get_decl_type () | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | Returns the constant PML_LIST_DECL. | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =item $decl->get_decl_type_str () | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | Returns the string 'list'. | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =item $decl->get_content_decl () | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | Return type declaration of the list members. | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =item $decl->is_ordered () | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | Return 1 if the list is declared as ordered. | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =item $decl->is_atomic () | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | Returns 0. | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =back | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =cut | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | sub is_atomic { 0 } | ||||||||||||||||||||||||||
|
Subroutine
is_atomic: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 55 | 609 | ▶ | sub get_decl_type { return PML_LIST_DECL; } | ||||||||||||||||||||||||||
|
Subroutine
get_decl_type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub get_decl_type_str { return 'list'; } | ||||||||||||||||||||||||||
|
Subroutine
get_decl_type_str: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub is_ordered { return $_[0]->{ordered} } | ||||||||||||||||||||||||||
|
Subroutine
is_ordered: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 98 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 60 | 98 | my ($self,$opts)=@_; | |||||||||||||||||||||||||||
| 61 | 98 | $self->{-parent}{-decl} = 'list'; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub validate_object { | ||||||||||||||||||||||||||
|
Subroutine
validate_object: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 66 | 0 | my ($self, $object, $opts) = @_; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | my ($path,$tag,$flags); | |||||||||||||||||||||||||||
| 69 | 0 | my $log = []; | |||||||||||||||||||||||||||
| 70 | 0 | ▶ | if (ref($opts)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | $flags = $opts->{flags}; | |||||||||||||||||||||||||||
| 72 | 0 | $path = $opts->{path}; | |||||||||||||||||||||||||||
| 73 | 0 | $tag = $opts->{tag}; | |||||||||||||||||||||||||||
| 74 | 0 | ▶ | $path.="/".$tag if $tag ne q{}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if (UNIVERSAL::DOES::does($object,'Treex::PML::List')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | 0 | my $lm_decl = $self->get_knit_content_decl; | |||||||||||||||||||||||||||
| 78 | 0 | ▶ | for (my $i=0; $i<@$object; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 0 | $lm_decl->validate_object($object->[$i], { | |||||||||||||||||||||||||||
| 80 | flags => $flags, | ||||||||||||||||||||||||||||
| 81 | path=> $path, | ||||||||||||||||||||||||||||
| 82 | tag => "[".($i+1)."]", | ||||||||||||||||||||||||||||
| 83 | log => $log, | ||||||||||||||||||||||||||||
| 84 | }); | ||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | } else { | ||||||||||||||||||||||||||||
| 87 | 0 | push @$log, "$path: unexpected content of a list: $object"; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if ($opts and ref($opts->{log})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$opts and ref $opts->{"log"}
MC/DC0%0/2
$opts and ref $opts->{"log"}
$opts
ref $opts->{"log"}
Truth table0%0/3
A and B
A= $optsB= ref $opts->{"log"}
| |||||||||||||||||||||||||||||
| 90 | 0 | push @{$opts->{log}}, @$log; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | 0 | ▶ | return @$log ? 0 : 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 9 | 1; | |||||||||||||||||||||||||||
| 96 | __END__ | ||||||||||||||||||||||||||||