Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » JET comments (redux)
JET comments (redux) [message #49674] Tue, 16 September 2008 15:38 Go to next message
Eclipse User
Originally posted by: eclipse-news.rizzoweb.com

I found this old discussion about comments in JET templates (from 2004):
http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg0 6495.html

There was a request to support template-only comments in the JET syntax,
comments that are meant for documenting the template itself and are NOT
emitted to the generated code.

Did this request ever go anywhere? Was there a Bugzilla entered for it?

Eric
Re: JET comments (redux) [message #49764 is a reply to message #49674] Tue, 16 September 2008 18:15 Go to previous messageGo to next message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
Eric:

First, JET (aka org.eclipse.jet, aka JET2) allows a comment style:

<%-- ... --%>

Late in 0.9.0, I resolved this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205811, which was about
copying this comments to the generated Java code, in particular to get
copyright notices inserted at the head of the file. This now does the trick:

<%-- @copyright
....
--%>

However, it my enthusiasm, I ended up writing all comments to the generated
Java output (as Java comments).

This, in turn, has led to a request that I stop doing this, which leads me
to think that I need an options like:

<%-- @inline
your comment goes here
--%>

Paul







"Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
news:gaojs4$ago$1@build.eclipse.org...
>I found this old discussion about comments in JET templates (from 2004):
> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg0 6495.html
>
> There was a request to support template-only comments in the JET syntax,
> comments that are meant for documenting the template itself and are NOT
> emitted to the generated code.
>
> Did this request ever go anywhere? Was there a Bugzilla entered for it?
>
> Eric
Re: JET comments (redux) [message #49824 is a reply to message #49764] Tue, 16 September 2008 19:39 Go to previous messageGo to next message
Eclipse User
Originally posted by: eclipse-news.rizzoweb.com

Paul Elder wrote:
> Eric:
>
> First, JET (aka org.eclipse.jet, aka JET2) allows a comment style:
>
> <%-- ... --%>
>
> Late in 0.9.0, I resolved this bug:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=205811, which was about
> copying this comments to the generated Java code, in particular to get
> copyright notices inserted at the head of the file. This now does the trick:
>
> <%-- @copyright
> ...
> --%>
>
> However, it my enthusiasm, I ended up writing all comments to the generated
> Java output (as Java comments).
>
> This, in turn, has led to a request that I stop doing this, which leads me
> to think that I need an options like:
>
> <%-- @inline
> your comment goes here
> --%>

So do I understand correctly:
In 0.8.x, this line in the template
<%-- This comment will not appear in the template output --%>
will NOT show up in the output, but in 0.9 it WILL show up in the
output? Is that correct?

Why not do what JSP does and have a different comment syntax for
comments that are not rendered than for comments that are rendered?

Eric



> "Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
> news:gaojs4$ago$1@build.eclipse.org...
>> I found this old discussion about comments in JET templates (from 2004):
>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg0 6495.html
>>
>> There was a request to support template-only comments in the JET syntax,
>> comments that are meant for documenting the template itself and are NOT
>> emitted to the generated code.
>>
>> Did this request ever go anywhere? Was there a Bugzilla entered for it?
>>
>> Eric
>
>
Re: JET comments (redux) [message #49854 is a reply to message #49824] Wed, 17 September 2008 02:43 Go to previous messageGo to next message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
Eric Rizzo wrote:

> So do I understand correctly:
> In 0.8.x, this line in the template
> <%-- This comment will not appear in the template output --%>
> will NOT show up in the output, but in 0.9 it WILL show up in the
> output? Is that correct?


No, a <%-- .. --%> comment will never show in the template output. But, as
of JET 0.9.0, it will show up as a Java comment in the compiled Java class
for the template.

So, template mytemplate.jet with comment

<%-- this is a comment --%>

It gets compiled to a Java class _jet_mytemplate.java (I made this name up
- can't remember exactly what the compiler does) that would have a comment
somewhere in its code body:

// this is a comment

But, when you run the template, the output will not have that text.

I think the confusion is between the 'template output' and 'compiled
template class'. The compiled template class is a Java class that
implements the template. The template output is the result of executing
the compiled template class with a particular output. So, to be clear...
While comments are now copied to the compiled template class (as Java
comments), this has no impact on the template output.

Hope this clarifies things.

Paul
Re: JET comments (redux) [message #49918 is a reply to message #49854] Wed, 17 September 2008 13:22 Go to previous message
Eclipse User
Originally posted by: eclipse-news.rizzoweb.com

Paul Elder wrote:
> I think the confusion is between the 'template output' and 'compiled
> template class'. The compiled template class is a Java class that
> implements the template. The template output is the result of executing
> the compiled template class with a particular output. So, to be clear...
> While comments are now copied to the compiled template class (as Java
> comments), this has no impact on the template output.
>
> Hope this clarifies things.

Yes, it does. I was definitely confused by the way it is stated in the
online Help
(< http://help.eclipse.org/ganymede/topic/org.eclipse.jet.doc/r eferences/syntax/jetSyntaxComments.xhtml>)
but now I get it.

Thanks,
Eric
Previous Topic:Could not load JET template loader: EMF+JET
Next Topic:cannot use dropins to change jet/M2T version !
Goto Forum:
  


Current Time: Mon Oct 20 04:31:00 GMT 2014

Powered by FUDForum. Page generated in 0.02470 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software