Acme-Comment
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
FOCAL => {
single => "comment",
},
LATEX => {
single => "%",
},
FOXBASE => {
single => '(?:\*)|(?:&&)',
}
};
### the comment styles for ADA and Basic are the same ###
for my $type(qw|ADA|) { $Conf->{$type} = $Conf->{'BASIC'} }
for my $type(qw|POSTSCRIPT|) { $Conf->{$type} = $Conf->{'LATEX'} }
for my $type(qw|ADVSYS LISP SCHEME|) { $Conf->{$type} = $Conf->{'ORTHOGONAL'} }
for my $type(qw|EIFFEL HASKELL|) { $Conf->{$type} = $Conf->{'ALAN'} }
for my $type(qw|BETA BLISS JOY VAR'AQ|) { $Conf->{$type} = $Conf->{'PASCAL'} }
lib/Acme/Comment.pm view on Meta::CPAN
},
LATEX => {
single => quotemeta "%",
},
FOXBASE => {
single => '(?:\*)|(?:&&)',
}
};
### the comment styles for ADA and Basic are the same ###
for my $type(qw|ADA|) { $Conf->{$type} = $Conf->{'BASIC'} }
for my $type(qw|POSTSCRIPT|) { $Conf->{$type} = $Conf->{'LATEX'} }
for my $type(qw|ADVSYS LISP SCHEME|) { $Conf->{$type} = $Conf->{'ORTHOGONAL'} }
for my $type(qw|EIFFEL HASKELL|) { $Conf->{$type} = $Conf->{'ALAN'} }
for my $type(qw|BETA BLISS JOY VAR'AQ|) { $Conf->{$type} = $Conf->{'PASCAL'} }
lib/Acme/Comment.pm view on Meta::CPAN
}
sub import {
my $package = shift;
my %args = @_;
if(@_%2){
die "Incomplete set of arguments to $package\n"
}
### see if there are any arguments, if not, we default to the C comment style ###
if( keys %args ) {
### check if the user requested a certain type of comments ###
if( $args{type} ) {
### and check if it even exists ###
if( $Conf->{ uc $args{type} } ) {
$Type = uc $args{type};
$Conf->{$Type}->{own_line} = $args{own_line} if defined $args{own_line};
lib/Acme/Comment.pm view on Meta::CPAN
$Conf->{$TypeCount}->{own_line} = defined $args{own_line}
? $args{own_line}
: 1;
$Conf->{$TypeCount}->{one_line} = defined $args{one_line}
? $args{one_line}
: 0;
}
### no arguments, Let's take the default C comment style ###
}
}
sub parse {
#use Data::Dumper;
#print scalar @_;
#die Dumper \@_;
my $str = shift;
lib/Acme/Comment.pm view on Meta::CPAN
// 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<*/>.
lib/Acme/Comment.pm view on Meta::CPAN
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<;>.
lib/Acme/Comment.pm view on Meta::CPAN
=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<#>.
=item * Intercal
Single-line comments are marked with C<DO NOTE THAT> and may optionally
be preceded by a line number in the following syntax:
C<(23) DO NOTE THAT>.
=item * Java
Java multi-line style uses C</*> and C<*/>. Single-line uses C<//>.
=item * Joy
Multi-line comments use C<(*> and C<*)>.
=item * LaTeX
Single-line comments use C<%>.
=item * LISP
lib/Acme/Comment.pm view on Meta::CPAN
=item * Pascal
Multi-line comments use C<(*> and C<*)>.
=item * Perl
Single-line comments use C<#>.
=item * PHP
PHP multi-line style uses C</*> and C<*/>. Single-line uses C<//>.
=item * Pilot
Single-line comments in the syntax C<\/\/> are supported.
=item * PL/I
Multi-line comments use C</*> and C<*/>.
=item * PostScript
( run in 1.466 second using v1.01-cache-2.11-cpan-49f99fa48dc )