Acme-Comment
view release on metacpan or search on metacpan
lib/Acme/Comment.pm view on Meta::CPAN
=head1 NAME
Acme::Comment
=head1 SYNOPSIS
use Acme::Comment type=>'C++', own_line=>1;
/*
if (ref $mod) {
$bar->{do}->blat(msg => 'blarg');
eval {
i'm sooo sick of this time for some coffee
*/
// I prefer beer. --sqrn
=head1 DESCRIPTION
Acme::Comment allows multi-line comments which are filtered out.
Unlike the pseudo multi-line comment C<if (0) {}>, the code being
commented out need not be syntactically valid.
=head1 USE
Acme::Comment contains several different commenting styles.
Styles may be specified by the C<types> argument, or by C<start> and
C<end> and manipulated with C<own_line> and C<one_line>.
Styles may contain multi-line comments and single-line comments.
Perl, for example, has single-line comments in the form of C<#>.
C, on the other hand, has multi-line comments which begin with
C</*> and end with C<*/>.
With multi-line comments, leaving out a begin or an end comment
will cause an error.
Both types of comments may only be preceded on a line by whitespace.
=head2 own_line
By default, C<own_line> is true, which means that multi-line comments may not
be followed by any characters other than whitespace on the same line.
This is the safest option if you think your code may contain the
comment characters (perhaps in a regex). If you disable it, other
characters are allowed on the line after the starting delimiter, but these
characters will be ignored. The closing delimiter cannot be followed by
any other characters.
Thus, in the following example, C<$foo> would be set to 1.
/* This is my real comment.
*/
$foo = 1;
If you wish to change this option, you must specify either a C<type> or
C<start> and C<end>.
=head2 one_line
By default, this is set to false, which means that multi-line comments
may not end on the same line in which they begin. Turning this on
allows the following syntax:
/* comment */
If you wish to change this option, you must specify either a C<type> or
C<start> and C<end>.
=head2 C<start> and C<end>
The C<start> and C<end> arguments allow you to supply your own commenting
pattern instead of one of the ones available with C<type>. It is not
valid to provide the same pattern for both C<start> and C<end>.
You cannot specify both C<type> and C<start> and C<end>, and C<start>
and C<end> must both be provided if you provide one of them.
=head2 types
The C<types> argument specifies what language style should be used.
Only one language style may be specified.
=over 4
=item * Ada
Single-line comments begin with C<'>.
=item * Advsys
Advsys single-line comments begin with C<;>.
=item * Alan
Single-line comments start with C<-->.
=item * Algol
Multi-line comments begin with C<'comment'> and end with C<;>.
NOTE: You should not use Algol with C<own_line> set to 0:
The source filter will take a C<;> to be an ending tag for your
comments, regardless of where it is.
=item * AWK
Single-line comments use C<#>.
=item * B
Multi-line comments use C</*> and C<*/>.
=item * Basic
Single-line comments begin with C<'>.
=item * Beta
Multi-line comments use C<(*> and C<*)>.
=item * Bliss
Multi-line comments use C<(*> and C<*)>.
=item * Blue
Single-line comments use either C<==> or C<-->.
=item * C
The default for Acme::Comment is C-style multi-line commenting
with C</*> and C<*/>. However, if you wish to change C<one_line>
or C<own_line>, you must explicitly specify the type.
=item * C++
C++ multi-line style uses C</*> and C<*/>. Single-line uses C<//>.
=item * C#
C# multi-line style uses C</*> and C<*/>. Single-line uses C<//>.
=item * Chill
Multi-line comments use C</*> and C<*/>.
=item * Clean
Clean multi-line style uses C</*> and C<*/>. Single-line uses C<//>.
=item * E
Single-line comments use C<#>.
=item * Eiffel
Single-line comments start with C<-->.
=item * Elastic
Elastic multi-line style uses C</*> and C<*/>. Single-line uses C<//>.
=item * Focal
Single-line comments start with C<comment>.
=item * Fortran
Single-line comments use C<!>.
=item * Guile
Guile multi-line style uses C</*> and C<*/>. Single-line uses C<//>.
=item * Haskell
Single-line comments start with C<-->.
=item * HTML
HTML style has multi-line commenting in the form of C<E<lt>!--> and
C<--E<gt>>.
=item * Hugo
Multi-line comments begin with C<!\> and end with C<\!>. Single-line
comments are not implemented due to their similarity with multi-line
comments.
=item * Icon
Single-line comments use C<#>.
( run in 1.760 second using v1.01-cache-2.11-cpan-39bf76dae61 )