[Thread Prev][Thread Next][Index]

Re: [ferret_users] IF and REPEAT crash



Hi Hella and Andrew,
Thanks for the report, and particularly for the example that illustrates it!  We'll get this fixed shortly, and we plan to make a Ferret release with this and a few other bug fixes by the end of this month.

Ansley

Hella Riede wrote:
Dear Andrew, dear users

Thanks for your fast reply. As I wrote I also found that the evaluation
to 1 in the outer IF does not lead to an error. I only discovered this
parsing bug when I started the ELIF branch.

Another workaround I'm using is - as shown in test2 - to not have a line
break before the inner endif.

Best,
Hella


Andrew Wittenberg wrote:
  
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