You said 'a line pragma in ATS2 source'.
I may not have understood your question correctly.
I am looking forward to the preprocessor!
<p>${1 + 2}</p>
val () = fprint!(out, "<p>")
#pragma 1 "input.html"
val () = fprint!(out, 1 + 2)
val () = fprint!(out, "</p>")
--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/cdcbea1e-9bdb-431a-9cea-f0fe0be7f3f0%40googlegroups.com.
There is currently no support for line pragmas in ATS source code.Such a line is printed out to the stderr. It can help debugging as well.
For the moment, I suggest that you generate the following line for your example:
#print "input.html: line 1\n"
On Sun, Jan 10, 2016 at 3:54 AM, Artyom Shalkhakov <artyom...> wrote:
On Sunday, January 10, 2016 at 12:37:42 PM UTC+6, gmhwxi wrote:You said 'a line pragma in ATS2 source'.
I may not have understood your question correctly.
I am looking forward to the preprocessor!Yes, I am generating ATS code for printing HTML fragments, kind of like a templating engine. I would like to retain positions from the source HTML file in the generated ATS code, for easier debugging.The input file is plain HTML (or a fragment, but I haven't tested fragments yet...) with some ATS directives embedded in it. For instance, the input is:
<p>${1 + 2}</p>and the output is basically:
val () = fprint!(out, "<p>")
#pragma 1 "input.html"
val () = fprint!(out, 1 + 2)
val () = fprint!(out, "</p>")I'd like to specify that the second line in the above code is generated from the input (see the pragma, but it is rejected currently). So I need to put a #line pragma before the expression. It would be much easier to debug if line information was retained.Sorry for the confusion.On Sunday, January 10, 2016 at 1:14:35 AM UTC-5, gmhwxi wrote:If you pass the flag '--gline' to patscc or patsopt, the generated
C code should contain line pragmas.
On Sunday, January 10, 2016 at 1:06:27 AM UTC-5, Artyom Shalkhakov wrote:Is it possible to emit a line pragma in ATS2 source?
I've written a (soon to be released) preprocessor for ATS2, and pragmas would be very valuable addition to help with debugging.
--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Because ATS will be used more and more as a target language,
supporting various forms of #pragma is becoming a very important issue.
I will find some time to do this (hopefully before the next release). A general
pragma should look like:
#pragma(CATEGORY, arg1, arg2, ...)
So a line pragma looks like:
#pragma(line, FILENAME, LINE_NUMBER)
This issue is now mention on ats-lang-devel:
https://groups.google.com/forum/?fromgroups=#!topic/ats-lang-devel/S3bGXL2OLnM
//
#pragma
( location
, "abcde.dats"
, "69(line=4, offs=31) -- 88(line=4, offs=50)"
)
//