X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/f4101aa612b2e2783ee0a78b88fb0d5f481ba363..cac9e09bbf68269173df301cd06ad40b904d11ec:/build-aux/cross-options.pl?ds=sidebyside diff --git a/build-aux/cross-options.pl b/build-aux/cross-options.pl index 4c941b04..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,8 +21,8 @@ while (<>) $arg =~ s/^=//; $arg = '@var{' . lc ($arg) . '}'; $arg = '[' . $arg . ']' - if defined $opt; - $option{"$long=$arg"} = "$short $arg"; + if $opt eq '['; + $option{"$long=$arg"} = $short ? "$short $arg" : ''; } else {