| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package My::Module::Mock_Tokenizer; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
280098
|
use 5.006; |
|
|
1
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
24
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
50
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
84
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.091'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
3
|
use constant ARRAY_REF => ref []; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
251
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
|
15
|
7
|
|
|
7
|
1
|
15
|
my ( $class, %arg ) = @_; |
|
16
|
7
|
|
33
|
|
|
63
|
return bless \%arg, ref $class || $class; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub capture { |
|
20
|
1
|
|
|
1
|
1
|
2
|
my ( $self ) = @_; |
|
21
|
|
|
|
|
|
|
ARRAY_REF eq ref $self->{capture} |
|
22
|
1
|
50
|
|
|
|
5
|
or return; |
|
23
|
1
|
|
|
|
|
1
|
return @{ $self->{capture} }; |
|
|
1
|
|
|
|
|
3
|
|
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub cookie { |
|
27
|
4
|
|
|
4
|
1
|
7
|
my ( $self, $cookie ) = @_; |
|
28
|
4
|
|
|
|
|
15
|
return $self->{cookie}{$cookie}; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
2
|
1
|
|
sub modifier_modify {} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub __recognize_postderef { |
|
34
|
2
|
|
|
2
|
|
3
|
my ( $self ) = @_; |
|
35
|
2
|
|
|
|
|
8
|
return $self->{postderef}; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
My::Module::Mock_Tokenizer - Mock tokenizer for t/*.t |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use lib qw{ inc }; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
use My::Module::Mock_Tokenizer; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $tokenizer = My::Module::Mock_Tokenizer->new(); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This Perl class is private to the C<PPIx-Regexp> package, and may be |
|
57
|
|
|
|
|
|
|
modified or retracted without notice. Documentation is for the benefit |
|
58
|
|
|
|
|
|
|
of the author. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
It represents a mock tokenizer to be used in testing. It implements |
|
61
|
|
|
|
|
|
|
those methods that the author finds useful. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 METHODS |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This class supports the following public methods: |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 new |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $tokenizer = My::Module::Mock_Tokenizer->new(); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This static method instantiates the tokenizer. In addition to the |
|
72
|
|
|
|
|
|
|
invocant it takes arbitrary name/value pairs of arguments. These |
|
73
|
|
|
|
|
|
|
arguments are made into a hash, and a blessed reference to this hash is |
|
74
|
|
|
|
|
|
|
returned. The arguments are not validated, but may be used in methods as |
|
75
|
|
|
|
|
|
|
documented below. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 capture |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
say "Capture: '$_'" for $tokenizer->capture(); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
If C<< $tokenizer->{capture} >> is an array reference, the contents of |
|
82
|
|
|
|
|
|
|
the array are returned. Otherwise nothing is returned. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 cookie |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
my $cookie = $tokenizer->cookie( $name ); |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This method returns C<< $tokenizer->{cookie}{$name} >>. If you want to |
|
89
|
|
|
|
|
|
|
specify a value for this, recall that cookies are code references. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 modifier_modify |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
$tokenizer->modifier_modify( i => 1 ); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This method does nothing and returns nothing. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 __recognize_postderef |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
$tokenizer->__recognize_postderef() |
|
100
|
|
|
|
|
|
|
and say 'We recognize postfix dereferences'; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This method returns the value of C<< $tokenizer->{postderef} >>. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L<PPIx::Regexp::Tokenizer|PPIx::Regexp::Tokenizer> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SUPPORT |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This module is private to the C<PPIx-Regexp> package. It is unsupported in |
|
111
|
|
|
|
|
|
|
the sense that the author reserves the right to modify or retract it |
|
112
|
|
|
|
|
|
|
without prior notice. Bug reports against this module will be accepted |
|
113
|
|
|
|
|
|
|
provided they document a problem with this module that results in |
|
114
|
|
|
|
|
|
|
spurious test results. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Support is by the author. Please file bug reports at |
|
117
|
|
|
|
|
|
|
L<https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-Regexp>, |
|
118
|
|
|
|
|
|
|
L<https://github.com/trwyant/perl-PPIx-Regexp/issues>, or in |
|
119
|
|
|
|
|
|
|
electronic mail to the author. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Tom Wyant (wyant at cpan dot org) |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Copyright (C) 2015-2023, 2025 by Thomas R. Wyant, III |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
130
|
|
|
|
|
|
|
under the same terms as Perl 5.10.0. For more details, see the full text |
|
131
|
|
|
|
|
|
|
of the licenses in the directory LICENSES. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but |
|
134
|
|
|
|
|
|
|
without any warranty; without even the implied warranty of |
|
135
|
|
|
|
|
|
|
merchantability or fitness for a particular purpose. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# ex: set textwidth=72 : |