append instead of appendImmediate for "AFTER" in loops [message #849568] |
Thu, 19 April 2012 09:03 |
Christoph Zwicker Messages: 16 Registered: April 2010 |
Junior Member |
|
|
Hi all,
It seems that in FOR loops, the "AFTER" instruction translates into a ".append" call. I would have expected it to be ".appendImmeditate" in order to have symmetrical behavior with "SEPARATOR"...
What I would like to do when declaring enum instances is:
«FOR field : fields SEPARATOR ", //$NON-NLS-1$" AFTER "; //$NON-NLS-1$"»
«field.declaration»
«ENDFOR»
The only workaround I found to simulate the expected behavior is the following:
«FOR field : fields SEPARATOR ", //$NON-NLS-1$"»
«field.declaration»«IF field.equals(fields.last)»; //$NON-NLS-1$«ENDIF»
«ENDFOR»
Am I missing something? If not: I guess you would not accept this as a bug as it would change the current behavior. Any chance you might introduce a new keyword, e.g. "LAST" resulting in a "appendImmediate"?
Thanks,
Chris
|
|
|
Re: append instead of appendImmediate for "AFTER" in loops [message #849728 is a reply to message #849568] |
Thu, 19 April 2012 11:56 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Chris,
the expressions BEFORE and AFTER are inserted before or after the actual
FOR LOOP. They are not meant to appear immediatly after the expression
in the for loop itself.
You could experiment with something like this:
«FOR field : fields SEPARATOR ", //$NON-NLS-1$\n" AFTER ";
//$NON-NLS-1$"»«field.declaration»«ENDFOR»
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 19.04.12 11:03, schrieb Christoph Zwicker:
> Hi all,
>
> It seems that in FOR loops, the "AFTER" instruction translates into a
> ".append" call. I would have expected it to be ".appendImmeditate" in
> order to have symmetrical behavior with "SEPARATOR"...
>
> What I would like to do when declaring enum instances is:
>
> «FOR field : fields SEPARATOR ", //$NON-NLS-1$" AFTER "; //$NON-NLS-1$"»
> «field.declaration»
> «ENDFOR»
>
> The only workaround I found to simulate the expected behavior is the
> following:
>
> «FOR field : fields SEPARATOR ", //$NON-NLS-1$"»
> «field.declaration»«IF field.equals(fields.last)»; //$NON-NLS-1$«ENDIF»
> «ENDFOR»
>
>
> Am I missing something? If not: I guess you would not accept this as a
> bug as it would change the current behavior. Any chance you might
> introduce a new keyword, e.g. "LAST" resulting in a "appendImmediate"?
>
> Thanks,
> Chris
|
|
|
|
Powered by
FUDForum. Page generated in 0.02618 seconds