File Coverage

blib/lib/PPI/Token/ArrayIndex.pm
Criterion Covered Total %
statement 12 12 100.0
branch 1 2 50.0
condition n/a
subroutine 3 3 100.0
pod n/a
total 16 17 94.1


line stmt bran cond sub pod time code
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 67     67   334 use strict;
  67         105  
  67         1907  
28 67     67   252 use PPI::Token ();
  67         94  
  67         18743  
29              
30             our $VERSION = '1.284';
31              
32             our @ISA = "PPI::Token";
33              
34              
35              
36              
37              
38             #####################################################################
39             # Tokenizer Methods
40              
41             sub __TOKENIZER__on_char {
42 94     94   120 my $t = $_[1];
43              
44             # Suck in till the end of the arrayindex
45 94         312 pos $t->{line} = $t->{line_cursor};
46 94 50       394 if ( $t->{line} =~ m/\G([\w:']+)/gc ) {
47 94         561 $t->{token}->{content} .= $1;
48 94         180 $t->{line_cursor} += length $1;
49             }
50              
51             # End of token
52 94         208 $t->_finalize_token->__TOKENIZER__on_char( $t );
53             }
54              
55             1;
56              
57             =pod
58              
59             =head1 SUPPORT
60              
61             See the L<support section|PPI/SUPPORT> in the main module.
62              
63             =head1 AUTHOR
64              
65             Adam Kennedy E<lt>adamk@cpan.orgE<gt>
66              
67             =head1 COPYRIGHT
68              
69             Copyright 2001 - 2011 Adam Kennedy.
70              
71             This program is free software; you can redistribute
72             it and/or modify it under the same terms as Perl itself.
73              
74             The full text of the license can be found in the
75             LICENSE file included with this module.
76              
77             =cut