| 1 | package PPI::Token::End; | ||||||||||
| 2 | |||||||||||
| 3 | =pod | ||||||||||
| 4 | |||||||||||
| 5 | =head1 NAME | ||||||||||
| 6 | |||||||||||
| 7 | PPI::Token::End - Completely useless content after the __END__ tag | ||||||||||
| 8 | |||||||||||
| 9 | =head1 INHERITANCE | ||||||||||
| 10 | |||||||||||
| 11 | PPI::Token::End | ||||||||||
| 12 | isa PPI::Token | ||||||||||
| 13 | isa PPI::Element | ||||||||||
| 14 | |||||||||||
| 15 | =head1 DESCRIPTION | ||||||||||
| 16 | |||||||||||
| 17 | If you've read L<PPI::Token::Whitespace>, you should understand by now | ||||||||||
| 18 | the concept of documents "floating in a sea of PPI::Token::Whitespace". | ||||||||||
| 19 | |||||||||||
| 20 | Well it doesn't after the __END__ tag. | ||||||||||
| 21 | |||||||||||
| 22 | Once you __END__, it's all over. Anything after that tag isn't even fit | ||||||||||
| 23 | to be called whitespace. It just simply doesn't exist as far as perl | ||||||||||
| 24 | (the interpreter) is concerned. | ||||||||||
| 25 | |||||||||||
| 26 | That's not to say there isn't useful content. Most often people use | ||||||||||
| 27 | the __END__ tag to hide POD content, so that perl never has to see it, | ||||||||||
| 28 | and presumably providing some small speed up. | ||||||||||
| 29 | |||||||||||
| 30 | That's fine. PPI likes POD. Any POD after the __END__ tag is parsed | ||||||||||
| 31 | into valid L<PPI::Token::Pod> tags as normal. B<This> class, on the | ||||||||||
| 32 | other hand, is for "what's after __END__ when it isn't POD". | ||||||||||
| 33 | |||||||||||
| 34 | Basically, the completely worthless bits of the file :) | ||||||||||
| 35 | |||||||||||
| 36 | =head1 METHODS | ||||||||||
| 37 | |||||||||||
| 38 | This class has no method beyond what is provided by its L<PPI::Token> and | ||||||||||
| 39 | L<PPI::Element> parent classes. | ||||||||||
| 40 | |||||||||||
| 41 | =cut | ||||||||||
| 42 | |||||||||||
| 43 | 62 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 44 | 62 | ▶ | use PPI::Token (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 45 | |||||||||||
| 46 | 62 | ▶ | use vars qw{$VERSION @ISA}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 47 | BEGIN { | ||||||||||
| 48 | 62 | ▶ | $VERSION = '1.236'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 49 | 62 | @ISA = 'PPI::Token'; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | ##################################################################### | ||||||||||
| 57 | # Tokenizer Methods | ||||||||||
| 58 | |||||||||||
| 59 | ### XS -> PPI/XS.xs:_PPI_Token_End__significant 0.900+ | ||||||||||
| 60 | sub significant() { '' } | ||||||||||
| 61 | |||||||||||
| 62 | sub __TOKENIZER__on_char() { 1 } | ||||||||||
| 63 | |||||||||||
| 64 | sub __TOKENIZER__on_line_start { | ||||||||||
| 65 | 13 | ▶ | my $t = $_[1]; | ||||||||
|
Subroutine
__TOKENIZER__on_line_start: called CC=4 SCAR=13.9
| |||||||||||
| 66 | |||||||||||
| 67 | # Can we classify the entire line in one go | ||||||||||
| 68 | 13 | ▶ | if ( $t->{line} =~ /^=(\w+)/ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | # A Pod tag... change to pod mode | ||||||||||
| 70 | 2 | $t->_new_token( 'Pod', $t->{line} ); | |||||||||
| 71 | 2 | ▶ | unless ( $1 eq 'cut' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 72 | # Normal start to pod | ||||||||||
| 73 | 2 | $t->{class} = 'PPI::Token::Pod'; | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | # This is an error, but one we'll ignore | ||||||||||
| 77 | # Don't go into Pod mode, since =cut normally | ||||||||||
| 78 | # signals the end of Pod mode | ||||||||||
| 79 | } else { | ||||||||||
| 80 | 11 | ▶ | if ( defined $t->{token} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 81 | # Add to existing token | ||||||||||
| 82 | 6 | $t->{token}->{content} .= $t->{line}; | |||||||||
| 83 | } else { | ||||||||||
| 84 | 5 | $t->_new_token( 'End', $t->{line} ); | |||||||||
| 85 | } | ||||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 13 | 0; | |||||||||
| 89 | } | ||||||||||
| 90 | |||||||||||
| 91 | 62 | 1; | |||||||||
| 92 | |||||||||||
| 93 | =pod | ||||||||||
| 94 | |||||||||||
| 95 | =head1 SUPPORT | ||||||||||
| 96 | |||||||||||
| 97 | See the L<support section|PPI/SUPPORT> in the main module. | ||||||||||
| 98 | |||||||||||
| 99 | =head1 AUTHOR | ||||||||||
| 100 | |||||||||||
| 101 | Adam Kennedy E<lt>adamk@cpan.orgE<gt> | ||||||||||
| 102 | |||||||||||
| 103 | =head1 COPYRIGHT | ||||||||||
| 104 | |||||||||||
| 105 | Copyright 2001 - 2011 Adam Kennedy. | ||||||||||
| 106 | |||||||||||
| 107 | This program is free software; you can redistribute | ||||||||||
| 108 | it and/or modify it under the same terms as Perl itself. | ||||||||||
| 109 | |||||||||||
| 110 | The full text of the license can be found in the | ||||||||||
| 111 | LICENSE file included with this module. | ||||||||||
| 112 | |||||||||||
| 113 | =cut | ||||||||||