File: keyWords

package info (click to toggle)
perl-tk 1:804.033-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 34,724 kB
  • ctags: 37,174
  • sloc: ansic: 349,541; perl: 52,192; sh: 17,904; makefile: 5,732; asm: 3,565; ada: 1,681; pascal: 1,089; cpp: 1,006; yacc: 883; cs: 879
file content (73 lines) | stat: -rwxr-xr-x 1,162 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/local/bin/perl -w

use File::Find;

%words = ();

open(KEY,"pTk/Methods.def") || die "Cannot open pTk/Methods.def:$!";
while (<KEY>)
 {
  if (/\(\("(.*)",NULL\)\)/)
   {
    my @words = split(/","/,$1);
    my $word;
    foreach $word (@words)
     {
      next if ($word =~ /^[A-Z]/);
      unless (exists $words{$word})
       {
        $words{$word} = 1;
       }
     }
   }
 }
close(KEY);

$words = '('.join('|',keys %words).')';


sub match
{
 while (/sub\s+\b(${words}[A-Za-z]+|[A-Za-z]+${words})\b/go)
  {
   unless (exists $word{$1})
    {
     print STDERR "$1 '$2/$3'\n";
     $word{$1} = []
    }
   push(@{$word{$1}},"${File::Find::name}:$.");
  }
 return 0;
}

sub wanted
{
 $File::Find::prune = 0;
 if (-T $_ && !/%$/)
  {
   if (/\.pm$/)
    {
     local $file   = ($_);
     local ($_);
     open($file,"<$file") || die "Cannot open $file:$!";
     while (<$file>)
      {
       last if &match;
      }
     close($file);
    }
  }
 elsif (-d $_)
  {
   $File::Find::prune = 1 if (/^(blib|Pod|HTML)$/);
  }
}

@ARGV = '.' unless (@ARGV);

find(\&wanted,@ARGV);

foreach (sort keys %word)
 {
  print "$_:",join(' ',@{$word{$_}}),"\n";
 }