matlab2python icon indicating copy to clipboard operation
matlab2python copied to clipboard

Function Definition Indent Bug

Open reganwillis opened this issue 2 years ago • 1 comments

Hello, thanks for a very useful language conversion tool. I have identified a bug where the definition of an output function is not indented, resulting in an Indentation Error. I tested the conditional statement indent and it worked as expected. Please see the below test using matlabparser/parser.py:

file.m
% if statement indent test
if true
    disp("if statement")
end

% function test
function ret = add_one(a)
    ret = a + 1;
end
x = add_one(2)
file.py
 # if statement indent test
if True:
    print('if statement')
 
# function test
def add_one(a = None):
ret = a + 1
return ret
x = add_one(2)

I will look more into this issue if it is found to be reproducible.

reganwillis avatar Nov 19 '23 20:11 reganwillis

Dear @reganwillis Thank you for posting this and posting a minimal example. I probably won't look at it untill a couple of months, but it sounds like this should be fixable.

ebranlard avatar Nov 30 '23 16:11 ebranlard