File: filter_aspell_aff

package info (click to toggle)
softcatala-spell 0.20111230b-10
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,424 kB
  • ctags: 7
  • sloc: makefile: 82; perl: 44; sed: 27
file content (32 lines) | stat: -rw-r--r-- 893 bytes parent folder | download | duplicates (8)
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
#!/usr/bin/perl -w

my $change_count;

while ( <STDIN> ){
  chomp;
  if ( /^(SFX|PFX)/ ) {
    my $code     = $_;
    my $comments = ( /\#/ ) ? $_ : '';
    $code        =~ s/\#.*$//;
    $comments    =~ s/^[^\#]*//;
    my ($afx,$flag,$strip,$add,$match) = split (' ',$code);
    if ( $match and $match eq '.' and $strip ne '0'){
      $change_count++;
      my $txt = "$afx $flag $strip $add $strip";
      $txt .= "     $comments" if $comments;
      print "$txt\n";
    } else {
      print "$_\n";
    }
  } else {
    print "$_\n";
  }
}

if ( $change_count ) {
  print STDERR "filter_aspell_aff info: Changed $change_count flag entries\n";
} else {
  print STDERR " ******** =========================================\n";
  print STDERR "   *** filter_aspell_aff ***: No changes. Is filter any longer needed?\n";
  print STDERR " ******** =========================================\n";
}