| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Token/GroupType/Switch.pm |
| Statements | Executed 8 statements in 193µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 17µs | 33µs | PPIx::Regexp::Token::GroupType::Switch::BEGIN@33 |
| 1 | 1 | 1 | 11µs | 17µs | PPIx::Regexp::Token::GroupType::Switch::BEGIN@34 |
| 1 | 1 | 1 | 10µs | 83µs | PPIx::Regexp::Token::GroupType::Switch::BEGIN@36 |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::GroupType::Switch::__defining_string |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::GroupType::Switch::__match_setup |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::GroupType::Switch::perl_version_introduced |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | =head1 NAME | ||||
| 2 | |||||
| 3 | PPIx::Regexp::Token::GroupType::Switch - Represent the introducing characters for a switch | ||||
| 4 | |||||
| 5 | =head1 SYNOPSIS | ||||
| 6 | |||||
| 7 | use PPIx::Regexp::Dumper; | ||||
| 8 | PPIx::Regexp::Dumper->new( 'qr{(?(1)foo|bar)}smx' ) | ||||
| 9 | ->print(); | ||||
| 10 | |||||
| 11 | =head1 INHERITANCE | ||||
| 12 | |||||
| 13 | C<PPIx::Regexp::Token::GroupType::Switch> is a | ||||
| 14 | L<PPIx::Regexp::Token::GroupType|PPIx::Regexp::Token::GroupType>. | ||||
| 15 | |||||
| 16 | C<PPIx::Regexp::Token::GroupType::Switch> has no descendants. | ||||
| 17 | |||||
| 18 | =head1 DESCRIPTION | ||||
| 19 | |||||
| 20 | This class represents the characters right after a left parenthesis that | ||||
| 21 | introduce a switch. Strictly speaking these characters are '?(', but | ||||
| 22 | this class only takes the '?'. | ||||
| 23 | |||||
| 24 | =head1 METHODS | ||||
| 25 | |||||
| 26 | This class provides no public methods beyond those provided by its | ||||
| 27 | superclass. | ||||
| 28 | |||||
| 29 | =cut | ||||
| 30 | |||||
| 31 | package PPIx::Regexp::Token::GroupType::Switch; | ||||
| 32 | |||||
| 33 | 2 | 34µs | 2 | 49µs | # spent 33µs (17+16) within PPIx::Regexp::Token::GroupType::Switch::BEGIN@33 which was called:
# once (17µs+16µs) by PPIx::Regexp::Tokenizer::BEGIN@32 at line 33 # spent 33µs making 1 call to PPIx::Regexp::Token::GroupType::Switch::BEGIN@33
# spent 16µs making 1 call to strict::import |
| 34 | 2 | 29µs | 2 | 23µs | # spent 17µs (11+6) within PPIx::Regexp::Token::GroupType::Switch::BEGIN@34 which was called:
# once (11µs+6µs) by PPIx::Regexp::Tokenizer::BEGIN@32 at line 34 # spent 17µs making 1 call to PPIx::Regexp::Token::GroupType::Switch::BEGIN@34
# spent 6µs making 1 call to warnings::import |
| 35 | |||||
| 36 | 2 | 126µs | 2 | 156µs | # spent 83µs (10+73) within PPIx::Regexp::Token::GroupType::Switch::BEGIN@36 which was called:
# once (10µs+73µs) by PPIx::Regexp::Tokenizer::BEGIN@32 at line 36 # spent 83µs making 1 call to PPIx::Regexp::Token::GroupType::Switch::BEGIN@36
# spent 73µs making 1 call to base::import |
| 37 | |||||
| 38 | 1 | 800ns | our $VERSION = '0.036'; | ||
| 39 | |||||
| 40 | sub perl_version_introduced { | ||||
| 41 | # my ( $self ) = @_; | ||||
| 42 | return '5.005'; | ||||
| 43 | } | ||||
| 44 | |||||
| 45 | # Return true if the token can be quantified, and false otherwise | ||||
| 46 | # sub can_be_quantified { return }; | ||||
| 47 | |||||
| 48 | =begin comment | ||||
| 49 | |||||
| 50 | sub __PPIX_TOKENIZER__regexp { | ||||
| 51 | my ( $class, $tokenizer, $character ) = @_; | ||||
| 52 | |||||
| 53 | # The optional escape is because any non-open-bracket character may | ||||
| 54 | # appear as the regular expression delimiter. | ||||
| 55 | if ( my $accept = $tokenizer->find_regexp( | ||||
| 56 | qr{ \A \\? \? \( }smx ) ) { | ||||
| 57 | |||||
| 58 | # Leave the left paren, since it belongs to the condition. | ||||
| 59 | --$accept; | ||||
| 60 | |||||
| 61 | $tokenizer->expect( qw{ | ||||
| 62 | PPIx::Regexp::Token::Condition | ||||
| 63 | } ); | ||||
| 64 | |||||
| 65 | return $accept; | ||||
| 66 | |||||
| 67 | } | ||||
| 68 | |||||
| 69 | return; | ||||
| 70 | |||||
| 71 | } | ||||
| 72 | |||||
| 73 | =end comment | ||||
| 74 | |||||
| 75 | =cut | ||||
| 76 | |||||
| 77 | sub __defining_string { | ||||
| 78 | return ( | ||||
| 79 | { suffix => '(' }, | ||||
| 80 | '?', | ||||
| 81 | ); | ||||
| 82 | } | ||||
| 83 | |||||
| 84 | sub __match_setup { | ||||
| 85 | my ( $class, $tokenizer ) = @_; | ||||
| 86 | $tokenizer->expect( qw{ PPIx::Regexp::Token::Condition } ); | ||||
| 87 | return; | ||||
| 88 | } | ||||
| 89 | |||||
| 90 | |||||
| 91 | 1 | 3µs | 1; | ||
| 92 | |||||
| 93 | __END__ |