| 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 | 63 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 46 | 63 | ▶ | use PPI::Token (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 47 | |||
| 48 | 63 | our $VERSION = '1.260'; # VERSION | |
| 49 | |||
| 50 | 63 | 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<get_match_string> method returns the portion of the regexp that | ||
| 64 | performs the match. | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | sub get_match_string { | ||
| 69 | 1 | ▶ | return $_[0]->_section_content( 0 ); |
|
Subroutine
get_match_string: called CC=1 SCAR=0.0
Pod
documented
| |||
| 70 | } | ||
| 71 | |||
| 72 | =pod | ||
| 73 | |||
| 74 | =head2 get_substitute_string | ||
| 75 | |||
| 76 | The C<get_substitute_string> method returns the portion of the regexp | ||
| 77 | that is substituted for the match, if any. If the regexp does not | ||
| 78 | substitute, C<undef> is returned. | ||
| 79 | |||
| 80 | =cut | ||
| 81 | |||
| 82 | sub get_substitute_string { | ||
| 83 | 2 | ▶ | return $_[0]->_section_content( 1 ); |
|
Subroutine
get_substitute_string: called CC=1 SCAR=0.0
Pod
documented
| |||
| 84 | } | ||
| 85 | |||
| 86 | =pod | ||
| 87 | |||
| 88 | =head2 get_modifiers | ||
| 89 | |||
| 90 | The C<get_modifiers> method returns the modifiers of the regexp. | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | sub get_modifiers { | ||
| 95 | 1 | ▶ | return $_[0]->_modifiers(); |
|
Subroutine
get_modifiers: called CC=1 SCAR=0.0
Pod
documented
| |||
| 96 | } | ||
| 97 | |||
| 98 | =pod | ||
| 99 | |||
| 100 | =head2 get_delimiters | ||
| 101 | |||
| 102 | The C<get_delimiters> 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 | ▶ | return $_[0]->_delimiters(); |
|
Subroutine
get_delimiters: called CC=1 SCAR=0.0
Pod
documented
| |||
| 111 | } | ||
| 112 | |||
| 113 | |||
| 114 | 63 | 1; | |
| 115 | |||
| 116 | =pod | ||
| 117 | |||
| 118 | =head1 SUPPORT | ||
| 119 | |||
| 120 | See the L<support section|PPI/SUPPORT> in the main module. | ||
| 121 | |||
| 122 | =head1 AUTHOR | ||
| 123 | |||
| 124 | Adam Kennedy E<lt>adamk@cpan.orgE<gt> | ||
| 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 | ||