Sujet : Re: String-Based Macro Systems
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.miscDate : 13. Apr 2024, 06:51:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uvd6gv$2rra8$1@dont-email.me>
References : 1 2
User-Agent : Pan/0.155 (Kherson; fc5a80b8)
On Sat, 13 Apr 2024 05:09:26 -0000 (UTC), Blue-Maned_Hawk wrote:
Whenever a system has a system to escape symbols, there are two ways to
go about it: either the symbol is magic by default, and the escape
makes it normal, or the symbol is normal by default, and the escape
makes it magic.
And here’s another question: is magic iterative? Is text produced by a
macro substitution automatically subject to further macro substitutions?
This is true of Macrogenerator and m4, but perhaps this is a source of a
lot of the problems with string-based macro systems.
On the other hand, if you didn’t do this, then how would you implement the
example I gave?
§DEF,AORB,<§§Q;;>,§DEF,A,<A§UPDATE,Q,B;>;,§DEF,B,<B§UPDATE,Q,A;>;;
If “§A;” expands literally to “A§UPDATE,Q,B;” with no further special
interpretation of the embedded “§”, then how would you explicitly request
invocation of the “UPDATE” function?
The answer would be, the body of the macro would not directly be
interpreted as literal text, but would have to consist of a sequence of
explicit directives, like “insert literal text”, “insert expansion of a
further macro” and so on.