]> git.saurik.com Git - bison.git/blame - build-aux/cross-options.pl
doc: merge HACKING and README-hacking.
[bison.git] / build-aux / cross-options.pl
CommitLineData
f4101aa6
AD
1#! /usr/bin/env perl
2
3use warnings;
4use 5.005;
5use strict;
6
7my %option;
8while (<>)
9{
7020f1e9
AD
10 if (/^\s* # Initial spaces.
11 (?:(-\w),\s+)? # $1: Possible short option.
12 (--[-\w]+) # $2: Long option.
13 (\[?) # $3: '[' iff the argument is optional.
14 (?:=([-\w]+))? # $4: Possible argument name.
15 /x)
f4101aa6
AD
16 {
17 my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
18 $short = defined $short ? '@option{' . $short . '}' : '';
19 if ($arg)
20 {
21 $arg =~ s/^=//;
22 $arg = '@var{' . lc ($arg) . '}';
23 $arg = '[' . $arg . ']'
7020f1e9 24 if $opt eq '[';
1bb2bd75 25 $option{"$long=$arg"} = $short ? "$short $arg" : '';
f4101aa6
AD
26 }
27 else
28 {
29 $option{"$long"} = "$short";
30 }
31 }
32}
33
34foreach my $long (sort keys %option)
35{
36 printf "\@item %-40s \@tab %s\n", '@option{' . $long . '}', $option{$long};
37}