line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
PPIx::Regexp::Structure::Code - Represent one of the code structures. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use PPIx::Regexp::Dumper; |
8
|
|
|
|
|
|
|
PPIx::Regexp::Dumper->new( 'qr{(?{print "hello sailor\n")}smx' ) |
9
|
|
|
|
|
|
|
->print(); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 INHERITANCE |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
C is a |
14
|
|
|
|
|
|
|
L. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
C has no descendants. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This class represents one of the code structures, either |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
(?{ code }) |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
or |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
(??{ code }) |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 METHODS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This class provides no public methods beyond those provided by its |
31
|
|
|
|
|
|
|
superclass. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
package PPIx::Regexp::Structure::Code; |
36
|
|
|
|
|
|
|
|
37
|
9
|
|
|
9
|
|
59
|
use strict; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
249
|
|
38
|
9
|
|
|
9
|
|
51
|
use warnings; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
227
|
|
39
|
|
|
|
|
|
|
|
40
|
9
|
|
|
9
|
|
42
|
use base qw{ PPIx::Regexp::Structure }; |
|
9
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
728
|
|
41
|
|
|
|
|
|
|
|
42
|
9
|
|
|
9
|
|
57
|
use PPIx::Regexp::Constant qw{ @CARP_NOT }; |
|
9
|
|
|
|
|
36
|
|
|
9
|
|
|
|
|
1977
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our $VERSION = '0.087_01'; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# The only child of this structure should be a single |
47
|
|
|
|
|
|
|
# PPIx::Regexp::Token::Code. Anything else gets turned into the |
48
|
|
|
|
|
|
|
# appropriate ::Unknown object. |
49
|
|
|
|
|
|
|
sub __PPIX_LEXER__finalize { |
50
|
9
|
|
|
9
|
|
32
|
my ( $self ) = @_; # $lexer unused |
51
|
|
|
|
|
|
|
|
52
|
9
|
|
|
|
|
21
|
my $count; |
53
|
9
|
|
|
|
|
21
|
my $errors = 0; |
54
|
|
|
|
|
|
|
|
55
|
9
|
|
|
|
|
63
|
foreach my $kid ( $self->children() ) { |
56
|
|
|
|
|
|
|
|
57
|
10
|
100
|
|
|
|
54
|
if ( $kid->isa( 'PPIx::Regexp::Token::Code' ) ) { |
58
|
9
|
50
|
|
|
|
44
|
$count++ |
59
|
|
|
|
|
|
|
or next; |
60
|
0
|
|
|
|
|
0
|
$errors++; |
61
|
0
|
|
|
|
|
0
|
$kid->__error( |
62
|
|
|
|
|
|
|
'Code structure can contain only one code token' ); |
63
|
|
|
|
|
|
|
} else { |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
4
|
$errors++; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
15
|
$kid->__error( |
68
|
|
|
|
|
|
|
'Code structure may not contain a ' . ref $kid ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
9
|
|
|
|
|
25
|
return $errors; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |