POV-Ray : Newsgroups : povray.bugreports : problem with '#break' in macro : Re: problem with '#break' in macro Server Time
24 Oct 2021 09:15:06 EDT (-0400)
  Re: problem with '#break' in macro  
From: William F Pokorny
Date: 10 Sep 2021 12:54:33
Message: <613b8dc9$1@news.povray.org>
On 9/10/21 11:26 AM, Kenneth wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
>>
>> [source code snippets]
>>
>> The variation above works for me in all v3.7+ versions I have in hand.
>>
> 
> Just discovered that the following also produces the error and fails-- unless
> the #debug is there. Seems that in this case, the inner #end actually *needs*
> something to follow it! I tried adding #break and/or #end here and there
> (guesswork!) to try and MAKE it work without the #debug, but no luck so far.
> 
> #declare R = seed(4711);
> #for (I, 1, 100)
>    #if (rand(R) < 1.1) // always less than 1.1
>       #break // terminate loop early
>    #else
>    #end
>    // #debug concat(str(I,0,0), " iterations and counting\n")
> #end
> 
Thanks! This example a stinker - my hack doesn't fix it. I don't 
immediately see a way to handle this case. After the break it reads all 
the way to through the last '#end' in both v3.8 beta 2 and my hacked 
povr code.

In other words, by the time it's done with the work to read to the end 
of the block containing the break, the parser finds itself not inside 
any nested block from which to break.

If the #debug is not commented, it stops there and breaks from the for 
loop block.

Added your test case to the others. Unsure when I might pick up looking 
at it again.

Bill P.


Post a reply to this message

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.