Enum newline break at wrong position.
Closed this issue · 2 comments
Hi!
In our model we have an EEnum with quite a lot of options and in the latest version of pyecoregen
the generated python code cannot compile due to a wrong line break.
It generates the following output (scroll to the right):
PhysicalQuantityEnum = EEnum('PhysicalQuantityEnum', literals=['UNDEFINED', 'ENERGY', 'POWER', 'VOLTAGE', 'PRESSURE', 'TEMPERATURE', 'EMISSION', 'COST', 'TIME', 'LENGTH', 'DISTANCE', 'IRRADIANCE', 'SPEED', 'STATE_OF_CHARGE', 'VOLUME', 'AREA', 'POWER_REACTIVE', 'COMPOSITION', 'FLOW', 'STATE', 'HEAD', 'POSITION', 'COEFFICIENT', 'WEIGHT', 'FORCE
', 'CURRENT'])
It breaks before the '
instead of after the ,
.
A different EEnum in our model has even more options, but is OK:
ProfileTypeEnum = EEnum('ProfileTypeEnum', literals=['UNDEFINED', 'SOLARIRRADIANCE_IN_W_PER_M2', 'WINDSPEED_IN_M_PER_S', 'STATEOFCHARGE_IN_WS', 'ENERGY_IN_WH', 'ENERGY_IN_KWH', 'ENERGY_IN_MWH', 'ENERGY_IN_GWH', 'ENERGY_IN_J', 'ENERGY_IN_KJ', 'ENERGY_IN_MJ', 'ENERGY_IN_GJ', 'ENERGY_IN_TJ',
'ENERGY_IN_PJ', 'TEMPERATURE_IN_C', 'TEMPERATURE_IN_K', 'POWER_IN_W', 'POWER_IN_KW', 'POWER_IN_MW', 'POWER_IN_GW', 'POWER_IN_TW', 'MONEY_IN_EUR', 'MONEY_IN_KEUR', 'MONEY_IN_MEUR', 'PERCENTAGE', 'MONEY_IN_EUR_PER_KW', 'MONEY_IN_EUR_PER_KWH', 'VOLUME_IN_M3', 'VOLUME_IN_LITERS'])
Any idea what causes this?
Thanks!
Hi @ewoudwerkman ,
Thanks for the issue, I will investigate on that. At the moment, I don't have really any idea why this behavior happend. By change, is there any case that a trailing \n
would appear in your EnumLiteral
name? It's really unlikely, but just in case.
Sorry about this...
Good catch!
I checked the ecore model and I found this:
<eLiterals name="FORCE
" value="24"/>
Thanks for your swift reaction!