davidvarga / MBeautifier

MBeautifier is a MATLAB source code formatter, beautifier. It can be used directly in the MATLAB Editor and it is configurable.
GNU General Public License v3.0
478 stars 75 forks source link

destroys function to Invalid use of operator #116

Closed Wave89 closed 2 years ago

Wave89 commented 2 years ago

Hey David,

thank you very much for such a nice function. But there is a small error: It will convert in the second run from this:

VektorA = [1 2 3 4];
VektorB = [true, VektorA>2]
-->
VektorB =
  1×5 logical array
   1   0   0   1   1 

to

VektorA = [1, 2, 3, 4];
VektorB = [true, VektorA, >, 2]
-->
File: test.m Line: 2 Column: 27
Invalid use of operator.

Or another example would be from

clearvars -except handles gui Auftragsteil Pruefung CFilename Output BasicSettings
clearvars -global Config folder TableOfTitle

to

clearvars - except handles gui Auftragsteil Pruefung CFilename Output BasicSettings
clearvars - global Config folder TableOfTitle

which is also wrong interpreted by MATLAB R2021b

Could you please check how to avoid it?

Thank you!

davidvarga commented 2 years ago

Hi!

The issue for the example with the Vektor ... should be gone with the referenced commit.

The isue with cleanvars I cannot reproduce (using R2020 at the moment), the extra whitespace is never added. Do you use some special configuration for MBeauty or you are going with the default one?

D

Wave89 commented 2 years ago

Hey D,

the new commit seems fine. Thank you very much for the quick fix!

The clearvars point is not able to reproduce at the moment. If I found more about, I will open a new issue.

Thank you very much!