[m-users.] Correct use of pragma source_file and #N directives together ?

Mark Brown mark at mercurylang.org
Wed Aug 17 22:16:24 AEST 2022


On Wed, Aug 17, 2022 at 5:48 PM Sean Charles (emacstheviking)
<objitsu at gmail.com> wrote:
> I didn't fully appreciate that the directives had that restriction on them, I checked section 19 of the reference manual again but couldn't find a hard and fast statement to that effect but ultimately the compiler is the final arbiter.

See the Syntax chapter of that manual.

>
> I will attempt to check that the current line I am about to output begins with ':-', in which case it feels like it ought to be safe to emit a pragma source_file first, otherwise I will skip it. If that doesn't work then I will have to park the feature; the tool is meant to be generic and I don't want to have to know exactly what context the pragma might be rendered within as I output the code, first world problem.

Fwiw, it's possible to write a rule as follows:

Head
:-
Body.

I've seen this used when the head occupies multiple lines. Not my
preferred style, but who knows what people might choose to do ;-)

Cheers,
Mark


More information about the users mailing list