On Mon May 21 13:46:04 2018, JV wrote:
Show quoted text> Seems you've hit the limit of sanity...
Maybe you're right :-| I was just trying to meet a pre-existing ineterface.
In case you want to consider it, attached is a patch which allows backslash escapes for single-character option names. In particular
"\\==s" => \$optequalval
works. Note: I only tested this informally using perl v5.26.1, but I tried not to use anything which might not work in an older perl. I have not downloaded the package with test suite.
-Jim
--- Long.pm 2018-05-21 23:25:39.134688537 +0000
+++ Long.pm.NEW 2018-05-22 00:18:48.057523155 +0000
@@ -4,7 +4,7 @@
# Author : Johan Vromans
# Created On : Tue Sep 11 15:00:12 1990
# Last Modified By: Johan Vromans
-# Last Modified On: Thu Jun 9 14:50:37 2016
+# Last Modified On: Thu Jun 9 14:50:37 2016 **HACKED jima 5/21/18**
# Update Count : 1699
# Status : Released
@@ -795,6 +795,8 @@
). "]";
}
+my $optname_re = qr/(?:\w+[-\w]*|\?|\\.)/; # \c means c for any c
+
# Parse an option specification and fill the tables.
sub ParseOptionSpec ($$) {
my ($opt, $opctl) = @_;
@@ -802,12 +804,10 @@
# Match option spec.
if ( $opt !~ m;^
(
- # Option name
- (?: \w+[-\w]* )
- # Alias names, or "?"
- (?: \| (?: \? | \w[-\w]* ) )*
- # Aliases
- (?: \| (?: [^-|!+=:][^|!+=:]* )? )*
+ # Primary Option name
+ ${optname_re}
+ # Alias names
+ (?: \| ${optname_re} )*
)?
(
# Either modifiers ...
@@ -836,8 +836,10 @@
my @names;
if ( defined $names ) {
- @names = split (/\|/, $names);
- $orig = $names[0];
+ local $_ = "|$names";
+ @names = (/\G\|(${optname_re})/g) or die;
+ s/^\\// for @names; # get rid of \ escape
+ $orig = $names[0];
}
else {
@names = ('');