string(macro) and tree2code() yield wrong code for multiline arrays including some comments, breaking its compilation (Regression)
Reported by Samuel GOUGEON (@sgougeon)
BUG DESCRIPTION:
----------------
tree2code() yields a wrong code for any multiline array including some comments (Regression) breaking the compilation.
--> function test()
> a = [1 2 3
> // Remark
> 4 5 6 ]
> endfunction
--> tree2code(macr2tree(test))
ans =
"function test()"
"a = [1,2,3;// rem;4,5,6]" <<< BUG: The array is serialized. ";4,5,6]" is put in comment
"endfunction"
""
This bug impacts the edit()ing of inline user-defined functions:
--> edit test
Scilab 5.5 was OK:
-->tree2code(macr2tree(test))
ans =
!function [] = test() !
! !
!a = [1,2,3; !
! // rem !
! 4,5,6] !
! !
!endfunction !
ERROR LOG:
----------
HOW TO REPRODUCE THE BUG:
-------------------------
function test()
a = [1 2 3
// rem
7 8 9
];
endfunction
t = macr2tree(test);
//s.s = t // to display it nicely
tree2code(t)
edit test