diff Doc/perl/python.perl @ 8346:1b393db00b1a legacy-trunk

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.
author Fred Drake <fdrake@acm.org>
date Fri, 15 May 1998 13:45:54 +0000
parents d2d82f7b419a
children 4172da91441a
line wrap: on
line diff
--- a/Doc/perl/python.perl	Fri May 15 13:38:21 1998 +0000
+++ b/Doc/perl/python.perl	Fri May 15 13:45:54 1998 +0000
@@ -63,12 +63,23 @@
 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...");
+	}
+    }
     $_;
 }