[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Handle more general types of option arguments.
From: |
Akim Demaille |
Subject: |
[PATCH] Handle more general types of option arguments. |
Date: |
Fri, 07 Nov 2008 20:38:22 -0000 |
* build-aux/cross-options.pl: The argument ends at the first
space, not the first non-symbol character.
Use @var for each word appearing the argument description.
---
ChangeLog | 7 +++++++
build-aux/cross-options.pl | 25 ++++++++++++++++++-------
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a9f7602..2d384ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2008-11-07 Akim Demaille <address@hidden>
+ Handle more general types of option arguments.
+ * build-aux/cross-options.pl: The argument ends at the first
+ space, not the first non-symbol character.
+ Use @var for each word appearing the argument description.
+
+2008-11-07 Akim Demaille <address@hidden>
+
Destroy the variants that remain on the stack in case of error.
* data/lalr1-fusion.cc (yydestruct_): Invoke the variant's
destructor.
diff --git a/build-aux/cross-options.pl b/build-aux/cross-options.pl
index 31733e7..2cec369 100755
--- a/build-aux/cross-options.pl
+++ b/build-aux/cross-options.pl
@@ -7,19 +7,27 @@ use strict;
my %option;
while (<>)
{
- 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.
+ if (/^\s* # Initial spaces.
+ (?:(-\w),\s+)? # $1: $short: Possible short option.
+ (--[-\w]+) # $2: $long: Long option.
+ (\[?) # $3: $opt: '[' iff the argument is optional.
+ (?:=(\S+))? # $4: $arg: Possible argument name.
+ \s # Spaces.
/x)
{
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
$short = defined $short ? '@option{' . $short . '}' : '';
if ($arg)
{
+ # if $opt, $arg contains the closing ].
+ substr ($arg, -1) = ''
+ if $opt eq '[';
$arg =~ s/^=//;
- $arg = '@var{' . lc ($arg) . '}';
+ $arg = lc ($arg);
+ # If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
+ # put each word in @var, to build @address@hidden, not
+ # @var{name[=value]}].
+ $arg =~ s/(\w+)/address@hidden/g;
$arg = '[' . $arg . ']'
if $opt eq '[';
$option{"$long=$arg"} = $short ? "$short $arg" : '';
@@ -33,5 +41,8 @@ while (<>)
foreach my $long (sort keys %option)
{
- printf "address@hidden %-40s address@hidden %s\n", '@option{' . $long .
'}', $option{$long};
+ # Avoid trailing spaces.
+ printf ("address@hidden %-40s address@hidden",
+ '@option{' . $long . '}',
+ $option{$long} ? " $option{$long}" : "");
}
--
1.6.0.2.588.g3102
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Handle more general types of option arguments.,
Akim Demaille <=