Login  Register

Issue on newArray macro function

Posted by CARL Philippe (LBP) on Jan 16, 2018; 12:37pm
URL: http://imagej.273.s1.nabble.com/Issue-on-newArray-macro-function-tp5019886.html

Dear all (probably Wayne),

I have found an issue in the newArray function within what can be a very
simple macro.

Indeed, the following code is working:

a = newArray(5, 5+2);

Array.print(a);

As the following code:

a = newArray(5+1, 5+2);

Array.print(a);

Is throwing the error that it is expecting an ")" instead of the ",".

Which means that is there is something else than "," after the first element
it interprets the code as being a newArray(size).

I guess the fix for this issue would be to replace the line

if (next==STRING_CONSTANT || nextNext==','

        || nextNext=='[' || next=='-' || next==PI)

            return initNewArray();

With

if (next==STRING_CONSTANT || nextNext==',' || next==PI

        || nextNext=='[' || next=='+' || next=='-' || next=='*' ||
next=='/')

            return initNewArray();

Within the "Variable[] newArray" method in the " ij.macro. Functions.java"
file.

My best regards,

Philippe

 

Philippe CARL

Laboratoire de Bioimagerie et Pathologies

UMR 7021 CNRS - Université de Strasbourg

Faculté de Pharmacie

74 route du Rhin

67401 ILLKIRCH

Tel : +33(0)3 68 85 41 84


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html