[Thread Prev][Thread Next][Index]

Re: [ferret_users] IF and REPEAT crash



Hi Hella,

This appears to be a parsing bug in Ferret. In addition to your other examples, if we change the outer-IF 0 to a 1 in the last block, the error disappears. It seems that the inner ENDIF is being applied to the outer IF, leaving the outer ENDIF to throw an error.

I've just entered this bug into the Ferret database (as Trac #1681), so hopefully it'll be fixed soon. [Ansley, see also Trac #1566, regarding a possibly related bug involving REPEAT and EXIT/SCRIPT (fixed in April 2008).]

A workaround is to use the form in your block 2, or to put the inner section into a new my.jnl file, and call that with "go my.jnl".

Andrew

On Tue, 8 Sep 2009, Hella Riede wrote:

Dear ferret users,

is the following problem already known?

The last backslash before the endif within the repeat loop causes the
script to crash (test3). This only occurs when the expression on the
outer if is evaluated to zero (here set to zero directly). If it is
evaluated as 1 in test3, everything is executed as intended.

Thanks in advance for clarification.

Regards,
Hella Riede



CODE:

say "test1"
if 0 then
 repeat/RANGE=1:2 (if 0 then; say "hello"; endif)
endif

say "test2"
if 0 then
 repeat/RANGE=1:2 (\
   if 0 then;\
     say "hello"; endif)
endif

say "test3"
if 0 then
 repeat/RANGE=1:2 (\
   if 0 then;\
     say "hello";\
   endif)
endif




RESULT:

yes? go test.jnl
say "test1"
test1
if 0 then
endif

say "test2"
test2
if 0 then
endif

say "test3"
test3
if 0 then
   endif)
endif
**ERROR: invalid command: ENDIF can only be used in an IF clause
endif
Command file, command group, or REPEAT execution aborted
yes?






[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement