summaryrefslogtreecommitdiffstats
path: root/Doc/perl
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1998-05-15 13:45:54 (GMT)
committerFred Drake <fdrake@acm.org>1998-05-15 13:45:54 (GMT)
commit7a4ad0fc834f304cb53934a565a5ee81a10b0612 (patch)
treeeddd6a2364735e3f1a0142901ee2e21dd1258a1f /Doc/perl
parent8d1b3384c32e37a06cfb90f0b43391239bfdd59a (diff)
downloadcpython-7a4ad0fc834f304cb53934a565a5ee81a10b0612.zip
cpython-7a4ad0fc834f304cb53934a565a5ee81a10b0612.tar.gz
cpython-7a4ad0fc834f304cb53934a565a5ee81a10b0612.tar.bz2
Extend handling for \let a bit, to also allow \let\something=<character>. We
still don't support things like \let^^M=\something, where ^^M could actually be any active character. Print a decent warning if we find one we can't handle.
Diffstat (limited to 'Doc/perl')
-rw-r--r--Doc/perl/python.perl13
1 files changed, 12 insertions, 1 deletions
diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl
index 8882b31..5a04b7c 100644
--- a/Doc/perl/python.perl
+++ b/Doc/perl/python.perl
@@ -63,12 +63,23 @@ sub ArabictoRoman {
sub do_cmd_let{
local($_) = @_;
my $matched = 0;
- s/\s*[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e;
+ s/[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e;
if ($matched) {
my($new, $old) = ($1, $3);
eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }';
print "\ndefining handler for \\$new using \\$old\n";
}
+ else {
+ s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es;
+ if ($matched) {
+ my($new, $char) = ($1, $3);
+ eval "sub do_cmd_$new { \"\\$char\" . \@_[0]; }";
+ print "\ndefining handler for \\$new to insert '$char'\n";
+ }
+ else {
+ write_warnings("Could not interpret \\let construct...");
+ }
+ }
$_;
}