← 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:14 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Token/GroupType/NamedCapture.pm
StatementsExecuted 14 statements in 601µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11135µs35µsPPIx::Regexp::Token::GroupType::NamedCapture::::CORE:regcompPPIx::Regexp::Token::GroupType::NamedCapture::CORE:regcomp (opcode)
11129µs124µsPPIx::Regexp::Token::GroupType::NamedCapture::::BEGIN@48PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@48
11116µs32µsPPIx::Regexp::Token::GroupType::NamedCapture::::BEGIN@37PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@37
11110µs17µsPPIx::Regexp::Token::GroupType::NamedCapture::::BEGIN@38PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@38
11110µs35µsPPIx::Regexp::Token::GroupType::NamedCapture::::BEGIN@44PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@44
11110µs39µsPPIx::Regexp::Token::GroupType::NamedCapture::::BEGIN@42PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@42
1119µs77µsPPIx::Regexp::Token::GroupType::NamedCapture::::BEGIN@40PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@40
1112µs2µsPPIx::Regexp::Token::GroupType::NamedCapture::::CORE:qrPPIx::Regexp::Token::GroupType::NamedCapture::CORE:qr (opcode)
0000s0sPPIx::Regexp::Token::GroupType::NamedCapture::::__PPIX_TOKEN__post_makePPIx::Regexp::Token::GroupType::NamedCapture::__PPIX_TOKEN__post_make
0000s0sPPIx::Regexp::Token::GroupType::NamedCapture::::__make_group_type_matcherPPIx::Regexp::Token::GroupType::NamedCapture::__make_group_type_matcher
0000s0sPPIx::Regexp::Token::GroupType::NamedCapture::::namePPIx::Regexp::Token::GroupType::NamedCapture::name
0000s0sPPIx::Regexp::Token::GroupType::NamedCapture::::perl_version_introducedPPIx::Regexp::Token::GroupType::NamedCapture::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::GroupType::NamedCapture - Represent a named capture
4
5=head1 SYNOPSIS
6
7 use PPIx::Regexp::Dumper;
8 PPIx::Regexp::Dumper->new( 'qr{(?<baz>foo)}smx' )
9 ->print();
10
11=head1 INHERITANCE
12
13C<PPIx::Regexp::Token::GroupType::NamedCapture> is a
14L<PPIx::Regexp::Token::GroupType|PPIx::Regexp::Token::GroupType>.
15
16C<PPIx::Regexp::Token::GroupType::NamedCapture> has no descendants.
17
18=head1 DESCRIPTION
19
20This class represents a named capture specification. Its content will be
21something like one of the following:
22
23 ?<NAME>
24 ?'NAME'
25 ?P<NAME>
26
27=head1 METHODS
28
29This class provides the following public methods. Methods not documented
30here are private, and unsupported in the sense that the author reserves
31the right to change or remove them without notice.
32
33=cut
34
35package PPIx::Regexp::Token::GroupType::NamedCapture;
36
37233µs248µs
# spent 32µs (16+16) within PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@37 which was called: # once (16µs+16µs) by PPIx::Regexp::Tokenizer::BEGIN@30 at line 37
use strict;
# spent 32µs making 1 call to PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@37 # spent 16µs making 1 call to strict::import
38233µs223µs
# spent 17µs (10+6) within PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@38 which was called: # once (10µs+6µs) by PPIx::Regexp::Tokenizer::BEGIN@30 at line 38
use warnings;
# spent 17µs making 1 call to PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@38 # spent 6µs making 1 call to warnings::import
39
40235µs2146µs
# spent 77µs (9+68) within PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@40 which was called: # once (9µs+68µs) by PPIx::Regexp::Tokenizer::BEGIN@30 at line 40
use base qw{ PPIx::Regexp::Token::GroupType };
# spent 77µs making 1 call to PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@40 # spent 68µs making 1 call to base::import
41
42235µs269µs
# spent 39µs (10+30) within PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@42 which was called: # once (10µs+30µs) by PPIx::Regexp::Tokenizer::BEGIN@30 at line 42
use Carp qw{ confess };
# spent 39µs making 1 call to PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@42 # spent 30µs making 1 call to Exporter::import
43
44274µs260µs
# spent 35µs (10+25) within PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@44 which was called: # once (10µs+25µs) by PPIx::Regexp::Tokenizer::BEGIN@30 at line 44
use PPIx::Regexp::Constant qw{ RE_CAPTURE_NAME };
# spent 35µs making 1 call to PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@44 # spent 25µs making 1 call to Exporter::import
45
461800nsour $VERSION = '0.036';
47
48
# spent 124µs (29+95) within PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@48 which was called: # once (29µs+95µs) by PPIx::Regexp::Tokenizer::BEGIN@30 at line 50
use constant NAMED_CAPTURE =>
491300ns qr{ \A \\? \? (?: P? < ( @{[ RE_CAPTURE_NAME ]} ) \\? > |
501389µs4220µs \\? ' ( @{[ RE_CAPTURE_NAME ]} ) \\? ' ) }smxo;
# spent 124µs making 1 call to PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@48 # spent 58µs making 1 call to constant::import # spent 35µs making 1 call to PPIx::Regexp::Token::GroupType::NamedCapture::CORE:regcomp # spent 2µs making 1 call to PPIx::Regexp::Token::GroupType::NamedCapture::CORE:qr
51
52# Return true if the token can be quantified, and false otherwise
53# sub can_be_quantified { return };
54
55=head2 name
56
57This method returns the name of the capture.
58
59=cut
60
61sub name {
62 my ( $self ) = @_;
63 return $self->{name};
64}
65
66sub perl_version_introduced {
67 return '5.009005';
68}
69
70sub __PPIX_TOKEN__post_make {
71 my ( $self, $tokenizer ) = @_;
72 if ( $tokenizer ) {
73 foreach my $name ( $tokenizer->capture() ) {
74 defined $name or next;
75 $self->{name} = $name;
76 return;
77 }
78 } else {
79 foreach my $name (
80 $self->content() =~ m/ @{[ NAMED_CAPTURE ]} /smxo ) {
81 defined $name or next;
82 $self->{name} = $name;
83 return;
84 }
85 }
86
87 confess 'Programming error - can not figure out capture name';
88}
89
90=begin comment
91
92sub __PPIX_TOKENIZER__regexp {
93 my ( $class, $tokenizer, $character ) = @_;
94
95 # The optional escapes are because any of the non-open-bracket
96 # punctuation characters may be the expression delimiter.
97 if ( my $accept = $tokenizer->find_regexp( NAMED_CAPTURE ) ) {
98 return $accept;
99 }
100
101 return;
102}
103
104=end comment
105
106=cut
107
108sub __make_group_type_matcher {
109 return {
110 '' => [
111 qr/ \A [?] P? < ( @{[ RE_CAPTURE_NAME ]} ) > /smxo,
112 qr/ \A [?] ' ( @{[ RE_CAPTURE_NAME ]} ) ' /smxo,
113 ],
114 '?' => [
115 qr/ \A \\ [?] P? < ( @{[ RE_CAPTURE_NAME ]} ) > /smxo,
116 qr/ \A \\ [?] ' ( @{[ RE_CAPTURE_NAME ]} ) ' /smxo,
117 ],
118 q{'} => [
119 qr/ \A [?] P? < ( @{[ RE_CAPTURE_NAME ]} ) > /smxo,
120 qr/ \A [?] \\ ' ( @{[ RE_CAPTURE_NAME ]} ) \\ ' /smxo,
121 ],
122 };
123}
124
12513µs1;
126
127__END__
 
# spent 2µs within PPIx::Regexp::Token::GroupType::NamedCapture::CORE:qr which was called: # once (2µs+0s) by PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@48 at line 50
sub PPIx::Regexp::Token::GroupType::NamedCapture::CORE:qr; # opcode
# spent 35µs within PPIx::Regexp::Token::GroupType::NamedCapture::CORE:regcomp which was called: # once (35µs+0s) by PPIx::Regexp::Token::GroupType::NamedCapture::BEGIN@48 at line 50
sub PPIx::Regexp::Token::GroupType::NamedCapture::CORE:regcomp; # opcode