Perl::Tags::ClassDot


Class-Dot documentation Contained in the Class-Dot distribution.

Index


Code Index:

# Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 78 # End: # vim: expandtab tabstop=4 shiftwidth=4 shiftround


Class-Dot documentation Contained in the Class-Dot distribution.

# $Id$
# $Source$
# $Author$
# $HeadURL$
# $Revision$
# $Date$
package Perl::Tags::ClassDot;

use strict;
use warnings;
use vars qw(@ISA $VERSION);
use version; $VERSION = qv('1.5.0');
use 5.00600;

@ISA = qw(Perl::Tags::Naive); ## no critic

use Perl::Tags;
use Data::Dumper;
use English qw(-no_match_vars);
use Perl::Tags::ClassDot::Tag::Property;

my $RE_PROPERTY = qr/
        ^\s*
                property\s*\(?
                        (.+?) (?:\)|\s+|$|;)
                                (?:\=\>\s*(.+))$
/xms;

sub get_parsers {
   my $self = shift;
   return (
      $self->can('property_line'),
      $self->SUPER::get_parsers()
   );
}

sub property_line {

# has to be put before 'trim' parser, otherwise the comment line will have gone!
   my ( $self, $line, $statement, $file ) = @_;

   return if not defined $statement;
   if ($statement =~ $RE_PROPERTY) {
      my ($name, $type) = ( q{}, 'isa_Anything' );
      if (defined $1) {
        $name = $1;
      };
      if (defined $2) {
        $type = $2;
      }

      $type =~ s/^isa_/is /xms;
      $type =~ s/\;$//xms;

      return Perl::Tags::ClassDot::Tag::Property->new(
         name    => "$name $type",
         file    => $file,
         line    => $line,
         linenum => $INPUT_LINE_NUMBER,
      );
   }
   return;
}

1;

__END__

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 78
# End:
# vim: expandtab tabstop=4 shiftwidth=4 shiftround