| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Structure/BranchReset.pm |
| Statements | Executed 10 statements in 202µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 15µs | 26µs | PPIx::Regexp::Structure::BranchReset::BEGIN@32 |
| 1 | 1 | 1 | 8µs | 12µs | PPIx::Regexp::Structure::BranchReset::BEGIN@33 |
| 1 | 1 | 1 | 7µs | 30µs | PPIx::Regexp::Structure::BranchReset::BEGIN@37 |
| 1 | 1 | 1 | 7µs | 57µs | PPIx::Regexp::Structure::BranchReset::BEGIN@35 |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Structure::BranchReset::__PPIX_LEXER__record_capture_number |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | =head1 NAME | ||||
| 2 | |||||
| 3 | PPIx::Regexp::Structure::BranchReset - Represent a branch reset group | ||||
| 4 | |||||
| 5 | =head1 SYNOPSIS | ||||
| 6 | |||||
| 7 | use PPIx::Regexp::Dumper; | ||||
| 8 | PPIx::Regexp::Dumper->new( 'qr{(?|(foo)|(bar))}smx' ) | ||||
| 9 | ->print(); | ||||
| 10 | |||||
| 11 | =head1 INHERITANCE | ||||
| 12 | |||||
| 13 | C<PPIx::Regexp::Structure::BranchReset> is a | ||||
| 14 | L<PPIx::Regexp::Structure|PPIx::Regexp::Structure>. | ||||
| 15 | |||||
| 16 | C<PPIx::Regexp::Structure::BranchReset> has no descendants. | ||||
| 17 | |||||
| 18 | =head1 DESCRIPTION | ||||
| 19 | |||||
| 20 | This class represents a branch reset group. That is, the construction | ||||
| 21 | C<(?|(...)|(...)|...)>. This is new with Perl 5.010. | ||||
| 22 | |||||
| 23 | =head1 METHODS | ||||
| 24 | |||||
| 25 | This class provides no public methods beyond those provided by its | ||||
| 26 | superclass. | ||||
| 27 | |||||
| 28 | =cut | ||||
| 29 | |||||
| 30 | package PPIx::Regexp::Structure::BranchReset; | ||||
| 31 | |||||
| 32 | 2 | 20µs | 2 | 38µs | # spent 26µs (15+12) within PPIx::Regexp::Structure::BranchReset::BEGIN@32 which was called:
# once (15µs+12µs) by PPIx::Regexp::Lexer::BEGIN@46 at line 32 # spent 26µs making 1 call to PPIx::Regexp::Structure::BranchReset::BEGIN@32
# spent 12µs making 1 call to strict::import |
| 33 | 2 | 21µs | 2 | 17µs | # spent 12µs (8+5) within PPIx::Regexp::Structure::BranchReset::BEGIN@33 which was called:
# once (8µs+5µs) by PPIx::Regexp::Lexer::BEGIN@46 at line 33 # spent 12µs making 1 call to PPIx::Regexp::Structure::BranchReset::BEGIN@33
# spent 5µs making 1 call to warnings::import |
| 34 | |||||
| 35 | 2 | 32µs | 2 | 106µs | # spent 57µs (7+50) within PPIx::Regexp::Structure::BranchReset::BEGIN@35 which was called:
# once (7µs+50µs) by PPIx::Regexp::Lexer::BEGIN@46 at line 35 # spent 57µs making 1 call to PPIx::Regexp::Structure::BranchReset::BEGIN@35
# spent 50µs making 1 call to base::import |
| 36 | |||||
| 37 | 2 | 126µs | 2 | 53µs | # spent 30µs (7+23) within PPIx::Regexp::Structure::BranchReset::BEGIN@37 which was called:
# once (7µs+23µs) by PPIx::Regexp::Lexer::BEGIN@46 at line 37 # spent 30µs making 1 call to PPIx::Regexp::Structure::BranchReset::BEGIN@37
# spent 23µs making 1 call to Exporter::import |
| 38 | |||||
| 39 | 1 | 600ns | our $VERSION = '0.036'; | ||
| 40 | |||||
| 41 | # Called by the lexer to record the capture number. | ||||
| 42 | sub __PPIX_LEXER__record_capture_number { | ||||
| 43 | my ( $self, $number ) = @_; | ||||
| 44 | defined $number | ||||
| 45 | or confess 'Programming error - initial $number is undef'; | ||||
| 46 | my $original = $number; | ||||
| 47 | my $hiwater = $number; | ||||
| 48 | foreach my $kid ( $self->children() ) { | ||||
| 49 | if ( $kid->isa( 'PPIx::Regexp::Token::Operator' ) | ||||
| 50 | && $kid->content() eq '|' ) { | ||||
| 51 | $number > $hiwater and $hiwater = $number; | ||||
| 52 | $number = $original; | ||||
| 53 | } else { | ||||
| 54 | $number = $kid->__PPIX_LEXER__record_capture_number( $number ); | ||||
| 55 | } | ||||
| 56 | } | ||||
| 57 | return $number > $hiwater ? $number : $hiwater; | ||||
| 58 | } | ||||
| 59 | |||||
| 60 | 1 | 2µs | 1; | ||
| 61 | |||||
| 62 | __END__ |