How to get rid of the BlockStatement braces in the output?

I am using BlockStatements in my template fragments as containers for other statements. It is not possible to put multiple statements into a template fragment unless it's wrapped by a block, right? What troubles me is that the BlockStatement's braces get copied to the output when I generate text from my model. I am not sure if these are a problem when I compile my generated Java code later on, but the code doesn't look very pretty with braces randomly placed in it. Is it possible to get rid of them?

1 comment
Comment actions Permalink

Hi, Vojtech,

You can make a separate template for the code inside your block and $INCLUDE$ it where you want your code to be included.

The main thing to do here is to create multiple template fragments (one per statement) in the newly created template.

The attached screenshot shows what I mean. Hint: to make a template fragment, select a node and press ctrl-shift-F.

This feature also works in reduction rules, BUT the nodes that are inside template framents must have the same role in their parent for this feature to work correctly.

Picture 1.png

Please sign in to leave a comment.