passing additional info to generator [message #1273852] |
Thu, 20 March 2014 12:36  |
Eclipse User |
|
|
|
Hi,
I'm wondering what is the best way to pass additional info to an Xtext generator to influence what code exactly is generated?
What I'd like to do is generate code from my DSL, but depending on some variable (which is not part of my DSL file, but e.g. a checkbox in a gui somewhere) select what code to generate. This would allow me to specify externally to only generate getters but not the setters, or for which target language to generate code (given I have generators for multiple languages).
I read about the possibility to have multiple generators, and this might be part of the solution. But my question is then how can I make the selection based upon some variable external to my DSL.
Best regards,
Klaas
|
|
|
|
|
|
Re: passing additional info to generator [message #1276161 is a reply to message #1273852] |
Mon, 24 March 2014 03:08  |
Eclipse User |
|
|
|
I would use dependency injection, where this info is provided by Eclipse
preferences when executed in Eclipse and by other means when executed
elsewhere.
Am 20/03/14 19:41, schrieb klaas thoelen:
> Hi,
>
> I'm wondering what is the best way to pass additional info to an Xtext
> generator to influence what code exactly is generated?
>
> What I'd like to do is generate code from my DSL, but depending on some
> variable (which is not part of my DSL file, but e.g. a checkbox in a gui
> somewhere) select what code to generate. This would allow me to specify
> externally to only generate getters but not the setters, or for which
> target language to generate code (given I have generators for multiple
> languages).
>
> I read about the possibility to have multiple generators, and this might
> be part of the solution. But my question is then how can I make the
> selection based upon some variable external to my DSL.
>
> Best regards,
> Klaas
--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
|
|
|
Powered by
FUDForum. Page generated in 0.07309 seconds