substrings.pl: support comments (lines starting with %)

This commit is contained in:
Bert Frees 2016-05-04 14:49:15 +02:00
parent ea86546f0d
commit a33919b058
1 changed files with 51 additions and 37 deletions

View File

@ -21,12 +21,24 @@ if (defined $encoding) { print OUT "$encoding\n"; }
if (defined $lhmin) { print OUT "LEFTHYPHENMIN $lhmin\n"; }
if (defined $rhmin) { print OUT "RIGHTHYPHENMIN $rhmin\n"; }
# keep header
while (<HYPH>)
{
$pat =~ s/%.*$//g;
if (/^\%/) {
if (/^%/) {
print OUT "$_";
} else {
last;
}
}
while (<HYPH>)
{
if (/^%/) {
#comment, ignore
} elsif (/^(.+)\/([^,]+),([0-9]+),([0-9]+)$/) {
} else {
$_ =~ s/%.*$//g;
for (split ' ', $_) {
if (/^(.+)\/([^,]+),([0-9]+),([0-9]+)$/) {
$origpat = $1;
$pat = $1;
$repl = $2;
@ -63,6 +75,8 @@ while (<HYPH>)
push @patlist, $pat;
$pattab{$pat} = $origpat;
}
}
}
}
foreach $pat (@patlist) {