Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Token.pm |
Statements | Executed 8 statements in 206µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 12µs | 24µs | BEGIN@48 | PPIx::Regexp::Token::
1 | 1 | 1 | 8µs | 62µs | BEGIN@51 | PPIx::Regexp::Token::
1 | 1 | 1 | 7µs | 12µs | BEGIN@49 | PPIx::Regexp::Token::
0 | 0 | 0 | 0s | 0s | __PPIX_LEXER__finalize | PPIx::Regexp::Token::
0 | 0 | 0 | 0s | 0s | __PPIX_TOKEN__post_make | PPIx::Regexp::Token::
0 | 0 | 0 | 0s | 0s | _new | PPIx::Regexp::Token::
0 | 0 | 0 | 0s | 0s | content | PPIx::Regexp::Token::
0 | 0 | 0 | 0s | 0s | unescaped_content | PPIx::Regexp::Token::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | =head1 NAME | ||||
2 | |||||
3 | PPIx::Regexp::Token - Base class for PPIx::Regexp tokens. | ||||
4 | |||||
5 | =head1 SYNOPSIS | ||||
6 | |||||
7 | use PPIx::Regexp::Dumper; | ||||
8 | PPIx::Regexp::Dumper->new( 'qr{foo}' )->print(); | ||||
9 | |||||
10 | =head1 INHERITANCE | ||||
11 | |||||
12 | C<PPIx::Regexp::Token> is a | ||||
13 | L<PPIx::Regexp::Element|PPIx::Regexp::Element>. | ||||
14 | |||||
15 | C<PPIx::Regexp::Token> is the parent of | ||||
16 | L<PPIx::Regexp::Token::Assertion|PPIx::Regexp::Token::Assertion>, | ||||
17 | L<PPIx::Regexp::Token::Backtrack|PPIx::Regexp::Token::Backtrack>, | ||||
18 | L<PPIx::Regexp::Token::CharClass|PPIx::Regexp::Token::CharClass>, | ||||
19 | L<PPIx::Regexp::Token::Code|PPIx::Regexp::Token::Code>, | ||||
20 | L<PPIx::Regexp::Token::Comment|PPIx::Regexp::Token::Comment>, | ||||
21 | L<PPIx::Regexp::Token::Control|PPIx::Regexp::Token::Control>, | ||||
22 | L<PPIx::Regexp::Token::Greediness|PPIx::Regexp::Token::Greediness>, | ||||
23 | L<PPIx::Regexp::Token::GroupType|PPIx::Regexp::Token::GroupType>, | ||||
24 | L<PPIx::Regexp::Token::Literal|PPIx::Regexp::Token::Literal>, | ||||
25 | L<PPIx::Regexp::Token::Modifier|PPIx::Regexp::Token::Modifier>, | ||||
26 | L<PPIx::Regexp::Token::Operator|PPIx::Regexp::Token::Operator>, | ||||
27 | L<PPIx::Regexp::Token::Quantifier|PPIx::Regexp::Token::Quantifier>, | ||||
28 | L<PPIx::Regexp::Token::Reference|PPIx::Regexp::Token::Reference>, | ||||
29 | L<PPIx::Regexp::Token::Structure|PPIx::Regexp::Token::Structure>, | ||||
30 | L<PPIx::Regexp::Token::Unknown|PPIx::Regexp::Token::Unknown>, | ||||
31 | L<PPIx::Regexp::Token::Unmatched|PPIx::Regexp::Token::Unmatched> and | ||||
32 | L<PPIx::Regexp::Token::Whitespace|PPIx::Regexp::Token::Whitespace>. | ||||
33 | |||||
34 | =head1 DESCRIPTION | ||||
35 | |||||
36 | This class represents the base of the class hierarchy for tokens in the | ||||
37 | L<PPIx::Regexp|PPIx::Regexp> package. | ||||
38 | |||||
39 | =head1 METHODS | ||||
40 | |||||
41 | This class provides no public methods beyond those provided by its | ||||
42 | superclass. | ||||
43 | |||||
44 | =cut | ||||
45 | |||||
46 | package PPIx::Regexp::Token; | ||||
47 | |||||
48 | 2 | 20µs | 2 | 36µs | # spent 24µs (12+12) within PPIx::Regexp::Token::BEGIN@48 which was called:
# once (12µs+12µs) by base::import at line 48 # spent 24µs making 1 call to PPIx::Regexp::Token::BEGIN@48
# spent 12µs making 1 call to strict::import |
49 | 2 | 21µs | 2 | 16µs | # spent 12µs (7+5) within PPIx::Regexp::Token::BEGIN@49 which was called:
# once (7µs+5µs) by base::import at line 49 # spent 12µs making 1 call to PPIx::Regexp::Token::BEGIN@49
# spent 5µs making 1 call to warnings::import |
50 | |||||
51 | 2 | 161µs | 2 | 62µs | # spent 62µs (8+55) within PPIx::Regexp::Token::BEGIN@51 which was called:
# once (8µs+55µs) by base::import at line 51 # spent 62µs making 1 call to PPIx::Regexp::Token::BEGIN@51
# spent 55µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 55µs |
52 | |||||
53 | 1 | 600ns | our $VERSION = '0.036'; | ||
54 | |||||
55 | sub _new { | ||||
56 | my ( $class, $content ) = @_; | ||||
57 | ref $class and $class = ref $class; | ||||
58 | |||||
59 | my $self = { | ||||
60 | content => $content, | ||||
61 | }; | ||||
62 | |||||
63 | bless $self, $class; | ||||
64 | return $self; | ||||
65 | } | ||||
66 | |||||
67 | sub content { | ||||
68 | my ( $self ) = @_; | ||||
69 | return $self->{content}; | ||||
70 | } | ||||
71 | |||||
72 | sub unescaped_content { | ||||
73 | my ( $self ) = @_; | ||||
74 | my $content = $self->content(); | ||||
75 | $content =~ s/ \\ (?= . ) //smxg; | ||||
76 | return $content; | ||||
77 | } | ||||
78 | |||||
79 | |||||
80 | # Called after the token is manufactured. The calling sequence is | ||||
81 | # $token->__PPIX_TOKEN__post_make( $tokenizer ); | ||||
82 | sub __PPIX_TOKEN__post_make { return }; | ||||
83 | |||||
84 | # Called by the lexer once it has done its worst to all the tokens. | ||||
85 | # Called as a method with no arguments. The return is the number of | ||||
86 | # parse failures discovered when finalizing. | ||||
87 | sub __PPIX_LEXER__finalize { | ||||
88 | return 0; | ||||
89 | } | ||||
90 | |||||
91 | 1 | 2µs | 1; | ||
92 | |||||
93 | __END__ |