[Dev-luatex] [PATCH] Allow literal # in argument text by escaping
Marcel Fabian Krüger
tex at 2krueger.de
Mon May 27 17:52:38 CEST 2019
On Mon, May 27, 2019 at 10:15:25AM +0200, luigi scarso wrote:
> On Sun, May 26, 2019 at 3:36 PM Marcel Fabian Krüger <tex at 2krueger.de>
> wrote:
>
> > Hi,
> >
> > inspired by [a recent TeX.sx question][1] this allows delimited macros
> > with `#` in the parameter text by doubling the `#`.
> > It isn't needed that often but it is useful if you try to analyze the
> > parameter text of a TeX macro using TeX code. Also it is completely
> > backward-compatible (`##` always triggers an error without this) and
> > it is very easy to implement.
> >
> > For example:
> >
> > \def\test#1###2{(#1)[#2]}
> > \test hello#{world}
> >
> > would result in (hello)[world]
> >
> > Best regards,
> > Marcel Krüger
> >
> >
> hm, context mkiv already has the "named parameters"
> eg
> \def\doflushparallel#instance#status#line#label#content% called at lua end
> {\begingroup
> \def\currentparallelinstance{#instance}%
> \def\currentparallelnumber {#status}%
> \def\currentparallelline {#line}%
> \def\currentparallellabel {#label}%
> \def\currentparallelcontent {#content}% can be kep at the lua end .. no
> need to use a virtual file
> \ifcase#status\relax
> \expandafter\buff_parallel_flush_nop
> \or
> \expandafter\buff_parallel_flush_yes
> \fi
> \endgroup}
>
> (see buff-par.mkvi )
>
> Perhaps one can play with a named parameter as kind of separator.
>
> --
> luigi
That looks interesting. How is it actually implemented? I couldn't find
it in the ConTeXt source. Especially it looks as if the `\def` primitive
is unchanged, but I do not see how this can work then.
Anyway I do not understand what you say with your last statement. How would
they help solving the original problem of `#` delimiters? As far as I
can tell they are rewritten into "normal" positional arguments, so I do
not see how they could help.
Best regards,
Marcel
More information about the dev-luatex
mailing list