]>
git.saurik.com Git - bison.git/blob - build-aux/cross-options.pl
10 if (/^\s
* # Initial spaces.
11 (?:(-\w
),\s
+)? # $1: $short: Possible short option.
12 (--[-\w
]+) # $2: $long: Long option.
13 (\
[?) # $3: $opt: '[' iff the argument is optional.
14 (?:=(\S
+))? # $4: $arg: Possible argument name.
18 my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
19 $short = defined $short ? '@option{' . $short . '}' : '';
22 # if $opt, $arg contains the closing ].
23 substr ($arg, -1) = ''
27 # If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
28 # put each word in @var, to build @var{name}[=@var{value}], not
29 # @var{name[=value]}].
30 $arg =~ s/(\w+)/\@var{$1}/g;
31 $arg = '[' . $arg . ']'
33 $option{"$long=$arg"} = $short ? "$short $arg" : '';
37 $option{"$long"} = "$short";
42 foreach my $long (sort keys %option)
44 # Avoid trailing spaces.
45 printf ("\@item %-40s \@tab%s\n",
46 '@option{' . $long . '}',
47 $option{$long} ? " $option{$long}" : "");