You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, e.g. when running conversion scripts, pretty-printing is triggered. One thing that is pretty annoying of that is that it adds spaces before and after the *, / and ^ operators. A cursory glance to the Modelica Language Specification clearly shows that the preferred formatting for those three operators is without spaces, which are instead used for + and -. This is particularly annoying when running MSL 4.0.0 conversion scripts, because it mangles the code formatting even in some lines which are not at all affected by the conversion.
Steps to reproduce
Load the following model in OMEdit
model MReal x, y, w, z;
equation
w =0;
y =1;
x = (y + w)/2*z^2.5;
annotation( uses(Modelica(version = "3.2.3")));end M;
Right click on the package and select "convert to newer versions of used libraries". The converted model is formatted like this
model MReal x, y, w, z;
equation
w =0;
y =1;
x = (y + w) /2* z ^2.5;
annotation( uses(Modelica(version = "4.0.0")));end M;
Desired Behaviour
The formatting of *, / and ^ should include no leading and trailing space.
The text was updated successfully, but these errors were encountered:
Fixed in #9616 by changing the Absyn dumper in the proposed way. For the sake of consistency we should also make the same change to the DAE dumper that's used to dump flat models, but that would require updating thousands of test cases. So that's probably not going to happen anytime soon.
Thanks @perost. Fixing this in the flat Modelica output would be nice, but less important, as this output is normally meant to be read by machines, not by humans. The important thing is not to screw up human-readable source code.
Description
Sometimes, e.g. when running conversion scripts, pretty-printing is triggered. One thing that is pretty annoying of that is that it adds spaces before and after the
*
,/
and^
operators. A cursory glance to the Modelica Language Specification clearly shows that the preferred formatting for those three operators is without spaces, which are instead used for+
and-
. This is particularly annoying when running MSL 4.0.0 conversion scripts, because it mangles the code formatting even in some lines which are not at all affected by the conversion.Steps to reproduce
Load the following model in OMEdit
Right click on the package and select "convert to newer versions of used libraries". The converted model is formatted like this
Desired Behaviour
The formatting of
*
,/
and^
should include no leading and trailing space.The text was updated successfully, but these errors were encountered: