line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
PPIx::Regexp::Token - Base class for PPIx::Regexp tokens. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use PPIx::Regexp::Dumper; |
8
|
|
|
|
|
|
|
PPIx::Regexp::Dumper->new( 'qr{foo}' )->print(); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 INHERITANCE |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
C is a |
13
|
|
|
|
|
|
|
L. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
C is the parent of |
16
|
|
|
|
|
|
|
L, |
17
|
|
|
|
|
|
|
L, |
18
|
|
|
|
|
|
|
L, |
19
|
|
|
|
|
|
|
L, |
20
|
|
|
|
|
|
|
L, |
21
|
|
|
|
|
|
|
L, |
22
|
|
|
|
|
|
|
L, |
23
|
|
|
|
|
|
|
L, |
24
|
|
|
|
|
|
|
L, |
25
|
|
|
|
|
|
|
L, |
26
|
|
|
|
|
|
|
L, |
27
|
|
|
|
|
|
|
L, |
28
|
|
|
|
|
|
|
L, |
29
|
|
|
|
|
|
|
L, |
30
|
|
|
|
|
|
|
L, |
31
|
|
|
|
|
|
|
L and |
32
|
|
|
|
|
|
|
L. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This class represents the base of the class hierarchy for tokens in the |
37
|
|
|
|
|
|
|
L package. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This class provides no public methods beyond those provided by its |
42
|
|
|
|
|
|
|
superclass. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package PPIx::Regexp::Token; |
47
|
|
|
|
|
|
|
|
48
|
9
|
|
|
9
|
|
69
|
use strict; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
278
|
|
49
|
9
|
|
|
9
|
|
54
|
use warnings; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
258
|
|
50
|
|
|
|
|
|
|
|
51
|
9
|
|
|
9
|
|
51
|
use base qw{PPIx::Regexp::Element}; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
729
|
|
52
|
|
|
|
|
|
|
|
53
|
9
|
|
|
9
|
|
61
|
use Carp qw{ confess }; |
|
9
|
|
|
|
|
28
|
|
|
9
|
|
|
|
|
432
|
|
54
|
9
|
|
|
9
|
|
84
|
use PPIx::Regexp::Constant qw{ MINIMUM_PERL @CARP_NOT }; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
965
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
our $VERSION = '0.087_01'; |
57
|
|
|
|
|
|
|
|
58
|
9
|
|
|
9
|
|
63
|
use constant TOKENIZER_ARGUMENT_REQUIRED => 0; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
4235
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub __new { |
61
|
5470
|
|
|
5470
|
|
16381
|
my ( $class, $content, %arg ) = @_; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
not $class->TOKENIZER_ARGUMENT_REQUIRED() |
64
|
|
|
|
|
|
|
or $arg{tokenizer} |
65
|
5470
|
50
|
66
|
|
|
20660
|
or confess 'Programming error - tokenizer not provided'; |
66
|
|
|
|
|
|
|
|
67
|
5470
|
|
|
|
|
16087
|
my $self = { |
68
|
|
|
|
|
|
|
content => $content, |
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
5470
|
|
|
|
|
11966
|
foreach my $key ( qw{ |
72
|
|
|
|
|
|
|
explanation perl_version_introduced perl_version_removed |
73
|
|
|
|
|
|
|
} ) { |
74
|
|
|
|
|
|
|
defined $arg{$key} |
75
|
16410
|
100
|
|
|
|
34495
|
and $self->{$key} = $arg{$key}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
5470
|
|
33
|
|
|
17310
|
bless $self, ref $class || $class; |
79
|
5470
|
|
|
|
|
20794
|
return $self; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub content { |
83
|
10817
|
|
|
10817
|
1
|
21118
|
my ( $self ) = @_; |
84
|
10817
|
|
|
|
|
35615
|
return $self->{content}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 first_token |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This method returns its invocant. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub first_token { |
94
|
13
|
|
|
13
|
1
|
29
|
my ( $self ) = @_; |
95
|
13
|
|
|
|
|
60
|
return $self; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 last_token |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This method returns its invocant. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub last_token { |
105
|
96
|
|
|
96
|
1
|
171
|
my ( $self ) = @_; |
106
|
96
|
|
|
|
|
285
|
return $self; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub perl_version_introduced { |
110
|
91
|
|
|
91
|
1
|
6319
|
my ( $self ) = @_; |
111
|
|
|
|
|
|
|
return defined $self->{perl_version_introduced} ? |
112
|
|
|
|
|
|
|
$self->{perl_version_introduced} : |
113
|
91
|
100
|
|
|
|
382
|
MINIMUM_PERL; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub perl_version_removed { |
117
|
546
|
|
|
546
|
1
|
63044
|
my ( $self ) = @_; |
118
|
546
|
|
|
|
|
1623
|
return $self->{perl_version_removed}; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub unescaped_content { |
122
|
126
|
|
|
126
|
1
|
253
|
my ( $self ) = @_; |
123
|
126
|
|
|
|
|
378
|
my $content = $self->content(); |
124
|
126
|
|
|
|
|
348
|
$content =~ s/ \\ (?= . ) //smxg; |
125
|
126
|
|
|
|
|
653
|
return $content; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub scontent { |
129
|
69
|
|
|
69
|
1
|
101
|
my ( $self ) = @_; |
130
|
|
|
|
|
|
|
$self->significant() |
131
|
69
|
100
|
|
|
|
120
|
and return $self->{content}; |
132
|
20
|
|
|
|
|
34
|
return; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# Called by the lexer once it has done its worst to all the tokens. |
136
|
|
|
|
|
|
|
# Called as a method with the lexer as argument. The return is the |
137
|
|
|
|
|
|
|
# number of parse failures discovered when finalizing. |
138
|
|
|
|
|
|
|
sub __PPIX_LEXER__finalize { |
139
|
1608
|
|
|
1608
|
|
3237
|
return 0; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
__END__ |