line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MDOM::Token::Comment; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
MDOM::Token::Comment - A comment in Makefile source code |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 INHERITANCE |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
MDOM::Token::Comment |
12
|
|
|
|
|
|
|
isa MDOM::Token |
13
|
|
|
|
|
|
|
isa MDOM::Element |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# This is a MDOM::Token::Comment |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
foo: bar # So is this one |
20
|
|
|
|
|
|
|
echo 'hello' |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
In MDOM, comments are represented by C objects. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
These come in two flavours, line comment and inline comments. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
A C is a comment that stands on its own line. These comments |
29
|
|
|
|
|
|
|
hold their own newline and whitespace (both leading and trailing) as part |
30
|
|
|
|
|
|
|
of the one C object. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
An inline comment is a comment that appears after some code, and |
33
|
|
|
|
|
|
|
continues to the end of the line. This does B include whitespace, |
34
|
|
|
|
|
|
|
and the terminating newlines is considered a separate |
35
|
|
|
|
|
|
|
L token. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This is largely a convenience, simplifying a lot of normal code relating |
38
|
|
|
|
|
|
|
to the common things people do with comments. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Most commonly, it means when you C or C a comment, a line |
41
|
|
|
|
|
|
|
comment disappears taking the entire line with it, and an inline comment |
42
|
|
|
|
|
|
|
is removed from the inside of the line, allowing the newline to drop |
43
|
|
|
|
|
|
|
back onto the end of the code, as you would expect. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
It also means you can move comments around in blocks much more easily. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
For now, this is a suitably handy way to do things. However, I do reserve |
48
|
|
|
|
|
|
|
the right to change my mind on this one if it gets dangerously |
49
|
|
|
|
|
|
|
anachronistic somewhere down the line. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 METHODS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Only very limited methods are available, beyond those provided by our |
54
|
|
|
|
|
|
|
parent L and L classes. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
17
|
|
|
17
|
|
75
|
use strict; |
|
17
|
|
|
|
|
25
|
|
|
17
|
|
|
|
|
572
|
|
59
|
17
|
|
|
17
|
|
69
|
use base 'MDOM::Token'; |
|
17
|
|
|
|
|
20
|
|
|
17
|
|
|
|
|
226
|
|
60
|
|
|
|
|
|
|
|
61
|
17
|
|
|
17
|
|
100
|
use vars qw{$VERSION}; |
|
17
|
|
|
|
|
26
|
|
|
17
|
|
|
|
|
842
|
|
62
|
|
|
|
|
|
|
BEGIN { |
63
|
17
|
|
|
17
|
|
1319
|
$VERSION = '0.008'; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
### XS -> MDOM/XS.xs:_MDOM_Token_Comment__significant 0.900+ |
67
|
14
|
|
|
14
|
1
|
32
|
sub significant { '' } |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 line |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
The C accessor returns true if the C is a |
74
|
|
|
|
|
|
|
line comment, or false if it is an inline comment. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub line { |
79
|
|
|
|
|
|
|
# Entire line comments have a newline at the end |
80
|
0
|
0
|
|
0
|
1
|
|
$_[0]->{content} =~ /\n$/ ? 1 : 0; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=pod |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 SUPPORT |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
See the L in the main module. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHOR |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 COPYRIGHT |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Copyright 2001 - 2006 Adam Kennedy. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This program is free software; you can redistribute |
100
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The full text of the license can be found in the |
103
|
|
|
|
|
|
|
LICENSE file included with this module. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |