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

MBeautifier introduces major sytax errors #98

Closed casperdcl closed 2 years ago

casperdcl commented 3 years ago

this is a bug due to running MBeauifier changing stack{end-1} to stack{end -1} and then (incorrectly) to stack{end, -1}. After this happens, if you run MBeautifier a third time, MIndenter/performIndenting errors:

Subscript indices must either be real positive integers or logicals.

Error in MBeautifier.MIndenter/performIndenting (line 93)
                                            if (strcmp(stack{end, -1}, 'function'))
Error in MBeautify.formatFileNoEditor (line 53)
            text = indenter.performIndenting(text);