| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Token/Unknown.pm |
| Statements | Executed 10 statements in 197µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 12µs | 24µs | PPIx::Regexp::Token::Unknown::BEGIN@35 |
| 1 | 1 | 1 | 9µs | 42µs | PPIx::Regexp::Token::Unknown::BEGIN@62 |
| 1 | 1 | 1 | 7µs | 12µs | PPIx::Regexp::Token::Unknown::BEGIN@36 |
| 1 | 1 | 1 | 7µs | 61µs | PPIx::Regexp::Token::Unknown::BEGIN@38 |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::Unknown::__PPIX_LEXER__finalize |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::Unknown::__PPIX_TOKEN__post_make |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::Unknown::can_be_quantified |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Token::Unknown::ordinal |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | =head1 NAME | ||||
| 2 | |||||
| 3 | PPIx::Regexp::Token::Unknown - Represent an unknown token | ||||
| 4 | |||||
| 5 | =head1 SYNOPSIS | ||||
| 6 | |||||
| 7 | use PPIx::Regexp::Dumper; | ||||
| 8 | PPIx::Regexp::Dumper->new( 'xyzzy' ) | ||||
| 9 | ->print(); | ||||
| 10 | |||||
| 11 | =head1 INHERITANCE | ||||
| 12 | |||||
| 13 | C<PPIx::Regexp::Token::Unknown> is a | ||||
| 14 | L<PPIx::Regexp::Token|PPIx::Regexp::Token>. | ||||
| 15 | |||||
| 16 | C<PPIx::Regexp::Token::Unknown> has no descendants. | ||||
| 17 | |||||
| 18 | =head1 DESCRIPTION | ||||
| 19 | |||||
| 20 | This token represents something that could not be identified by the | ||||
| 21 | tokenizer. Sometimes the lexer can fix these up, but the presence of one | ||||
| 22 | of these in a finished parse represents something in the regular | ||||
| 23 | expression that was not understood. | ||||
| 24 | |||||
| 25 | =head1 METHODS | ||||
| 26 | |||||
| 27 | This class provides the following public methods. Methods not documented | ||||
| 28 | here are private, and unsupported in the sense that the author reserves | ||||
| 29 | the right to change or remove them without notice. | ||||
| 30 | |||||
| 31 | =cut | ||||
| 32 | |||||
| 33 | package PPIx::Regexp::Token::Unknown; | ||||
| 34 | |||||
| 35 | 2 | 21µs | 2 | 36µs | # spent 24µs (12+12) within PPIx::Regexp::Token::Unknown::BEGIN@35 which was called:
# once (12µs+12µs) by PPIx::Regexp::Tokenizer::BEGIN@40 at line 35 # spent 24µs making 1 call to PPIx::Regexp::Token::Unknown::BEGIN@35
# spent 12µs making 1 call to strict::import |
| 36 | 2 | 21µs | 2 | 17µs | # spent 12µs (7+5) within PPIx::Regexp::Token::Unknown::BEGIN@36 which was called:
# once (7µs+5µs) by PPIx::Regexp::Tokenizer::BEGIN@40 at line 36 # spent 12µs making 1 call to PPIx::Regexp::Token::Unknown::BEGIN@36
# spent 5µs making 1 call to warnings::import |
| 37 | |||||
| 38 | 2 | 85µs | 2 | 114µs | # spent 61µs (7+54) within PPIx::Regexp::Token::Unknown::BEGIN@38 which was called:
# once (7µs+54µs) by PPIx::Regexp::Tokenizer::BEGIN@40 at line 38 # spent 61µs making 1 call to PPIx::Regexp::Token::Unknown::BEGIN@38
# spent 54µs making 1 call to base::import |
| 39 | |||||
| 40 | 1 | 600ns | our $VERSION = '0.036'; | ||
| 41 | |||||
| 42 | # Return true if the token can be quantified, and false otherwise | ||||
| 43 | sub can_be_quantified { return }; | ||||
| 44 | |||||
| 45 | =head2 ordinal | ||||
| 46 | |||||
| 47 | This method returns the results of the ord built-in on the content | ||||
| 48 | (meaning, of course, the first character of the content). No attempt is | ||||
| 49 | made to interpret the content, since after all this B<is> the unknown | ||||
| 50 | token. | ||||
| 51 | |||||
| 52 | =cut | ||||
| 53 | |||||
| 54 | sub ordinal { | ||||
| 55 | my ( $self ) = @_; | ||||
| 56 | return ord $self->content(); | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | sub __PPIX_TOKEN__post_make { | ||||
| 60 | my ( $self, $tokenizer, $arg ) = @_; | ||||
| 61 | my $msg = $arg->{error}; | ||||
| 62 | 2 | 68µs | 2 | 75µs | # spent 42µs (9+33) within PPIx::Regexp::Token::Unknown::BEGIN@62 which was called:
# once (9µs+33µs) by PPIx::Regexp::Tokenizer::BEGIN@40 at line 62 # spent 42µs making 1 call to PPIx::Regexp::Token::Unknown::BEGIN@62
# spent 33µs making 1 call to Exporter::import |
| 63 | defined $msg | ||||
| 64 | or Carp::cluck( 'Making unknown token with no error message' ); | ||||
| 65 | defined $msg | ||||
| 66 | or $msg = 'Unspecified error'; | ||||
| 67 | $self->{error} = $msg; | ||||
| 68 | return; | ||||
| 69 | } | ||||
| 70 | |||||
| 71 | # Since the lexer does not count these on the way in (because it needs | ||||
| 72 | # the liberty to rebless them into a known class if it figures out what | ||||
| 73 | # is going on) we count them as failures at the finalization step. | ||||
| 74 | sub __PPIX_LEXER__finalize { | ||||
| 75 | return 1; | ||||
| 76 | } | ||||
| 77 | |||||
| 78 | 1 | 2µs | 1; | ||
| 79 | |||||
| 80 | __END__ |