← 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/CharClass/POSIX.pm
StatementsExecuted 12 statements in 254µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11118µs23µsPPIx::Regexp::Token::CharClass::POSIX::::BEGIN@40PPIx::Regexp::Token::CharClass::POSIX::BEGIN@40
11113µs25µsPPIx::Regexp::Token::CharClass::POSIX::::BEGIN@39PPIx::Regexp::Token::CharClass::POSIX::BEGIN@39
1119µs39µsPPIx::Regexp::Token::CharClass::POSIX::::BEGIN@44PPIx::Regexp::Token::CharClass::POSIX::BEGIN@44
1118µs334µsPPIx::Regexp::Token::CharClass::POSIX::::BEGIN@42PPIx::Regexp::Token::CharClass::POSIX::BEGIN@42
0000s0sPPIx::Regexp::Token::CharClass::POSIX::::__PPIX_TOKENIZER__regexpPPIx::Regexp::Token::CharClass::POSIX::__PPIX_TOKENIZER__regexp
0000s0sPPIx::Regexp::Token::CharClass::POSIX::::perl_version_introducedPPIx::Regexp::Token::CharClass::POSIX::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::CharClass::POSIX - Represent a POSIX character class
4
5=head1 SYNOPSIS
6
7 use PPIx::Regexp::Dumper;
8 PPIx::Regexp::Dumper->new( 'qr{ [[:alpha:]] }smx' )
9 ->print();
10
11=head1 INHERITANCE
12
13C<PPIx::Regexp::Token::CharClass::POSIX> is a
14L<PPIx::Regexp::Token::CharClass|PPIx::Regexp::Token::CharClass>.
15
16C<PPIx::Regexp::Token::CharClass::POSIX> is the parent of
17L<PPIx::Regexp::Token::CharClass::POSIX::Unknown|PPIx::Regexp::Token::CharClass::POSIX::Unknown>.
18
19=head1 DESCRIPTION
20
21This class represents a POSIX character class. It will only be
22recognized within a character class.
23
24Note that collating symbols (e.g. C<[.ch.]>) and equivalence classes
25(e.g. C<[=a=]>) are valid in the POSIX standard, but are not valid in
26Perl regular expressions. These end up being represented by
27L<PPIx::Regexp::Token::CharClass::POSIX::Unknown|PPIx::Regexp::Token::CharClass::POSIX::Unknown>,
28and are considered a parse failure.
29
30=head1 METHODS
31
32This class provides the following public methods beyond those provided
33by its superclass.
34
35=cut
36
37package PPIx::Regexp::Token::CharClass::POSIX;
38
39230µs237µs
# spent 25µs (13+12) within PPIx::Regexp::Token::CharClass::POSIX::BEGIN@39 which was called: # once (13µs+12µs) by PPIx::Regexp::Tokenizer::BEGIN@17 at line 39
use strict;
# spent 25µs making 1 call to PPIx::Regexp::Token::CharClass::POSIX::BEGIN@39 # spent 12µs making 1 call to strict::import
40224µs228µs
# spent 23µs (18+5) within PPIx::Regexp::Token::CharClass::POSIX::BEGIN@40 which was called: # once (18µs+5µs) by PPIx::Regexp::Tokenizer::BEGIN@17 at line 40
use warnings;
# spent 23µs making 1 call to PPIx::Regexp::Token::CharClass::POSIX::BEGIN@40 # spent 5µs making 1 call to warnings::import
41
42227µs2660µs
# spent 334µs (8+326) within PPIx::Regexp::Token::CharClass::POSIX::BEGIN@42 which was called: # once (8µs+326µs) by PPIx::Regexp::Tokenizer::BEGIN@17 at line 42
use base qw{ PPIx::Regexp::Token::CharClass };
# spent 334µs making 1 call to PPIx::Regexp::Token::CharClass::POSIX::BEGIN@42 # spent 326µs making 1 call to base::import
43
442167µs269µs
# spent 39µs (9+30) within PPIx::Regexp::Token::CharClass::POSIX::BEGIN@44 which was called: # once (9µs+30µs) by PPIx::Regexp::Tokenizer::BEGIN@17 at line 44
use PPIx::Regexp::Constant qw{ COOKIE_CLASS COOKIE_REGEX_SET MINIMUM_PERL };
# spent 39µs making 1 call to PPIx::Regexp::Token::CharClass::POSIX::BEGIN@44 # spent 30µs making 1 call to Exporter::import
45
461700nsour $VERSION = '0.036';
47
48# Return true if the token can be quantified, and false otherwise
49# sub can_be_quantified { return };
50
51##=head2 is_case_sensitive
52##
53##This override of the superclass method of the same name returns true if
54##the character class is C<[:lower:]> or C<[:upper:]>, and false (but
55##defined) for all other POSIX character classes.
56##
57##=cut
58##
59##{
60## my %case_sensitive = map { $_ => 1 } qw{ [:lower:] [:upper:] };
61##
62## sub is_case_sensitive {
63## my ( $self ) = @_;
64## return $case_sensitive{ $self->content() } || 0;
65## }
66##}
67
68sub perl_version_introduced {
69# my ( $self ) = @_;
70 return '5.006';
71}
72
73{
74
7522µs my %class = (
76 ':' => __PACKAGE__,
77 );
78
79 sub __PPIX_TOKENIZER__regexp {
80 my ( $class, $tokenizer, $character ) = @_;
81
82 $tokenizer->cookie( COOKIE_CLASS )
83 or $tokenizer->cookie( COOKIE_REGEX_SET )
84 or return;
85
86 if ( my $accept = $tokenizer->find_regexp(
87 qr{ \A [[] ( [.=:] ) \^? .*? \1 []] }smx ) ) {
88 my ( $punc ) = $tokenizer->capture();
89 return $tokenizer->make_token( $accept,
90 $class{$punc} || __PACKAGE__ . '::Unknown' );
91 }
92
93 return;
94
95 }
96
97}
98
9913µs1;
100
101__END__