Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Token/Whitespace.pm |
Statements | Executed 10 statements in 197µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 12µs | 24µs | BEGIN@35 | PPIx::Regexp::Token::Whitespace::
1 | 1 | 1 | 11µs | 16µs | BEGIN@36 | PPIx::Regexp::Token::Whitespace::
1 | 1 | 1 | 7µs | 30µs | BEGIN@40 | PPIx::Regexp::Token::Whitespace::
1 | 1 | 1 | 7µs | 60µs | BEGIN@38 | PPIx::Regexp::Token::Whitespace::
0 | 0 | 0 | 0s | 0s | __PPIX_TOKEN__post_make | PPIx::Regexp::Token::Whitespace::
0 | 0 | 0 | 0s | 0s | can_be_quantified | PPIx::Regexp::Token::Whitespace::
0 | 0 | 0 | 0s | 0s | perl_version_introduced | PPIx::Regexp::Token::Whitespace::
0 | 0 | 0 | 0s | 0s | significant | PPIx::Regexp::Token::Whitespace::
0 | 0 | 0 | 0s | 0s | whitespace | PPIx::Regexp::Token::Whitespace::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | =head1 NAME | ||||
2 | |||||
3 | PPIx::Regexp::Token::Whitespace - Represent whitespace | ||||
4 | |||||
5 | =head1 SYNOPSIS | ||||
6 | |||||
7 | use PPIx::Regexp::Dumper; | ||||
8 | PPIx::Regexp::Dumper->new( 'qr{ foo }smx' ) | ||||
9 | ->print(); | ||||
10 | |||||
11 | =head1 INHERITANCE | ||||
12 | |||||
13 | C<PPIx::Regexp::Token::Whitespace> is a | ||||
14 | L<PPIx::Regexp::Token|PPIx::Regexp::Token>. | ||||
15 | |||||
16 | C<PPIx::Regexp::Token::Whitespace> has no descendants. | ||||
17 | |||||
18 | =head1 DESCRIPTION | ||||
19 | |||||
20 | This class represents whitespace. It will appear inside the regular | ||||
21 | expression only if the /x modifier is present, but it may also appear | ||||
22 | between the type and the opening delimiter (e.g. C<qr {foo}>) or after | ||||
23 | the regular expression in a bracketed substitution (e.g. C<s{foo} | ||||
24 | {bar}>). | ||||
25 | |||||
26 | =head1 METHODS | ||||
27 | |||||
28 | This class provides no public methods beyond those provided by its | ||||
29 | superclass. | ||||
30 | |||||
31 | =cut | ||||
32 | |||||
33 | package PPIx::Regexp::Token::Whitespace; | ||||
34 | |||||
35 | 2 | 20µs | 2 | 36µs | # spent 24µs (12+12) within PPIx::Regexp::Token::Whitespace::BEGIN@35 which was called:
# once (12µs+12µs) by PPIx::Regexp::Tokenizer::BEGIN@41 at line 35 # spent 24µs making 1 call to PPIx::Regexp::Token::Whitespace::BEGIN@35
# spent 12µs making 1 call to strict::import |
36 | 2 | 21µs | 2 | 21µs | # spent 16µs (11+5) within PPIx::Regexp::Token::Whitespace::BEGIN@36 which was called:
# once (11µs+5µs) by PPIx::Regexp::Tokenizer::BEGIN@41 at line 36 # spent 16µs making 1 call to PPIx::Regexp::Token::Whitespace::BEGIN@36
# spent 5µs making 1 call to warnings::import |
37 | |||||
38 | 2 | 26µs | 2 | 112µs | # spent 60µs (7+53) within PPIx::Regexp::Token::Whitespace::BEGIN@38 which was called:
# once (7µs+53µs) by PPIx::Regexp::Tokenizer::BEGIN@41 at line 38 # spent 60µs making 1 call to PPIx::Regexp::Token::Whitespace::BEGIN@38
# spent 53µs making 1 call to base::import |
39 | |||||
40 | 2 | 127µs | 2 | 53µs | # spent 30µs (7+23) within PPIx::Regexp::Token::Whitespace::BEGIN@40 which was called:
# once (7µs+23µs) by PPIx::Regexp::Tokenizer::BEGIN@41 at line 40 # spent 30µs making 1 call to PPIx::Regexp::Token::Whitespace::BEGIN@40
# spent 23µs making 1 call to Exporter::import |
41 | |||||
42 | 1 | 600ns | our $VERSION = '0.036'; | ||
43 | |||||
44 | sub perl_version_introduced { | ||||
45 | my ( $self ) = @_; | ||||
46 | return $self->{perl_version_introduced}; | ||||
47 | } | ||||
48 | |||||
49 | sub significant { | ||||
50 | return; | ||||
51 | } | ||||
52 | |||||
53 | sub whitespace { | ||||
54 | return 1; | ||||
55 | } | ||||
56 | |||||
57 | # Return true if the token can be quantified, and false otherwise | ||||
58 | sub can_be_quantified { return }; | ||||
59 | |||||
60 | # Objects of this class are generated either by the tokenizer itself | ||||
61 | # (when scanning for delimiters) or by PPIx::Regexp::Token::Literal (if | ||||
62 | # it hits a match for \s and finds the regular expression has the /x | ||||
63 | # modifier asserted. | ||||
64 | |||||
65 | =begin comment | ||||
66 | |||||
67 | sub __PPIX_TOKENIZER__regexp { | ||||
68 | my ( $class, $tokenizer, $character ) = @_; | ||||
69 | |||||
70 | return scalar $tokenizer->find_regexp( qr{ \A \s+ }smx ); | ||||
71 | |||||
72 | } | ||||
73 | |||||
74 | =end comment | ||||
75 | |||||
76 | =cut | ||||
77 | |||||
78 | sub __PPIX_TOKEN__post_make { | ||||
79 | my ( $self, $tokenizer, $arg ) = @_; | ||||
80 | |||||
81 | $self->{perl_version_introduced} = MINIMUM_PERL; | ||||
82 | |||||
83 | # RT #91798. | ||||
84 | # TODO the above needs to be replaced by the following (suitably | ||||
85 | # modified) when the non-ASCII white space characters are finally | ||||
86 | # recognized by Perl. | ||||
87 | |||||
88 | =begin comment | ||||
89 | |||||
90 | if ( ord $self->content() < 128 ) { | ||||
91 | $self->{perl_version_introduced} = MINIMUM_PERL; | ||||
92 | } elsif ( $tokenizer && $tokenizer->cookie( COOKIE_REGEX_SET ) ) { | ||||
93 | $self->{perl_version_introduced} = '5.017008'; | ||||
94 | } else { | ||||
95 | $self->{perl_version_introduced} = '5.017009'; | ||||
96 | } | ||||
97 | |||||
98 | =end comment | ||||
99 | |||||
100 | =cut | ||||
101 | |||||
102 | return; | ||||
103 | } | ||||
104 | |||||
105 | 1 | 2µs | 1; | ||
106 | |||||
107 | __END__ |