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

Richard O'Keefe raoknz at gmail.com
Wed Aug 17 14:05:49 AEST 2022


Is there room for an annotation module
with something like
  annotation:source_file('...'),
  annotation:source_line(137)
allowed as goals (logically equivalent to true)
but affecting source information?


On Wed, 17 Aug 2022 at 09:59, Zoltan Somogyi <zoltan.somogyi at runbox.com>
wrote:

>
> 2022-08-17 07:34 GMT+10:00 "Sean Charles (emacstheviking)" <
> objitsu at gmail.com>:
> > Hi, I am trying to complete my literate programming tool by having it
> intersperse the above mentioned directives into the generated source, but
> having read section "19.6 Source file name" until I glazed over, I just
> cannot fathom my obvious error!
> > I have two small markdown files, which when rendered without the
> --mercury-lines option, an option to my program, stitch together and run
> just fine:
>
> > main(!IO) :-
> > :- pragma source_file("mtest2.md").
> > #7
> >     io.format("Yay\n", [], !IO),
> > :- pragma source_file("mtest2.md").
> > #8
> >     io.format("Yay once again\n", [], !IO),
> > :- pragma source_file("mtest.md").
> > #19
> >     io.format("-- line counter test--\n", [], !IO),
> > :- pragma source_file("mtest.md").
> > #20
> >     io.format("this is the final and\n", [], !IO),
> > :- pragma source_file("mtest.md").
> > #21
> >     io.format("last word\n", [], !IO).
>
> Source file directives, like other directives, may not occur in the middle
> of clauses, or in the middle of other directives. You get errors about
> the code above because it tries to put source_file directives into the
> middle
> of a clause.
>
> Zoltan.
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20220817/e3ac8ae4/attachment.html>


More information about the users mailing list