POV-Ray : Newsgroups : povray.advanced-users : Parse weirdness : Re: Parse weirdness Server Time
28 Jul 2024 18:27:12 EDT (-0400)
  Re: Parse weirdness  
From: Invisible
Date: 18 Jun 2004 09:45:19
Message: <40d2f1ef$1@news.povray.org>
>> Without a complete but minimal scene, I don't think there is a way to 
>> help you.
> 
> 
> The scene I have is *huge*. It will take you years to wade through it all.
> 
> If I can come up with something more minimal, I'll post it.

OK, try this...

-----
#macro Save(X, Y)
   #fopen Datafile "Test.data" write
   #write(Datafile, X, ", ", Y, ", ")
   #fclose
#end

Save(7, 9)

object {sphere {+1*z, 0} pigment {red 1}}
light_source {+1*y, 1}
-----

On the penultimate line, I get
   Parse Error: expected 'object or directive', found {
If you comment out the "Save(7, 9)" line, it renders fine.

The cause is the #fclose command - I forgot to type *which* file to 
close! But rather than POV-Ray saying "you didn't say which file to 
close", it gives me the (rather baffling) error indicated above. Given 
that the mistake was in one include file and the error was reported in a 
totally different include file, this took me a rather long time to track 
down. :-S

I would suggest that if #fclose is followed by the end of the current 
macro (or the end of the current file) this should at the very least 
generate a warning.

(Personally I would feel happier if both #fopen and #fclose took 
arguments in brackets like #read and #write do - but that would break 
existing scenes.)

Thanks.
Andrew.


Post a reply to this message

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