| 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<PPI::Token::Regexp> 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<PPI::Token::Regexp::Match> | ||
| 24 | |||
| 25 | =item s/// - L<PPI::Token::Regexp::Substitute> | ||
| 26 | |||
| 27 | =item tr/// - L<PPI::Token::Regexp::Transliterate> | ||
| 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<qr//> is | ||
| 35 | B<not> 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<Regexp> objects. | ||
| 38 | |||
| 39 | =head1 METHODS | ||
| 40 | |||
| 41 | The following methods are inherited by this class' offspring: | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | 62 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 46 | 62 | ▶ | use PPI::Token (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 47 | |||
| 48 | 62 | ▶ | use vars qw{$VERSION @ISA}; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 49 | BEGIN { | ||
| 50 | 62 | ▶ | $VERSION = '1.236'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 51 | 62 | @ISA = 'PPI::Token'; | |
| 52 | } | ||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | ##################################################################### | ||
| 59 | # PPI::Token::Regexp Methods | ||
| 60 | |||
| 61 | =pod | ||
| 62 | |||
| 63 | =head2 get_match_string | ||
| 64 | |||
| 65 | The C<get_match_string> method returns the portion of the regexp that | ||
| 66 | performs the match. | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | sub get_match_string { | ||
| 71 | 1 | ▶ | return $_[0]->_section_content( 0 ); |
|
Subroutine
get_match_string: called CC=1 SCAR=0.0
Pod
documented
| |||
| 72 | } | ||
| 73 | |||
| 74 | =pod | ||
| 75 | |||
| 76 | =head2 get_substitute_string | ||
| 77 | |||
| 78 | The C<get_substitute_string> method returns the portion of the regexp | ||
| 79 | that is substituted for the match, if any. If the regexp does not | ||
| 80 | substitute, C<undef> is returned. | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | sub get_substitute_string { | ||
| 85 | 2 | ▶ | return $_[0]->_section_content( 1 ); |
|
Subroutine
get_substitute_string: called CC=1 SCAR=0.0
Pod
documented
| |||
| 86 | } | ||
| 87 | |||
| 88 | =pod | ||
| 89 | |||
| 90 | =head2 get_modifiers | ||
| 91 | |||
| 92 | The C<get_modifiers> method returns the modifiers of the regexp. | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | sub get_modifiers { | ||
| 97 | 1 | ▶ | return $_[0]->_modifiers(); |
|
Subroutine
get_modifiers: called CC=1 SCAR=0.0
Pod
documented
| |||
| 98 | } | ||
| 99 | |||
| 100 | =pod | ||
| 101 | |||
| 102 | =head2 get_delimiters | ||
| 103 | |||
| 104 | The C<get_delimiters> method returns the delimiters of the regexp as | ||
| 105 | an array. The first element is the delimiters of the match string, and | ||
| 106 | the second element (if any) is the delimiters of the substitute string | ||
| 107 | (if any). | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | sub get_delimiters { | ||
| 112 | 1 | ▶ | return $_[0]->_delimiters(); |
|
Subroutine
get_delimiters: called CC=1 SCAR=0.0
Pod
documented
| |||
| 113 | } | ||
| 114 | |||
| 115 | |||
| 116 | 62 | 1; | |
| 117 | |||
| 118 | =pod | ||
| 119 | |||
| 120 | =head1 SUPPORT | ||
| 121 | |||
| 122 | See the L<support section|PPI/SUPPORT> in the main module. | ||
| 123 | |||
| 124 | =head1 AUTHOR | ||
| 125 | |||
| 126 | Adam Kennedy E<lt>adamk@cpan.orgE<gt> | ||
| 127 | |||
| 128 | =head1 COPYRIGHT | ||
| 129 | |||
| 130 | Copyright 2001 - 2011 Adam Kennedy. | ||
| 131 | |||
| 132 | This program is free software; you can redistribute | ||
| 133 | it and/or modify it under the same terms as Perl itself. | ||
| 134 | |||
| 135 | The full text of the license can be found in the | ||
| 136 | LICENSE file included with this module. | ||
| 137 | |||
| 138 | =cut | ||