| File-Comments documentation | Contained in the File-Comments distribution. |
File::Comments::Plugin::JavaScript - Plugin to detect comments in JavaScript source code
use File::Comments::Plugin::JavaScript;
File::Comments::Plugin::JavaScript is a plugin for the File::Comments framework.
// style comments are recognized.
This is not a full-blown C parser/preprocessor yet, so it gets easily confused (e.g. if c strings contain comment sequences).
Copyright 2005 by Mike Schilli, all rights reserved. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
2005, Mike Schilli <cpan@perlmeister.com>
| File-Comments documentation | Contained in the File-Comments distribution. |
########################################### # File::Comments::Plugin::JavaScript # 2005, Mike Schilli <cpan@perlmeister.com> ########################################### ########################################### package File::Comments::Plugin::JavaScript; ########################################### use strict; use warnings; use File::Comments::Plugin::C; our @ISA = qw(File::Comments::Plugin::C); use Log::Log4perl qw(:easy); ########################################### sub init { ########################################### my($self) = @_; $self->register_suffix(".js"); } ########################################### sub type { ########################################### my($self, $target) = @_; return "javascript"; } ########################################### sub comments { ########################################### my($self, $target) = @_; return $self->extract_c_comments($target); } ########################################### sub extract_double_slash_comments { # NOT USED ANYMORE, WE'RE USING C COMMENTS ########################################### my($self, $target) = @_; my @comments = (); while($target->{content} =~ m#^\s*//(.*) #mxg) { push @comments, $1; } return \@comments; } 1; __END__