not contain whitespace.
* ``type`` indicates to the ``grade.pl`` script how to interpret this
- section.
+ section. If ``type`` begins with ``!``, the section will be omitted
+ from the generated skeleton and this initial ``!`` will be stripped
+ from the type before consulting the following choices.
* Type ``0`` defines a section of define flags whose invoked scores are
simply summed. ``extra`` is ignored for this type. This is the only
my $secargs = $1;
if ($secargs =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/) {
($secty, $secmax, $secextra, $secname) = ($1,$2,$3,$4);
+ $secty =~ s/^!//; # strip no-skeleton directive
} else { die "Malformed section line"; }
return;
}
use warnings;
my $section = undef;
+my $skipsec = 0;
sub comments() {
print "\n\$BEGIN_COMMENTS\n\n\$END_COMMENTS\n\n";
chomp $line;
# @section directive?
- if ($line =~ /^@(\S+)\s/) {
- comments() if defined $section;
+ if ($line =~ /^@(\S+)\s+(\S+)\s+/) {
+ comments() if defined $section and not $skipsec;
$section = $1;
+ $skipsec = 0;
+ if ($2 =~ /^!/) { $skipsec = 1; next; }
print "\@$section\n";
}
# :define directive?
elsif ($line =~ /^(:\S+)\s+/) {
die "Directive not within section" if not defined $section;
- print "#$1\n";
+ print "#$1\n" if not $skipsec;
while (my $cline = <STDIN>) { chomp $cline; last if $cline eq "."; }
}
# "#..." and not "#!..." get passed to template
elsif ($line =~ /^\s*#/) {
if ($line !~ /^\s*#!/) {
- print "$line\n";
+ print "$line\n" if not $skipsec;
}
}
}
die "No sections encountered" if not defined $section;
-comments();
+comments() if not $skipsec;