mirror of
https://github.com/mi57730/a2d.git
synced 2025-02-20 02:29:11 +00:00
25 lines
499 B
Perl
Executable File
25 lines
499 B
Perl
Executable File
#!/usr/bin/env perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
my %terms;
|
|
my %unscoped;
|
|
my $depth = 0;
|
|
|
|
while (<STDIN>) {
|
|
++$depth if m/\.proc/ || m/\.scope/;
|
|
--$depth if m/\.endproc/ || m/\.endscope/;
|
|
foreach my $term (split /\b/, $_) {
|
|
if ($term =~ /^L[0-9A-F]{4}$/) {
|
|
$terms{$term} = 0 unless defined $terms{$term};
|
|
$terms{$term} += 1;
|
|
$unscoped{$term} = 1 if $depth < 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach my $term (sort keys %unscoped) {
|
|
print "$term\n";
|
|
}
|