[Lxr-commits] CVS: lxr/lib/LXR/Lang Generic.pm,1.14,1.15 Java.pm,1.4,1.5 Perl.pm,1.5,1.6 Python.pm,1
Brought to you by:
ajlittoz
|
From: Dave B. <bro...@us...> - 2004-07-19 19:50:36
|
Update of /cvsroot/lxr/lxr/lib/LXR/Lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7323/lib/LXR/Lang Modified Files: Generic.pm Java.pm Perl.pm Python.pm Log Message: formatting (with eclipse EPIC plugin which uses PerlTidy. options used: line width 100, cuddle else, use tabs, tab-width 4) Index: Generic.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Generic.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Generic.pm 19 Jul 2004 17:33:17 -0000 1.14 +++ Generic.pm 19 Jul 2004 19:50:21 -0000 1.15 @@ -3,7 +3,7 @@ # $Id$ # # Implements generic support for any language that ectags can parse. -# This may not be ideal support, but it should at least work until +# This may not be ideal support, but it should at least work until # someone writes better support. # # This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -35,102 +35,100 @@ @LXR::Lang::Generic::ISA = ('LXR::Lang'); sub new { - my ($proto, $pathname, $release, $lang) = @_; - my $class = ref($proto) || $proto; - my $self = {}; - bless ($self, $class); - $$self{'release'} = $release; - $$self{'language'} = $lang; + my ( $proto, $pathname, $release, $lang ) = @_; + my $class = ref($proto) || $proto; + my $self = {}; + bless( $self, $class ); + $$self{'release'} = $release; + $$self{'language'} = $lang; - read_config() unless defined $generic_config; - %$self = (%$self, %$generic_config); + read_config() unless defined $generic_config; + %$self = ( %$self, %$generic_config ); - # Set langid - $$self{'langid'} = $self->langinfo('langid'); - die "No langid for language $lang" if !defined $self->langid; + # Set langid + $$self{'langid'} = $self->langinfo('langid'); + die "No langid for language $lang" if !defined $self->langid; - return $self; + return $self; } # This is only executed once, saving the overhead of processing the # config file each time. Because it is only done once, we also use # this to check the version of ctags. sub read_config { - open (CONF, $config->genericconf) || die "Can't open ".$config->genericconf.", $!"; - - local($/) = undef; - + open( CONF, $config->genericconf ) || die "Can't open " . $config->genericconf . ", $!"; + + local ($/) = undef; + my $config_contents = <CONF>; - $config_contents =~ /(.*)/s ; $config_contents = $1; #untaint it - $generic_config = eval ("\n#line 1 \"generic.conf\"\n". - $config_contents); - die ($@) if $@; + $config_contents =~ /(.*)/s; + $config_contents = $1; #untaint it + $generic_config = eval( "\n#line 1 \"generic.conf\"\n" . $config_contents ); + die($@) if $@; close CONF; # Setup the ctags to declid mapping my $langmap = $generic_config->{'langmap'}; - foreach my $lang (keys %$langmap) { + foreach my $lang ( keys %$langmap ) { my $typemap = $langmap->{$lang}{'typemap'}; - foreach my $type (keys %$typemap) { - $typemap->{$type} = - $index->getdecid($langmap->{$lang}{'langid'}, - $typemap->{$type}); + foreach my $type ( keys %$typemap ) { + $typemap->{$type} = $index->getdecid( $langmap->{$lang}{'langid'}, $typemap->{$type} ); } } - + my $ctags = $config->ectagsbin; - + $ENV{'PATH'} = '/bin:/usr/local/bin:/usr/bin:/usr/sbin'; my $version = `$ctags --version`; - $version=~ /Exuberant ctags +(\d+)/i; - if($1 < 5 ) { - die "Exuberant ctags version 5 or above required, found $version\n"; + $version =~ /Exuberant ctags +(\d+)/i; + if ( $1 < 5 ) { + die "Exuberant ctags version 5 or above required, found $version\n"; } } sub indexfile { - my ($self, $name, $path, $fileid, $index, $config) = @_; + my ( $self, $name, $path, $fileid, $index, $config ) = @_; + + my $typemap = $self->langinfo('typemap'); + + my $langforce = ${ $self->eclangnamemapping }{ $self->language }; + if ( !defined $langforce ) { + $langforce = $self->language; + } + + if ( $config->ectagsbin ) { + open( CTAGS, + join( " ", + $config->ectagsbin, $self->ectagsopts, "--excmd=number", + "--language-force=$langforce", "-f", "-", $path, "|" ) + ) + or die "Can't run ectags, $!"; + + while (<CTAGS>) { + chomp; + + my ( $sym, $file, $line, $type, $ext ) = split( /\t/, $_ ); + $line =~ s/;\"$//; + $ext =~ /language:(\w+)/; + $type = $typemap->{$type}; + if ( !defined $type ) { + print "Warning: Unknown type ", ( split( /\t/, $_ ) )[3], "\n"; + next; + } + + # TODO: can we make it more generic in parsing the extension fields? + if ( defined($ext) && $ext =~ /^(struct|union|class|enum):(.*)/ ) { + $ext = $2; + $ext =~ s/::<anonymous>//g; + } else { + $ext = undef; + } + + $index->index( $sym, $fileid, $line, $self->langid, $type, $ext ); + } + close(CTAGS); - my $typemap = $self->langinfo('typemap'); - - my $langforce = $ {$self->eclangnamemapping}{$self->language}; - if (!defined $langforce) { - $langforce = $self->language; - } - - if ($config->ectagsbin) { - open(CTAGS, join(" ", $config->ectagsbin, - $self->ectagsopts, - "--excmd=number", - "--language-force=$langforce", - "-f", "-", - $path, "|")) or die "Can't run ectags, $!"; - - while (<CTAGS>) { - chomp; - - my ($sym, $file, $line, $type,$ext) = split(/\t/, $_); - $line =~ s/;\"$//; - $ext =~ /language:(\w+)/; - $type = $typemap->{$type}; - if(!defined $type) { - print "Warning: Unknown type ", (split(/\t/,$_))[3], "\n"; - next; - } - - # TODO: can we make it more generic in parsing the extension fields? - if (defined($ext) && $ext =~ /^(struct|union|class|enum):(.*)/) { - $ext = $2; - $ext =~ s/::<anonymous>//g; - } else { - $ext = undef; - } - - $index->index($sym, $fileid, $line, $self->langid, $type, $ext); } - close(CTAGS); - - } } # This method returns the regexps used by SimpleParse to break the @@ -138,9 +136,9 @@ # Since this depends on the language, it's configured via generic.conf sub parsespec { - my ($self) = @_; - my @spec = $self->langinfo('spec'); - return @spec; + my ($self) = @_; + my @spec = $self->langinfo('spec'); + return @spec; } # Process a chunk of code @@ -153,9 +151,9 @@ # TODO : Make the handling of identifier recognition language dependant sub processcode { - my ($self, $code) = @_; - my ($start, $id); - $$code =~ s {(^|[^\w\#])([\w~][\w]*)\b} + my ( $self, $code ) = @_; + my ( $start, $id ); + $$code =~ s {(^|[^\w\#])([\w~][\w]*)\b} # Replace identifier by link unless it's a reserved word { $1. @@ -171,127 +169,129 @@ # sub referencefile { - my ($self, $name, $path, $fileid, $index, $config) = @_; + my ( $self, $name, $path, $fileid, $index, $config ) = @_; - require LXR::SimpleParse; - # Use dummy tabwidth here since it doesn't matter for referencing - &LXR::SimpleParse::init(new FileHandle($path), 1, $self->parsespec); + require LXR::SimpleParse; - my $linenum = 1; - my ($btype, $frag) = &LXR::SimpleParse::nextfrag; - my @lines; - my $ls; + # Use dummy tabwidth here since it doesn't matter for referencing + &LXR::SimpleParse::init( new FileHandle($path), 1, $self->parsespec ); - while (defined($frag)) { - @lines = ($frag =~ /(.*?\n)/g, $frag =~ /([^\n]*)$/); + my $linenum = 1; + my ( $btype, $frag ) = &LXR::SimpleParse::nextfrag; + my @lines; + my $ls; - if (defined($btype)) { - if ($btype eq 'comment' or $btype eq 'string' or $btype eq 'include') { - $linenum += @lines - 1; - } else { - print "BTYPE was: $btype\n"; - } - } else { - my $l; - my $string; - foreach $l (@lines) { - foreach ($l =~ /(?:^|[^a-zA-Z_\#]) # Non-symbol chars. + while ( defined($frag) ) { + @lines = ( $frag =~ /(.*?\n)/g, $frag =~ /([^\n]*)$/ ); + + if ( defined($btype) ) { + if ( $btype eq 'comment' or $btype eq 'string' or $btype eq 'include' ) { + $linenum += @lines - 1; + } else { + print "BTYPE was: $btype\n"; + } + } else { + my $l; + my $string; + foreach $l (@lines) { + foreach ( + $l =~ /(?:^|[^a-zA-Z_\#]) # Non-symbol chars. (\~?_*[a-zA-Z][a-zA-Z0-9_]*) # The symbol. - \b/ogx) { - $string = $_; -# print "considering $string\n"; - if (!grep(/$string/, $self->langinfo('reserved')) && - $index->issymbol($string)) { -# print "adding $string to references\n"; - $index->reference($string, $fileid, $linenum); - } + \b/ogx + ) + { + $string = $_; - } - - $linenum++; - } - $linenum--; - } - ($btype, $frag) = &LXR::SimpleParse::nextfrag; - } - print("+++ $linenum\n"); -} + # print "considering $string\n"; + if ( !grep( /$string/, $self->langinfo('reserved') ) + && $index->issymbol($string) ) + { + # print "adding $string to references\n"; + $index->reference( $string, $fileid, $linenum ); + } + } + $linenum++; + } + $linenum--; + } + ( $btype, $frag ) = &LXR::SimpleParse::nextfrag; + } + print("+++ $linenum\n"); +} # Autoload magic to allow access using $generic->variable syntax # blatently ripped from Config.pm - I still don't fully understand how # this works. sub variable { - my ($self, $var, $val) = @_; + my ( $self, $var, $val ) = @_; - $self->{variables}{$var}{value} = $val if defined($val); - return $self->{variables}{$var}{value} || - $self->vardefault($var); + $self->{variables}{$var}{value} = $val if defined($val); + return $self->{variables}{$var}{value} + || $self->vardefault($var); } sub varexpand { - my ($self, $exp) = @_; - $exp =~ s/\$\{?(\w+)\}?/$self->variable($1)/ge; + my ( $self, $exp ) = @_; + $exp =~ s/\$\{?(\w+)\}?/$self->variable($1)/ge; - return $exp; + return $exp; } - sub value { - my ($self, $var) = @_; + my ( $self, $var ) = @_; - if (exists($self->{$var})) { - my $val = $self->{$var}; - - if (ref($val) eq 'ARRAY') { - return map { $self->varexpand($_) } @$val; - } elsif (ref($val) eq 'CODE') { - return $val; + if ( exists( $self->{$var} ) ) { + my $val = $self->{$var}; + + if ( ref($val) eq 'ARRAY' ) { + return map { $self->varexpand($_) } @$val; + } elsif ( ref($val) eq 'CODE' ) { + return $val; + } else { + return $self->varexpand($val); + } } else { - return $self->varexpand($val); + return undef; } - } else { - return undef; - } } - sub AUTOLOAD { - my $self = shift; - (my $var = $AUTOLOAD) =~ s/.*:://; + my $self = shift; + ( my $var = $AUTOLOAD ) =~ s/.*:://; - my @val = $self->value($var); - - if (ref($val[0]) eq 'CODE') { - return $val[0]->(@_); - } else { - return wantarray ? @val : $val[0]; - } + my @val = $self->value($var); + + if ( ref( $val[0] ) eq 'CODE' ) { + return $val[0]->(@_); + } else { + return wantarray ? @val : $val[0]; + } } sub langinfo { - my ($self, $item) = @_; - - my $val; - my $map = $self->langmap; - die if !defined $map; - if (exists $$map{$self->language}) { - $val = $$map{$self->language}; - } else { - return undef; - } + my ( $self, $item ) = @_; - if (defined $val && defined $$val{$item}) { - if (ref($$val{$item}) eq 'ARRAY') { - return wantarray ? @{$$val{$item}} : $$val{$item}; - } - return $$val{$item}; - } else { - return undef; - } + my $val; + my $map = $self->langmap; + die if !defined $map; + if ( exists $$map{ $self->language } ) { + $val = $$map{ $self->language }; + } else { + return undef; + } + + if ( defined $val && defined $$val{$item} ) { + if ( ref( $$val{$item} ) eq 'ARRAY' ) { + return wantarray ? @{ $$val{$item} } : $$val{$item}; + } + return $$val{$item}; + } else { + return undef; + } } 1; Index: Java.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Java.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Java.pm 14 Nov 2001 15:27:36 -0000 1.4 +++ Java.pm 19 Jul 2004 19:50:21 -0000 1.5 @@ -21,7 +21,6 @@ package LXR::Lang::Java; - my $CVSID = '$Id$ '; use strict; @@ -32,11 +31,12 @@ @LXR::Lang::Java::ISA = ('LXR::Lang::Generic'); # Only override the include handling. For java, this is really package -# handling, as there is no include mechanism, so deals with "package" +# handling, as there is no include mechanism, so deals with "package" # and "import" keywords sub processinclude { - my ($self, $frag, $dir) = @_; + my ( $self, $frag, $dir ) = @_; + # Deal with package declaration of the form # "package java.lang.util" $$frag =~ s#(package\s+)([\w.]+)# @@ -44,6 +44,7 @@ ($index->issymbol($2, $$self{'release'}) ? join($2, @{$$self{'itag'}}) : $2) #e; + # Deal with import declaration of the form # "import java.awt.*" by providing link to the package $$frag =~ s#(import\s+)([\w.]+)(\.\*)# @@ -51,21 +52,18 @@ ($index->issymbol($2, $$self{'release'}) ? join($2, @{$$self{'itag'}}) : $2) . $3 #e; - - # Deal with import declaration of the form - # "import java.awt.classname" by providing links to the + + # Deal with import declaration of the form + # "import java.awt.classname" by providing links to the # package and the class - $$frag =~ s#(import\s+)([\w.]+)\.(\w+)(\W)# + $$frag =~ s#(import\s+)([\w.]+)\.(\w+)(\W)# $1. ($index->issymbol($2, $$self{'release'}) ? join($2, @{$$self{'itag'}}) : $2) . "." . ($index->issymbol($3, $$self{'release'}) ? join($3, @{$$self{'itag'}}) : $3) . $4#e; - - } - +} 1; - Index: Perl.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Perl.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Perl.pm 18 Mar 2002 14:55:43 -0000 1.5 +++ Perl.pm 19 Jul 2004 19:50:21 -0000 1.6 @@ -11,7 +11,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -34,24 +34,24 @@ @ISA = ('LXR::Lang'); my @spec = ( - 'atom' => ('\$\W?', ''), - 'atom' => ('\\\\.', ''), - 'include' => ('\buse\s+', ';'), - 'include' => ('\brequire\s+', ';'), - 'string' => ('"', '"'), - 'comment' => ('#', "\$"), - 'comment' => ("^=\\w+", "^=cut"), - 'string' => ("'", "'")); - + 'atom' => ( '\$\W?', '' ), + 'atom' => ( '\\\\.', '' ), + 'include' => ( '\buse\s+', ';' ), + 'include' => ( '\brequire\s+', ';' ), + 'string' => ( '"', '"' ), + 'comment' => ( '#', "\$" ), + 'comment' => ( "^=\\w+", "^=cut" ), + 'string' => ( "'", "'" ) +); sub new { - my ($self, $pathname, $release) = @_; + my ( $self, $pathname, $release ) = @_; - $self = bless({}, $self); + $self = bless( {}, $self ); $$self{'release'} = $release; - return $self; + return $self; } sub parsespec { @@ -59,15 +59,15 @@ } sub processcode { - my ($self, $code, @itag) = @_; + my ( $self, $code, @itag ) = @_; my $sym; -# $$code =~ s#([\@\$\%\&\*])([a-z0-9_]+)|\b([a-z0-9_]+)(\s*\()# -# $sym = $2 || $3; -# $1.($index->issymbol($sym, $$self{'release'}) -# ? join($sym, @{$$self{'itag'}}) -# : $sym).$4#geis; - + # $$code =~ s#([\@\$\%\&\*])([a-z0-9_]+)|\b([a-z0-9_]+)(\s*\()# + # $sym = $2 || $3; + # $1.($index->issymbol($sym, $$self{'release'}) + # ? join($sym, @{$$self{'itag'}}) + # : $sym).$4#geis; + $$code =~ s#\b([a-z][a-z0-9_:]*)\b# ($index->issymbol($1, $$self{'release'}) ? join($1, @{$$self{'itag'}}) @@ -75,77 +75,71 @@ } sub modref { - my $mod = shift; + my $mod = shift; my $file = $mod; $file =~ s,::,/,g; $file .= ".pm"; - return &LXR::Common::incref($mod, "include", $file); + return &LXR::Common::incref( $mod, "include", $file ); } sub processinclude { - my ($self, $frag, $dir) = @_; - + my ( $self, $frag, $dir ) = @_; + $$frag =~ s/(use\s+|require\s+)([\w:]+)/$1.modref($2)/e; } sub processcomment { - my ($self, $comm) = @_; + my ( $self, $comm ) = @_; + + if ( $$comm =~ /^=/s ) { - if ($$comm =~ /^=/s) { # Pod text - $$comm = join('', map { - if (/^=head(\d)\s*(.*)/s) { - "<span class=\"pod\"><font size=\"+".(4-$1)."\">$2<\/font></span>"; - } - elsif (/^=item\s*(.*)/s) { - "<span class=\"podhead\">* $1 ". - ("-" x (67 - length($1)))."<\/span>"; - } - elsif (/^=(pod|cut)/s) { - "<span class=\"podhead\">". - ("-" x 70)."<\/span>"; - } - elsif (/^=.*/s) { - ""; - } - else { - if (/^\s/s) { # Verbatim paragraph - s|^(.*)$|<span class="pod"><code>$1</code></span>|gm; - } - else { # Normal paragraph - s|^(.*)$|<span class="pod">$1</span>|gm; - s/C\0\<(.*?)\0\>/<code>$1<\/code>/g; + $$comm = join( + '', + map { + if (/^=head(\d)\s*(.*)/s) + { + "<span class=\"pod\"><font size=\"+" . ( 4 - $1 ) . "\">$2<\/font></span>"; + } elsif (/^=item\s*(.*)/s) { + "<span class=\"podhead\">* $1 " . ( "-" x ( 67 - length($1) ) ) . "<\/span>"; + } elsif (/^=(pod|cut)/s) { + "<span class=\"podhead\">" . ( "-" x 70 ) . "<\/span>"; + } elsif (/^=.*/s) { + ""; + } else { + if (/^\s/s) { # Verbatim paragraph + s|^(.*)$|<span class="pod"><code>$1</code></span>|gm; + } else { # Normal paragraph + s|^(.*)$|<span class="pod">$1</span>|gm; + s/C\0\<(.*?)\0\>/<code>$1<\/code>/g; + } + $_; } - $_; - } - } split(/((?:\n[ \t]*)*\n)/, $$comm)); - } - else { + } split( /((?:\n[ \t]*)*\n)/, $$comm ) + ); + } else { $$comm =~ s|^(.*)$|<span class='comment'>$1</span>|gm; } } - sub indexfile { - my ($self, $name, $path, $fileid, $index, $config) = @_; + my ( $self, $name, $path, $fileid, $index, $config ) = @_; + + open( PLTAG, $path ); - open(PLTAG, $path); - while (<PLTAG>) { if (/^sub\s+(\w+)/) { - print(STDERR "Sub: $1\n"); - $index->index($1, $fileid, $., 'f'); - } - elsif (/^package\s+([\w:]+)/) { - print(STDERR "Class: $1\n"); - $index->index($1, $fileid, $., 'c'); - } - elsif (/^=item\s+[\@\$\%\&\*]?(\w+)/) { - print(STDERR "Doc: $1\n"); - $index->index($1, $fileid, $., 'i'); + print( STDERR "Sub: $1\n" ); + $index->index( $1, $fileid, $., 'f' ); + } elsif (/^package\s+([\w:]+)/) { + print( STDERR "Class: $1\n" ); + $index->index( $1, $fileid, $., 'c' ); + } elsif (/^=item\s+[\@\$\%\&\*]?(\w+)/) { + print( STDERR "Doc: $1\n" ); + $index->index( $1, $fileid, $., 'i' ); } } close(PLTAG); Index: Python.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Python.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Python.pm 15 Aug 2001 15:50:27 -0000 1.2 +++ Python.pm 19 Jul 2004 19:50:21 -0000 1.3 @@ -11,7 +11,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -27,23 +27,25 @@ use vars qw(@ISA); @ISA = ('LXR::Lang'); -my @spec = ('comment' => ('#', "\$"), - 'string' => ('"', '"'), - 'string' => ("'", "'"), - 'atom' => ('\\\\.', '')); +my @spec = ( + 'comment' => ( '#', "\$" ), + 'string' => ( '"', '"' ), + 'string' => ( "'", "'" ), + 'atom' => ( '\\\\.', '' ) +); sub new { - my ($self, $pathname, $release) = @_; + my ( $self, $pathname, $release ) = @_; - $self = bless({}, $self); + $self = bless( {}, $self ); $$self{'release'} = $release; - if ($pathname =~ /(\w+)\.py$/ || $pathname =~ /(\w+)$/) { + if ( $pathname =~ /(\w+)\.py$/ || $pathname =~ /(\w+)$/ ) { $$self{'modulename'} = $1; } - return $self; + return $self; } sub parsespec { @@ -51,8 +53,8 @@ } sub processcode { - my ($self, $code, @itag) = @_; - + my ( $self, $code, @itag ) = @_; + $$code =~ s/([a-zA-Z_][a-zA-Z0-9_\.]*)/ ($index->issymbol( $$self{'modulename'}.".".$1, $$self{'release'} ) ? join('', @@ -64,36 +66,38 @@ : $1)/ge; } +sub indexfile { + my ( $self, $name, $path, $fileid, $index, $config ) = @_; -sub indexfile { - my ($self, $name, $path, $fileid, $index, $config) = @_; - - my (@ptag_lines, @single_ptag, $module_name); + my ( @ptag_lines, @single_ptag, $module_name ); - if ($name =~ m|/(\w+)\.py$|) { + if ( $name =~ m|/(\w+)\.py$| ) { $module_name = $1; } - - open(PYTAG, $path); - + + open( PYTAG, $path ); + while (<PYTAG>) { chomp; - + # Function definitions if ( $_ =~ /^\s*def\s+([^\(]+)/ ) { - $index->index($module_name."\.$1", $fileid, $., "f"); + $index->index( $module_name . "\.$1", $fileid, $., "f" ); } - # Class definitions + + # Class definitions elsif ( $_ =~ /^\s*class\s+([^\(:]+)/ ) { - $index->index($module_name."\.$1", $fileid, $., "c"); + $index->index( $module_name . "\.$1", $fileid, $., "c" ); } + # Targets that are identifiers if occurring in an assignment.. elsif ( $_ =~ /^(\w+) *=.*/ ) { - $index->index($module_name."\.$1", $fileid, $., "v"); + $index->index( $module_name . "\.$1", $fileid, $., "v" ); } + # ..for loop header. elsif ( $_ =~ /^for\s+(\w+)\s+in.*/ ) { - $index->index($module_name."\.$1", $fileid, $., "v"); + $index->index( $module_name . "\.$1", $fileid, $., "v" ); } } close(PYTAG); |