| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Token/Comment.pm |
| Statements | Executed 9 statements in 163µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 12µs | 23µs | PPIx::Regexp::Token::Comment::BEGIN@32 |
| 1 | 1 | 1 | 11µs | 13µs | PPIx::Regexp::Token::Comment::__PPIX_TOKEN__recognize |
| 1 | 1 | 1 | 8µs | 15µs | PPIx::Regexp::Token::Comment::BEGIN@33 |
| 1 | 1 | 1 | 7µs | 58µs | PPIx::Regexp::Token::Comment::BEGIN@35 |
| 1 | 1 | 1 | 2µs | 2µs | PPIx::Regexp::Token::Comment::CORE:qr (opcode) |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::Comment::can_be_quantified |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::Comment::comment |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::Comment::significant |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | =head1 NAME | ||||
| 2 | |||||
| 3 | PPIx::Regexp::Token::Comment - Represent a comment. | ||||
| 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::Token::Comment> is a | ||||
| 14 | L<PPIx::Regexp::Token|PPIx::Regexp::Token>. | ||||
| 15 | |||||
| 16 | C<PPIx::Regexp::Token::Comment> has no descendants. | ||||
| 17 | |||||
| 18 | =head1 DESCRIPTION | ||||
| 19 | |||||
| 20 | This class represents a comment - both parenthesized comments (i.e. | ||||
| 21 | C<< (?# this is a comment ) >> and the /x mode end-of-line comments. | ||||
| 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::Token::Comment; | ||||
| 31 | |||||
| 32 | 2 | 23µs | 2 | 35µs | # spent 23µs (12+12) within PPIx::Regexp::Token::Comment::BEGIN@32 which was called:
# once (12µs+12µs) by PPIx::Regexp::Tokenizer::BEGIN@21 at line 32 # spent 23µs making 1 call to PPIx::Regexp::Token::Comment::BEGIN@32
# spent 12µs making 1 call to strict::import |
| 33 | 2 | 23µs | 2 | 23µs | # spent 15µs (8+7) within PPIx::Regexp::Token::Comment::BEGIN@33 which was called:
# once (8µs+7µs) by PPIx::Regexp::Tokenizer::BEGIN@21 at line 33 # spent 15µs making 1 call to PPIx::Regexp::Token::Comment::BEGIN@33
# spent 8µs making 1 call to warnings::import |
| 34 | |||||
| 35 | 2 | 99µs | 2 | 109µs | # spent 58µs (7+51) within PPIx::Regexp::Token::Comment::BEGIN@35 which was called:
# once (7µs+51µs) by PPIx::Regexp::Tokenizer::BEGIN@21 at line 35 # spent 58µs making 1 call to PPIx::Regexp::Token::Comment::BEGIN@35
# spent 51µs making 1 call to base::import |
| 36 | |||||
| 37 | 1 | 600ns | our $VERSION = '0.036'; | ||
| 38 | |||||
| 39 | # Return true if the token can be quantified, and false otherwise | ||||
| 40 | sub can_be_quantified { return }; | ||||
| 41 | |||||
| 42 | sub significant { | ||||
| 43 | return; | ||||
| 44 | } | ||||
| 45 | |||||
| 46 | sub comment { | ||||
| 47 | return 1; | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | # This must be implemented by tokens which do not recognize themselves. | ||||
| 51 | # The return is a list of list references. Each list reference must | ||||
| 52 | # contain a regular expression that recognizes the token, and optionally | ||||
| 53 | # a reference to a hash to pass to make_token as the class-specific | ||||
| 54 | # arguments. The regular expression MUST be anchored to the beginning of | ||||
| 55 | # the string. | ||||
| 56 | # spent 13µs (11+2) within PPIx::Regexp::Token::Comment::__PPIX_TOKEN__recognize which was called:
# once (11µs+2µs) by base::import at line 102 of PPIx/Regexp/Token/Structure.pm | ||||
| 57 | 1 | 15µs | 1 | 2µs | return ( [ qr{ \A \( \? \# [^\)]* \) }smx ] ); # spent 2µs making 1 call to PPIx::Regexp::Token::Comment::CORE:qr |
| 58 | } | ||||
| 59 | |||||
| 60 | # We anticipate that these tokens will be generated by other classes: | ||||
| 61 | # PPIx::Regexp::Token::Structure for parenthesized comments, and | ||||
| 62 | # PPIx::Regexp::Token::Literal for end-of-line /x mode comments. | ||||
| 63 | |||||
| 64 | =begin comment | ||||
| 65 | |||||
| 66 | sub __PPIX_TOKENIZER__regexp { | ||||
| 67 | my ( $class, $tokenizer, $character ) = @_; | ||||
| 68 | |||||
| 69 | return $character eq 'x' ? 1 : 0; | ||||
| 70 | } | ||||
| 71 | |||||
| 72 | =end comment | ||||
| 73 | |||||
| 74 | =cut | ||||
| 75 | |||||
| 76 | 1 | 2µs | 1; | ||
| 77 | |||||
| 78 | __END__ | ||||
# spent 2µs within PPIx::Regexp::Token::Comment::CORE:qr which was called:
# once (2µs+0s) by PPIx::Regexp::Token::Comment::__PPIX_TOKEN__recognize at line 57 |