| Next | Program
Repair Shop ![]() |
297 |
Try this:
if (/apply/ && ($chain_test)) {
die "Missing ';' in 'apply' line" if /apply[^;]*\n/;
$ct_scanout = 1 if /apply\s*\"grp[0-9]_unload\"/;
while (<INFILE>) {
chomp;
if (/\bend\b/) {
&printout;
last;
}
next unless /\t*chain\s+\"chain([0-9])\"/;
$chain_number = $1;
&cleanup;
$chain_input = (split /=/,$_)[1];
$chain_input =~ tr/\"//d;
$chain[$chain_number] = [split //, $chain_input];
}
}
When we see apply, go into a special inner loop
When we see end, call printout and resume the outer loop
This is a simple case of recursive-descent parsing
| Next | ![]() |
Copyright © 2002 M. J. Dominus |