line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PPI::Token::Regexp; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
PPI::Token::Regexp - Regular expression abstract base class |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 INHERITANCE |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
PPI::Token::Regexp |
12
|
|
|
|
|
|
|
isa PPI::Token |
13
|
|
|
|
|
|
|
isa PPI::Element |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
The C class is never instantiated, and simply |
18
|
|
|
|
|
|
|
provides a common abstract base class for the three regular expression |
19
|
|
|
|
|
|
|
classes. These being: |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=over 2 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=item m// - L |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=item s/// - L |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=item tr/// - L |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=back |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
The names are hopefully obvious enough not to have to explain what |
32
|
|
|
|
|
|
|
each class is. See their pages for more details. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
To save some confusion, it's worth pointing out here that C is |
35
|
|
|
|
|
|
|
B a regular expression (which PPI takes to mean something that |
36
|
|
|
|
|
|
|
will actually examine or modify a string), but rather a quote-like |
37
|
|
|
|
|
|
|
operator that acts as a constructor for compiled L objects. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The following methods are inherited by this class' offspring: |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
65
|
|
|
65
|
|
361
|
use strict; |
|
65
|
|
|
|
|
112
|
|
|
65
|
|
|
|
|
1420
|
|
46
|
65
|
|
|
65
|
|
271
|
use PPI::Token (); |
|
65
|
|
|
|
|
104
|
|
|
65
|
|
|
|
|
8440
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
our $VERSION = '1.276'; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
our @ISA = "PPI::Token"; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
##################################################################### |
57
|
|
|
|
|
|
|
# PPI::Token::Regexp Methods |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 get_match_string |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The C method returns the portion of the regexp that |
64
|
|
|
|
|
|
|
performs the match. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub get_match_string { |
69
|
1
|
|
|
1
|
1
|
400
|
return $_[0]->_section_content( 0 ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=pod |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 get_substitute_string |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
The C method returns the portion of the regexp |
77
|
|
|
|
|
|
|
that is substituted for the match, if any. If the regexp does not |
78
|
|
|
|
|
|
|
substitute, C is returned. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub get_substitute_string { |
83
|
2
|
|
|
2
|
1
|
296
|
return $_[0]->_section_content( 1 ); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=pod |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 get_modifiers |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
The C method returns the modifiers of the regexp. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub get_modifiers { |
95
|
1
|
|
|
1
|
1
|
6
|
return $_[0]->_modifiers(); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=pod |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 get_delimiters |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The C method returns the delimiters of the regexp as |
103
|
|
|
|
|
|
|
an array. The first element is the delimiters of the match string, and |
104
|
|
|
|
|
|
|
the second element (if any) is the delimiters of the substitute string |
105
|
|
|
|
|
|
|
(if any). |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub get_delimiters { |
110
|
1
|
|
|
1
|
1
|
5
|
return $_[0]->_delimiters(); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=pod |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SUPPORT |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
See the L in the main module. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Copyright 2001 - 2011 Adam Kennedy. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This program is free software; you can redistribute |
131
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
The full text of the license can be found in the |
134
|
|
|
|
|
|
|
LICENSE file included with this module. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |