Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] How to avoid generating lines with only whitespace(Acceleo)
[Acceleo] How to avoid generating lines with only whitespace [message #1754418] Fri, 17 February 2017 14:10 Go to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 14
Registered: February 2016
Junior Member
Hi,

The indentation rules of Acceleo lead to lines being generated with only whitespace characters in them. Consider the following

[template tmpl1(obj : OclAny)]
Unindented line.
   [obj.tmpl2()/]
Unindented line.
[/template]


[template tmpl2(obj : OclAny)]
This line will be indented because the above call was indented.

Another line that will also be indented.
[/template]


The empty line in tmpl2 will also be indented. As a result the output file will contain a line with only spaces.

Is there a way to avoid that? Can Acceleo's engine take care of that?

I'm thinking of a workaround of registering a generation listener to store a list of generated files, then iterating them in Java to clear lines containing only whitespace.

Any other suggestions?

Thanks,
Elie
Re: [Acceleo] How to avoid generating lines with only whitespace [message #1754470 is a reply to message #1754418] Sat, 18 February 2017 07:46 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

IIRC the Acceleo documentation offers some sensible advice that non-trivial whitespace formatting be treated as a separate concern in a separate 'tool'.

However if you use unnatural formatting such as no new line before [/template] you can get quite close to what you need. Every new-line comes from somewhere, so just get rid of the source.

Regards

Ed Willink
Previous Topic:[Acceleo] pb with java services
Next Topic:[Acceleo] Unable to see IFML metamodels - how to generate code from IFML?
Goto Forum:
  


Current Time: Fri Sep 21 00:26:32 GMT 2018

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

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

Back to the top