Skip to content

macr2tree (and tree2code ?) fails for braces {2} as cells constructor

Reported by Samuel GOUGEON (@sgougeon)

BUG DESCRIPTION:
----------------
macr2tree (and tree2code ?) fails for braces {2} as cells constructor

--> function test()
  >     e = {2}
  > endfunction

--> t = macr2tree(test);

--> tree2code(t)
 ans  =

  "function test()"
  "e = 1"            <<<< WRONG
  "endfunction"    
  ""               

Displaying t shows that macr2tree is guilty:
...
                     t(5)(2)(1)
  "equal"  "expression"  "lhs"  "endsymbol"

                     t(5)(2)(2)
                            t(5)(2)(2)(1)
  "cste"  "value"
                            t(5)(2)(2)(2)

   1.                                      <<<<< NOT in the initial code == BUG


---------

--> function test()
  >     e = {2, "ab"}
  > endfunction

--> t = macr2tree(test);

--> tree2code(t)
 ans  =

  "function test()"
  "e = [2,"ab"]"     <<<< Brackets are used instead of braces
  "endfunction"    
  ""               


ERROR LOG:
----------


HOW TO REPRODUCE THE BUG:
-------------------------
function test()
    e = {2}
endfunction
t = macr2tree(test);
tree2code(t)

function test()
    e = {2, "ab"}
endfunction
t = macr2tree(test);
tree2code(t)


OTHER INFORMATION:
------------------
* The bug 16297 could be related to this one.
* This bug prevents upgrading mfile2sci() for braces with Scilab 6.