Generate the long/short option cross-table.

* build-aux/cross-options.pl: New.
* doc/Makefile.am (cross-options.texi): New.
* doc/bison.texinfo: Use it.
This commit is contained in:
Akim Demaille
2007-11-04 21:15:11 +00:00
parent 727a14014b
commit f4101aa612
3 changed files with 97 additions and 71 deletions

32
build-aux/cross-options.pl Executable file
View File

@@ -0,0 +1,32 @@
#! /usr/bin/env perl
use warnings;
use 5.005;
use strict;
my %option;
while (<>)
{
if (/^\s*(?:(-\w), )?(--[-\w]+)(\[?)(=[-\w]+)?\]?/)
{
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
$short = defined $short ? '@option{' . $short . '}' : '';
if ($arg)
{
$arg =~ s/^=//;
$arg = '@var{' . lc ($arg) . '}';
$arg = '[' . $arg . ']'
if defined $opt;
$option{"$long=$arg"} = "$short $arg";
}
else
{
$option{"$long"} = "$short";
}
}
}
foreach my $long (sort keys %option)
{
printf "\@item %-40s \@tab %s\n", '@option{' . $long . '}', $option{$long};
}