diff options
author | Akim Demaille <akim@epita.fr> | 2008-02-28 16:01:16 +0000 |
---|---|---|
committer | Akim Demaille <akim@epita.fr> | 2008-02-28 16:01:16 +0000 |
commit | 7020f1e9e255c63d468b5b1591ea2475e40fca28 (patch) | |
tree | 088207a5062c27ee06b8744c4fa28aba1ab6d5a8 /build-aux | |
parent | 59da312bc7a98d2cea04dceb53fc9e7b6c9c1ee3 (diff) | |
download | bison-7020f1e9e255c63d468b5b1591ea2475e40fca28.tar.gz |
* src/getargs.c (short_options): Split and sort for readability.
-g and -x take optional arguments, just like their long options.
* build-aux/cross-options.pl: Use /x to make the regexp easier to
understand.
Fix the handling of $opt which resulted in all the argument to be
considered as optional.
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/cross-options.pl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/build-aux/cross-options.pl b/build-aux/cross-options.pl index cbd11888..31733e72 100755 --- a/build-aux/cross-options.pl +++ b/build-aux/cross-options.pl @@ -7,7 +7,12 @@ use strict; my %option; while (<>) { - if (/^\s*(?:(-\w), )?(--[-\w]+)(\[?)(=[-\w]+)?\]?/) + if (/^\s* # Initial spaces. + (?:(-\w),\s+)? # $1: Possible short option. + (--[-\w]+) # $2: Long option. + (\[?) # $3: '[' iff the argument is optional. + (?:=([-\w]+))? # $4: Possible argument name. + /x) { my ($short, $long, $opt, $arg) = ($1, $2, $3, $4); $short = defined $short ? '@option{' . $short . '}' : ''; @@ -16,7 +21,7 @@ while (<>) $arg =~ s/^=//; $arg = '@var{' . lc ($arg) . '}'; $arg = '[' . $arg . ']' - if defined $opt; + if $opt eq '['; $option{"$long=$arg"} = $short ? "$short $arg" : ''; } else |