From e16f6798ae8936c9198ee214edf110be77c56c20 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Fri, 15 May 1998 04:28:37 +0000 Subject: [PATCH] do_cmd_let(): Simple implementation to allow \let to be used to establish synonyms for macros. This supports: \let\newname = \oldname \let\newname\oldname This is useful sometimes, and can at least avoid real errors at other times. --- Doc/perl/python.perl | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index 536f324011f..8882b319fa2 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -55,6 +55,24 @@ sub ArabictoRoman { $D2[$c[2]] . $D1[$c[1]] . $D0[$c[0]]; } + +# This is a fairly simple hack; it supports \let when it is used to create +# (or redefine) a macro to exactly be some other macro: \let\newname=\oldname. +# Many uses of \let aren't supported. +# +sub do_cmd_let{ + local($_) = @_; + my $matched = 0; + s/\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"; + } + $_; +} + + # words typeset in a special way (not in HTML though) sub do_cmd_ABC{ 'ABC' . @_[0]; } @@ -84,9 +102,9 @@ sub do_cmd_authoraddress{ $_; } -sub do_cmd_developer{ do_cmd_author(@_[0]); } -sub do_cmd_developers{ do_cmd_author(@_[0]); } -sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); } +#sub do_cmd_developer{ do_cmd_author(@_[0]); } +#sub do_cmd_developers{ do_cmd_author(@_[0]); } +#sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); } sub do_cmd_hackscore{ local($_) = @_;