Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Structure/Code.pm |
Statements | Executed 8 statements in 136µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 12µs | 33µs | BEGIN@37 | PPIx::Regexp::Structure::Code::
1 | 1 | 1 | 11µs | 15µs | BEGIN@38 | PPIx::Regexp::Structure::Code::
1 | 1 | 1 | 7µs | 59µs | BEGIN@40 | PPIx::Regexp::Structure::Code::
0 | 0 | 0 | 0s | 0s | __PPIX_LEXER__finalize | PPIx::Regexp::Structure::Code::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | =head1 NAME | ||||
2 | |||||
3 | PPIx::Regexp::Structure::Code - Represent one of the code structures. | ||||
4 | |||||
5 | =head1 SYNOPSIS | ||||
6 | |||||
7 | use PPIx::Regexp::Dumper; | ||||
8 | PPIx::Regexp::Dumper->new( 'qr{(?{print "hello sailor\n")}smx' ) | ||||
9 | ->print(); | ||||
10 | |||||
11 | =head1 INHERITANCE | ||||
12 | |||||
13 | C<PPIx::Regexp::Structure::Code> is a | ||||
14 | L<PPIx::Regexp::Structure|PPIx::Regexp::Structure>. | ||||
15 | |||||
16 | C<PPIx::Regexp::Structure::Code> has no descendants. | ||||
17 | |||||
18 | =head1 DESCRIPTION | ||||
19 | |||||
20 | This class represents one of the code structures, either | ||||
21 | |||||
22 | (?{ code }) | ||||
23 | |||||
24 | or | ||||
25 | |||||
26 | (??{ code }) | ||||
27 | |||||
28 | =head1 METHODS | ||||
29 | |||||
30 | This class provides no public methods beyond those provided by its | ||||
31 | superclass. | ||||
32 | |||||
33 | =cut | ||||
34 | |||||
35 | package PPIx::Regexp::Structure::Code; | ||||
36 | |||||
37 | 2 | 20µs | 2 | 54µs | # spent 33µs (12+21) within PPIx::Regexp::Structure::Code::BEGIN@37 which was called:
# once (12µs+21µs) by PPIx::Regexp::Lexer::BEGIN@47 at line 37 # spent 33µs making 1 call to PPIx::Regexp::Structure::Code::BEGIN@37
# spent 21µs making 1 call to strict::import |
38 | 2 | 21µs | 2 | 20µs | # spent 15µs (11+4) within PPIx::Regexp::Structure::Code::BEGIN@38 which was called:
# once (11µs+4µs) by PPIx::Regexp::Lexer::BEGIN@47 at line 38 # spent 15µs making 1 call to PPIx::Regexp::Structure::Code::BEGIN@38
# spent 4µs making 1 call to warnings::import |
39 | |||||
40 | 2 | 92µs | 2 | 111µs | # spent 59µs (7+52) within PPIx::Regexp::Structure::Code::BEGIN@40 which was called:
# once (7µs+52µs) by PPIx::Regexp::Lexer::BEGIN@47 at line 40 # spent 59µs making 1 call to PPIx::Regexp::Structure::Code::BEGIN@40
# spent 52µs making 1 call to base::import |
41 | |||||
42 | 1 | 600ns | our $VERSION = '0.036'; | ||
43 | |||||
44 | # The only child of this structure should be a single | ||||
45 | # PPIx::Regexp::Token::Code. Anything else gets turned into the | ||||
46 | # appropriate ::Unknown object. | ||||
47 | sub __PPIX_LEXER__finalize { | ||||
48 | my ( $self ) = @_; | ||||
49 | |||||
50 | my $count; | ||||
51 | my $errors = 0; | ||||
52 | |||||
53 | foreach my $kid ( $self->children() ) { | ||||
54 | |||||
55 | if ( $kid->isa( 'PPIx::Regexp::Token::Code' ) ) { | ||||
56 | $count++ | ||||
57 | or next; | ||||
58 | $errors++; | ||||
59 | $kid->__error( | ||||
60 | 'Code structure can contain only one code token' ); | ||||
61 | } else { | ||||
62 | |||||
63 | $errors++; | ||||
64 | |||||
65 | $kid->__error( | ||||
66 | 'Code structure may not contain a ' . ref $kid ); | ||||
67 | } | ||||
68 | |||||
69 | } | ||||
70 | return $errors; | ||||
71 | } | ||||
72 | |||||
73 | 1 | 2µs | 1; | ||
74 | |||||
75 | __END__ |