| 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 | 63 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 63 | ▶ | use PPI::Token (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | |||||||||||
| 30 | 63 | our $VERSION = '1.260'; # VERSION | |||||||||
| 31 | |||||||||||
| 32 | 63 | our @ISA = "PPI::Token"; | |||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | ##################################################################### | ||||||||||
| 39 | # Tokenizer Methods | ||||||||||
| 40 | |||||||||||
| 41 | sub __TOKENIZER__on_char { | ||||||||||
| 42 | 95 | ▶ | my $t = $_[1]; | ||||||||
|
Subroutine
__TOKENIZER__on_char: called CC=2 SCAR=7.0
| |||||||||||
| 43 | |||||||||||
| 44 | # Suck in till the end of the arrayindex | ||||||||||
| 45 | 95 | pos $t->{line} = $t->{line_cursor}; | |||||||||
| 46 | 95 | ▶ | if ( $t->{line} =~ m/\G([\w:']+)/gc ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 95 | $t->{token}->{content} .= $1; | |||||||||
| 48 | 95 | $t->{line_cursor} += length $1; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | # End of token | ||||||||||
| 52 | 95 | $t->_finalize_token->__TOKENIZER__on_char( $t ); | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 63 | 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 | ||||||||||