1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
package PPI::Token::End;
# After the __END__ tag
use strict;
use UNIVERSAL 'isa';
use base 'PPI::Token';
use vars qw{$VERSION};
BEGIN {
$VERSION = '0.903';
}
#####################################################################
# Tokenizer Methods
### XS -> PPI/XS.xs:_PPI_Token_End__significant 0.900+
sub significant { '' }
sub _on_char { 1 }
sub _on_line_start {
my $t = $_[1];
# Can we classify the entire line in one go
$_ = $t->{line};
if ( /^=(\w+)/ ) {
# A Pod tag... change to pod mode
$t->_new_token( 'Pod', $_ ) or return undef;
unless ( $1 eq 'cut' ) {
# Normal start to pod
$t->{class} = 'PPI::Token::Pod';
}
# This is an error, but one we'll ignore
# Don't go into Pod mode, since =cut normally
# signals the end of Pod mode
} else {
if ( defined $t->{token} ) {
# Add to existing token
$t->{token}->{content} .= $t->{line};
} else {
$t->_new_token( 'End', $t->{line} );
}
}
0;
}
1;
|