[metapost] Bug? Parsing def := := enddef;

Nicola nvitacolonna at gmail.com
Thu Jan 21 10:00:30 CET 2010


In article <4B57FF3D.30800 at elvenkind.com>,
 Taco Hoekwater <taco at elvenkind.com> wrote:

> Nicola wrote:
> > 
> > But the following gives an error:
> > 
> > This is MetaPost, version 1.208 (kpathsea version 3.5.7dev)
> > **\relax
> > 
> > *def := := enddef;
> > ! Missing `=' has been inserted.
> > <to be read again> 
> >                    :=
> > <*> def := :=
> >               enddef;
> > ? 
> > 
> > That looks like a small bug. Taco, can you confirm?
> 
> Confirmed. Whether this is a 'fixable' bug remains to be seen,
> I will investigate.

Actually, I've noticed that both

def := = enddef;

and

def = := enddef;

are ok (and similarly for vardef). The sense may be: if you are 
redefining ':=' you are not allowed to use it in the definition header 
itself (and similarly for '='), for the simple reason that you are 
changing its meaning. So, I think this is actually expected behaviour. 
Really, in The METAFONTbook, := is never used in a macro header, so this 
might be the only reason why it exists (to allow the user to redefine =)!

> The macro definition is fairly pointless,

Agree. I was just testing a parser for macro definitions and I was 
trying some borderline cases. Another fairly pointless definition is

def enddef = enddef;

after which you won't be able to close that def any longer :)

Nicola



More information about the metapost mailing list