|[Acceleo] Annotations of templates [message #733891]
||Wed, 05 October 2011 17:22
Registered: October 2011
I'm new to the forum and also new to Acceleo. First, let me tell what am I trying to achieve with Acceleo.
I'm building a generic debugger of imperative DSL languages, built on XText and Acceleo. The main use case of my project is simple: you will provide XText grammar for your DSL Language and Acceleo templates to generate actual GPL code from the model. Only with a little effort you should be able to generate a debugger, that will allow you to put breakpoints into your DSL code, as well as using other debugging tools.
The thing that I am trying to solve is, that I need to somehow annotate the templates, so I could see this annotations when working with the traceability model. For instance I could write a template:
[template public generateUserCommandStatement(st : UserDefinedCommandStatement, name:String)]
[comment @subrutineCall /]
Then, when I work with traceability model, I would be able to tell whether the specific template has the subrutineCall annotation or not.
I wanted to ask for some recommendations how to achieve this - for example can I somehow inject the Acceleo mtl parsing mechanism? I could then create a new model that will contain links to module elements together with my annotations.
|Re: [Acceleo] Annotations of templates [message #735205 is a reply to message #733891]
||Tue, 11 October 2011 04:36
| Stephane Begaudeau
Registered: April 2010
Location: Nantes (France)
If you want to add new information like "annotations" to your Acceleo module, I can recommend to way to do this:
1- You can enter your metadata in the documentation of the template. The information will be saved in the ".emtl" file and you will be able to access it during the generation. Once you get the traceability information, get the module element used for the generation and then get its parent module element (template or query) with eContainer().eContainer()...eContainer(). When you have the template or the query that has been used for the generation, you can access its documentation (getDocumentation()). You can see an example of a documented template here.
2- Acceleo modules are saved in ".emtl" files that are EMF models, you can create a new model that links to the model elements in the ".emtl" files or you can add annotation or anything else inside.
Stephane Begaudeau, Obeo
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Powered by FUDForum
. Page generated in 0.01935 seconds