line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Treex::PML::Schema::Member; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
4
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
62
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
47
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
1
|
|
|
1
|
|
13
|
$VERSION='2.21'; # version template |
9
|
|
|
|
|
|
|
} |
10
|
1
|
|
|
1
|
|
4
|
no warnings 'uninitialized'; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
24
|
|
11
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
39
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
3
|
use Treex::PML::Schema::Constants; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
67
|
|
14
|
1
|
|
|
1
|
|
3
|
use base qw( Treex::PML::Schema::Decl ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
236
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Treex::PML::Schema::Member - implements declaration of a member of a structure. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 INHERITANCE |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This class inherits from L. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
See the super-class for the complete list. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=over 3 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item $decl->get_decl_type () |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Returns the constant PML_MEMBER_DECL. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item $decl->get_decl_type_str () |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Returns the string 'member'. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item $decl->get_name () |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Return name of the member. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item $decl->is_required () |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Return 1 if the member is declared as required, 0 otherwise. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item $decl->is_attribute () |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Return 1 if the member is declared as attribute, 0 otherwise. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item $decl->get_parent_struct () |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Return the structure declaration the member belongs to. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item $decl->get_knit_name () |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Return the member's name with a possible suffix '.rf' chopped-off, if |
58
|
|
|
|
|
|
|
either the member itself has a role '#KNIT' or its content is a list |
59
|
|
|
|
|
|
|
and has a role '#KNIT'. Otherwise return just the member's name. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=back |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
0
|
1
|
|
sub is_atomic { undef } |
66
|
0
|
|
|
0
|
1
|
|
sub get_decl_type { return PML_MEMBER_DECL; } |
67
|
0
|
|
|
0
|
1
|
|
sub get_decl_type_str { return 'member'; } |
68
|
0
|
|
|
0
|
1
|
|
sub get_name { return $_[0]->{-name}; } |
69
|
0
|
|
|
0
|
1
|
|
sub is_required { return $_[0]->{required}; } |
70
|
0
|
|
|
0
|
1
|
|
sub is_attribute { return $_[0]->{as_attribute}; } |
71
|
|
|
|
|
|
|
*get_parent_struct = \&Treex::PML::Schema::Decl::get_parent_decl; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub validate_object { |
74
|
0
|
|
|
0
|
1
|
|
shift->get_content_decl->validate_object(@_); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub get_knit_name { |
78
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
79
|
0
|
|
|
|
|
|
my $name = $self->{-name}; |
80
|
0
|
|
|
|
|
|
my $knit_name = $name; |
81
|
0
|
0
|
|
|
|
|
if ($knit_name=~s/\.rf$//) { |
82
|
0
|
|
|
|
|
|
my $cont; |
83
|
0
|
0
|
0
|
|
|
|
if ( $self->{role} eq '#KNIT' or |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
84
|
|
|
|
|
|
|
(($cont = $self->get_content_decl) and |
85
|
|
|
|
|
|
|
($cont->get_decl_type == PML_LIST_DECL |
86
|
|
|
|
|
|
|
or |
87
|
|
|
|
|
|
|
$cont->get_decl_type == PML_ALT_DECL) |
88
|
|
|
|
|
|
|
and |
89
|
|
|
|
|
|
|
$cont->get_role eq '#KNIT')) { |
90
|
0
|
|
|
|
|
|
return $knit_name |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
0
|
|
|
|
|
|
return $name; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
__END__ |