Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a4ad0f

Browse files
committed
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.
1 parent 8d1b338 commit 7a4ad0f

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

Doc/perl/python.perl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,23 @@ sub ArabictoRoman {
6363
sub do_cmd_let{
6464
local($_) = @_;
6565
my $matched = 0;
66-
s/\s*[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e;
66+
s/[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e;
6767
if ($matched) {
6868
my($new, $old) = ($1, $3);
6969
eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }';
7070
print "\ndefining handler for \\$new using \\$old\n";
7171
}
72+
else {
73+
s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es;
74+
if ($matched) {
75+
my($new, $char) = ($1, $3);
76+
eval "sub do_cmd_$new { \"\\$char\" . \@_[0]; }";
77+
print "\ndefining handler for \\$new to insert '$char'\n";
78+
}
79+
else {
80+
write_warnings("Could not interpret \\let construct...");
81+
}
82+
}
7283
$_;
7384
}
7485

0 commit comments

Comments
 (0)