PPI/Token/ArrayIndex.pm

filter: Statementstmt 100% 18 / 18 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 96.0% 24 / 25 CC 2 SCAR 2.9
CC
2
Cov
95%
__TOKENIZER__on_char
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« PPI/Token/Quote/Double.pm ↑ Summary PPI/Token/QuoteLike/Words.pm »
1 package PPI::Token::ArrayIndex;
2  
3 =pod
4  
5 =head1 NAME
6  
7 PPI::Token::ArrayIndex - Token getting the last index for an array
8  
9 =head1 INHERITANCE
10  
11 PPI::Token::ArrayIndex
12 isa PPI::Token
13 isa PPI::Element
14  
15 =head1 DESCRIPTION
16  
17 The C<PPI::Token::ArrayIndex> token represents an attempt to get the
18 last index of an array, such as C<$#array>.
19  
20 =head1 METHODS
21  
22 There are no additional methods beyond those provided by the parent
23 L<PPI::Token> and L<PPI::Element> classes.
24  
25 =cut
26  
27 62 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 62 ▶use PPI::Token ();
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 62 ▶use vars qw{$VERSION @ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
31 BEGIN {
32 62 ▶ $VERSION = '1.236';
Subroutine BEGIN: called CC=1 SCAR=0.0
33 62 @ISA = 'PPI::Token';
34 }
35  
36  
37  
38  
39  
40 #####################################################################
41 # Tokenizer Methods
42  
43 sub __TOKENIZER__on_char {
44 97 ▶ my $t = $_[1];
Subroutine __TOKENIZER__on_char: called CC=2 SCAR=7.0
45  
46 # Suck in till the end of the arrayindex
47 97 pos $t->{line} = $t->{line_cursor};
48 97 ▶ if ( $t->{line} =~ m/\G([\w:']+)/gc ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t->{"line"} =~ /\G([\w:']+)/cg) 97 0 97
49 97 $t->{token}->{content} .= $1;
50 97 $t->{line_cursor} += length $1;
51 }
52  
53 # End of token
54 97 $t->_finalize_token->__TOKENIZER__on_char( $t );
55 }
56  
57 62 1;
58  
59 =pod
60  
61 =head1 SUPPORT
62  
63 See the L<support section|PPI/SUPPORT> in the main module.
64  
65 =head1 AUTHOR
66  
67 Adam Kennedy E<lt>adamk@cpan.orgE<gt>
68  
69 =head1 COPYRIGHT
70  
71 Copyright 2001 - 2011 Adam Kennedy.
72  
73 This program is free software; you can redistribute
74 it and/or modify it under the same terms as Perl itself.
75  
76 The full text of the license can be found in the
77 LICENSE file included with this module.
78  
79 =cut
« PPI/Token/Quote/Double.pm ↑ Summary PPI/Token/QuoteLike/Words.pm »