line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Treex::PML::Schema::Member; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
37
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
207
|
|
4
|
6
|
|
|
6
|
|
29
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
144
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
27
|
use vars qw($VERSION); |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
223
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
6
|
|
|
6
|
|
92
|
$VERSION='2.24'; # version template |
9
|
|
|
|
|
|
|
} |
10
|
6
|
|
|
6
|
|
28
|
no warnings 'uninitialized'; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
166
|
|
11
|
6
|
|
|
6
|
|
27
|
use Carp; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
251
|
|
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
28
|
use Treex::PML::Schema::Constants; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
448
|
|
14
|
6
|
|
|
6
|
|
28
|
use base qw( Treex::PML::Schema::Decl ); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
2172
|
|
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
|
0
|
sub is_atomic { undef } |
66
|
2462
|
|
|
2462
|
1
|
4214
|
sub get_decl_type { return PML_MEMBER_DECL; } |
67
|
0
|
|
|
0
|
1
|
0
|
sub get_decl_type_str { return 'member'; } |
68
|
1134
|
|
|
1134
|
1
|
3265
|
sub get_name { return $_[0]->{-name}; } |
69
|
781
|
|
|
781
|
1
|
2560
|
sub is_required { return $_[0]->{required}; } |
70
|
112
|
|
|
112
|
1
|
286
|
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
|
0
|
shift->get_content_decl->validate_object(@_); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub get_knit_name { |
78
|
7
|
|
|
7
|
1
|
15
|
my $self = shift; |
79
|
7
|
|
|
|
|
16
|
my $name = $self->{-name}; |
80
|
7
|
|
|
|
|
16
|
my $knit_name = $name; |
81
|
7
|
50
|
|
|
|
68
|
if ($knit_name=~s/\.rf$//) { |
82
|
7
|
|
|
|
|
15
|
my $cont; |
83
|
7
|
50
|
33
|
|
|
46
|
if ( $self->{role} eq '#KNIT' or |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
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
|
7
|
|
|
|
|
28
|
return $knit_name |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
0
|
|
|
|
|
|
return $name; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
__END__ |