← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:13 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Token/Condition.pm
StatementsExecuted 11 statements in 349µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11131µs31µsPPIx::Regexp::Token::Condition::::CORE:regcompPPIx::Regexp::Token::Condition::CORE:regcomp (opcode)
11112µs24µsPPIx::Regexp::Token::Condition::::BEGIN@33PPIx::Regexp::Token::Condition::BEGIN@33
1117µs12µsPPIx::Regexp::Token::Condition::::BEGIN@34PPIx::Regexp::Token::Condition::BEGIN@34
1117µs26µsPPIx::Regexp::Token::Condition::::BEGIN@38PPIx::Regexp::Token::Condition::BEGIN@38
1116µs60µsPPIx::Regexp::Token::Condition::::BEGIN@36PPIx::Regexp::Token::Condition::BEGIN@36
4115µs5µsPPIx::Regexp::Token::Condition::::CORE:qrPPIx::Regexp::Token::Condition::CORE:qr (opcode)
0000s0sPPIx::Regexp::Token::Condition::::__PPIX_TOKENIZER__regexpPPIx::Regexp::Token::Condition::__PPIX_TOKENIZER__regexp
0000s0sPPIx::Regexp::Token::Condition::::__PPIX_TOKEN__recognizePPIx::Regexp::Token::Condition::__PPIX_TOKEN__recognize
0000s0sPPIx::Regexp::Token::Condition::::perl_version_introducedPPIx::Regexp::Token::Condition::perl_version_introduced
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1=head1 NAME
2
3PPIx::Regexp::Token::Condition - Represent the condition of 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
13C<PPIx::Regexp::Token::Condition> is a
14L<PPIx::Regexp::Token::Reference|PPIx::Regexp::Token::Reference>.
15
16C<PPIx::Regexp::Token::Condition> has no descendants.
17
18=head1 DESCRIPTION
19
20This class represents the condition portion of a switch or conditional
21expression, provided that condition is reasonably represented as a
22token.
23
24=head1 METHODS
25
26This class provides no public methods beyond those provided by its
27superclass.
28
29=cut
30
31package PPIx::Regexp::Token::Condition;
32
33220µs235µs
# spent 24µs (12+12) within PPIx::Regexp::Token::Condition::BEGIN@33 which was called: # once (12µs+12µs) by PPIx::Regexp::Tokenizer::BEGIN@22 at line 33
use strict;
# spent 24µs making 1 call to PPIx::Regexp::Token::Condition::BEGIN@33 # spent 12µs making 1 call to strict::import
34221µs216µs
# spent 12µs (7+5) within PPIx::Regexp::Token::Condition::BEGIN@34 which was called: # once (7µs+5µs) by PPIx::Regexp::Tokenizer::BEGIN@22 at line 34
use warnings;
# spent 12µs making 1 call to PPIx::Regexp::Token::Condition::BEGIN@34 # spent 5µs making 1 call to warnings::import
35
36225µs2113µs
# spent 60µs (6+54) within PPIx::Regexp::Token::Condition::BEGIN@36 which was called: # once (6µs+54µs) by PPIx::Regexp::Tokenizer::BEGIN@22 at line 36
use base qw{ PPIx::Regexp::Token::Reference };
# spent 60µs making 1 call to PPIx::Regexp::Token::Condition::BEGIN@36 # spent 54µs making 1 call to base::import
37
382220µs246µs
# spent 26µs (7+19) within PPIx::Regexp::Token::Condition::BEGIN@38 which was called: # once (7µs+19µs) by PPIx::Regexp::Tokenizer::BEGIN@22 at line 38
use PPIx::Regexp::Constant qw{ RE_CAPTURE_NAME };
# spent 26µs making 1 call to PPIx::Regexp::Token::Condition::BEGIN@38 # spent 19µs making 1 call to Exporter::import
39
401600nsour $VERSION = '0.036';
41
42sub perl_version_introduced {
43 my ( $self ) = @_;
44 $self->content() =~ m/ \A [(] \d+ [)] \z /smx
45 and return '5.005';
46 return '5.009005';
47}
48
49my @recognize = (
50 [ qr{ \A \( (?: ( \d+ ) | R (\d+) ) \) }smx,
51 { is_named => 0 } ],
52 [ qr{ \A \( R \) }smx,
53 { is_named => 0, capture => '0' } ],
54158µs536µs [ qr{ \A \( (?: < ( @{[ RE_CAPTURE_NAME ]} ) > |
# spent 31µs making 1 call to PPIx::Regexp::Token::Condition::CORE:regcomp # spent 5µs making 4 calls to PPIx::Regexp::Token::Condition::CORE:qr, avg 1µs/call
55 ' ( @{[ RE_CAPTURE_NAME ]} ) ' |
56 R & ( @{[ RE_CAPTURE_NAME ]} ) ) \) }smxo,
57 { is_named => 1} ],
58 [ qr{ \A \( DEFINE \) }smx,
59 { is_named => 0, capture => '0' } ],
60);
61
62# This must be implemented by tokens which do not recognize themselves.
63# The return is a list of list references. Each list reference must
64# contain a regular expression that recognizes the token, and optionally
65# a reference to a hash to pass to make_token as the class-specific
66# arguments. The regular expression MUST be anchored to the beginning of
67# the string.
68sub __PPIX_TOKEN__recognize {
69 return @recognize;
70}
71
72
73# Return true if the token can be quantified, and false otherwise
74# sub can_be_quantified { return };
75
76sub __PPIX_TOKENIZER__regexp {
77 my ( $class, $tokenizer, $character ) = @_;
78
79 foreach ( @recognize ) {
80 my ( $re, $arg ) = @{ $_ };
81 my $accept = $tokenizer->find_regexp( $re ) or next;
82 return $tokenizer->make_token( $accept, __PACKAGE__, $arg );
83 }
84
85 return;
86}
87
8816µs1;
89
90__END__
 
# spent 5µs within PPIx::Regexp::Token::Condition::CORE:qr which was called 4 times, avg 1µs/call: # 4 times (5µs+0s) by PPIx::Regexp::Tokenizer::BEGIN@22 at line 54, avg 1µs/call
sub PPIx::Regexp::Token::Condition::CORE:qr; # opcode
# spent 31µs within PPIx::Regexp::Token::Condition::CORE:regcomp which was called: # once (31µs+0s) by PPIx::Regexp::Tokenizer::BEGIN@22 at line 54
sub PPIx::Regexp::Token::Condition::CORE:regcomp; # opcode