X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/1bb2bd75f0185ca53c92f1c63cdc0b5ceef3f1f2..d07932ef3d14aae86149b8ff65258f520ffa3998:/build-aux/cross-options.pl 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