Subject: | Add support for label statements. |
Attached patch adds support for parsing labels:
# tag for 'XYZ' will be generated.
XYZ : {
# do something
}
- Dmitri.
Subject: | perl-tags-label.patch.txt |
--- Tags.pm 21 Jul 2006 18:37:03 -0000 1.3
+++ Tags.pm 21 Jul 2006 18:38:03 -0000 1.4
@@ -400,6 +400,7 @@
$self->can('sub_line'),
$self->can('use_constant'),
$self->can('use_line'),
+ $self->can('label_line'),
);
}
@@ -556,6 +557,28 @@
return @ret;
}
+=item C<label_line>
+
+Parse label declaration.
+
+=cut
+
+sub label_line {
+ my ($self, $line, $statement, $file) = @_;
+ if ($statement=~/^\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*:(?:[^:]|$)/) {
+ return (
+ Perl::Tags::Tag::Label->new(
+ name => $1,
+ file => $file,
+ line => $line,
+ linenum => $.,
+ )
+ );
+ }
+
+ return;
+}
+
=back
=head1 C<Perl::Tags::Tag>
@@ -754,6 +777,17 @@
sub type { 'c' }
+=head1 C<Perl::Tags::Tag::Label>
+
+=head2 C<type>: l
+
+=cut
+
+package Perl::Tags::Tag::Label;
+our @ISA = qw/Perl::Tags::Tag/;
+
+sub type { 'l' }
+
=head1 C<Perl::Tags::Tag::Recurse>
=head2 C<type>: dummy