| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Structure/CharClass.pm |
| Statements | Executed 10 statements in 197µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 12µs | 23µs | PPIx::Regexp::Structure::CharClass::BEGIN@32 |
| 1 | 1 | 1 | 11µs | 15µs | PPIx::Regexp::Structure::CharClass::BEGIN@33 |
| 1 | 1 | 1 | 7µs | 28µs | PPIx::Regexp::Structure::CharClass::BEGIN@37 |
| 1 | 1 | 1 | 7µs | 56µs | PPIx::Regexp::Structure::CharClass::BEGIN@35 |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Structure::CharClass::__PPIX_LEXER__record_capture_number |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Structure::CharClass::_new |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Structure::CharClass::negated |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | =head1 NAME | ||||
| 2 | |||||
| 3 | PPIx::Regexp::Structure::CharClass - Represent a character class | ||||
| 4 | |||||
| 5 | =head1 SYNOPSIS | ||||
| 6 | |||||
| 7 | use PPIx::Regexp::Dumper; | ||||
| 8 | PPIx::Regexp::Dumper->new( 'qr{[fo]}smx' ) | ||||
| 9 | ->print(); | ||||
| 10 | |||||
| 11 | =head1 INHERITANCE | ||||
| 12 | |||||
| 13 | C<PPIx::Regexp::Structure::CharClass> is a | ||||
| 14 | L<PPIx::Regexp::Structure|PPIx::Regexp::Structure>. | ||||
| 15 | |||||
| 16 | C<PPIx::Regexp::Structure::CharClass> has no descendants. | ||||
| 17 | |||||
| 18 | =head1 DESCRIPTION | ||||
| 19 | |||||
| 20 | This class represents a square-bracketed character class. | ||||
| 21 | |||||
| 22 | =head1 METHODS | ||||
| 23 | |||||
| 24 | This class provides the following public methods. Methods not documented | ||||
| 25 | here are private, and unsupported in the sense that the author reserves | ||||
| 26 | the right to change or remove them without notice. | ||||
| 27 | |||||
| 28 | =cut | ||||
| 29 | |||||
| 30 | package PPIx::Regexp::Structure::CharClass; | ||||
| 31 | |||||
| 32 | 2 | 19µs | 2 | 35µs | # spent 23µs (12+12) within PPIx::Regexp::Structure::CharClass::BEGIN@32 which was called:
# once (12µs+12µs) by PPIx::Regexp::Lexer::BEGIN@49 at line 32 # spent 23µs making 1 call to PPIx::Regexp::Structure::CharClass::BEGIN@32
# spent 12µs making 1 call to strict::import |
| 33 | 2 | 21µs | 2 | 20µs | # spent 15µs (11+4) within PPIx::Regexp::Structure::CharClass::BEGIN@33 which was called:
# once (11µs+4µs) by PPIx::Regexp::Lexer::BEGIN@49 at line 33 # spent 15µs making 1 call to PPIx::Regexp::Structure::CharClass::BEGIN@33
# spent 4µs making 1 call to warnings::import |
| 34 | |||||
| 35 | 2 | 25µs | 2 | 105µs | # spent 56µs (7+49) within PPIx::Regexp::Structure::CharClass::BEGIN@35 which was called:
# once (7µs+49µs) by PPIx::Regexp::Lexer::BEGIN@49 at line 35 # spent 56µs making 1 call to PPIx::Regexp::Structure::CharClass::BEGIN@35
# spent 49µs making 1 call to base::import |
| 36 | |||||
| 37 | 2 | 129µs | 2 | 49µs | # spent 28µs (7+21) within PPIx::Regexp::Structure::CharClass::BEGIN@37 which was called:
# once (7µs+21µs) by PPIx::Regexp::Lexer::BEGIN@49 at line 37 # spent 28µs making 1 call to PPIx::Regexp::Structure::CharClass::BEGIN@37
# spent 21µs making 1 call to Exporter::import |
| 38 | |||||
| 39 | 1 | 500ns | our $VERSION = '0.036'; | ||
| 40 | |||||
| 41 | sub _new { | ||||
| 42 | my ( $class, @args ) = @_; | ||||
| 43 | ref $class and $class = ref $class; | ||||
| 44 | my %brkt; | ||||
| 45 | $brkt{finish} = pop @args; | ||||
| 46 | $brkt{start} = shift @args; | ||||
| 47 | __instance( $args[0], 'PPIx::Regexp::Token::Operator' ) | ||||
| 48 | and $args[0]->content() eq '^' | ||||
| 49 | and $brkt{type} = shift @args; | ||||
| 50 | return $class->SUPER::_new( \%brkt, @args ); | ||||
| 51 | } | ||||
| 52 | |||||
| 53 | =head2 negated | ||||
| 54 | |||||
| 55 | $class->negated() and print "Class is negated\n"; | ||||
| 56 | |||||
| 57 | This method returns true if the character class is negated -- that is, | ||||
| 58 | if the first token inside the left square bracket is a caret (C<^>). | ||||
| 59 | |||||
| 60 | =cut | ||||
| 61 | |||||
| 62 | sub negated { | ||||
| 63 | my ( $self ) = @_; | ||||
| 64 | return $self->type() ? 1 : 0; | ||||
| 65 | } | ||||
| 66 | |||||
| 67 | # Called by the lexer to record the capture number. | ||||
| 68 | sub __PPIX_LEXER__record_capture_number { | ||||
| 69 | my ( $self, $number ) = @_; | ||||
| 70 | return $number; | ||||
| 71 | } | ||||
| 72 | |||||
| 73 | 1 | 2µs | 1; | ||
| 74 | |||||
| 75 | __END__ |