POV-Ray : Newsgroups : povray.beta-test : Delayed syntax checking Server Time
30 Jul 2024 12:26:26 EDT (-0400)
  Delayed syntax checking (Message 1 to 2 of 2)  
From: Mike Williams
Subject: Delayed syntax checking
Date: 26 Oct 2001 00:27:15
Message: <AM3LOAABMO27EwFh@econym.demon.co.uk>
Consider this scene file

//-------------
light_source {<-100,200,-100> colour rgb 1}
camera { location  <0, 3, -4> look_at <0, 0, 0>}
declare P = function {y}
#declare Z=2;
#declare X=1;
#debug "OK so far\n"

box{1,-1 pigment {rgb 1}}
 
isosurface {
  function { P(x,y,z) }
        max_gradient 2
        contained_by{sphere{0,2}}
        pigment {rgb 1}
}
//-------------

I reckon it ought to be thrown out because there's no "#" on the first
#declare, but it renders. (I've put the isosurface there just to show
that the function P() is actually working "correctly").

Now try commenting out the #debug. The scene is now rejected, but the
reported error is 
    Parse Error: Expected 'object or directive', { found instead
reported against the box!

In this case, it's not too hard to spot the problem because it's only a
few lines away. In the complex scene that I discovered this behaviour it
was a very long way away. It was ages before I thought of looking at the
previous page of my scene to find out what was wrong with my box object.

POV 3.5b6, W98se, AMD K6-2 500, 128 Mb

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Nathan Kopp
Subject: Re: Delayed syntax checking
Date: 27 Oct 2001 18:41:05
Message: <3bdb3801$1@news.povray.org>
"Mike Williams" <mik### [at] nospamplease> wrote...
>
[clip]
> declare P = function {y}
> #declare Z=2;
> #declare X=1;
> #debug "OK so far\n"
[clip]

> I reckon it ought to be thrown out because there's no "#" on the first
> #declare, but it renders. (I've put the isosurface there just to show
> that the function P() is actually working "correctly").

Actually, it doesn't need a "#"!  This is a very old backwards-compatibility
"feature".  Interestingly enough, if you terminate the function declare with
a semicolon, it will solve the problem.

However, there does appear to be a bug somewhere, because, unless you use
the semicolon or the "#", POV will somehow ignore the first token following
the line "#declare X=1;" unless that token is a directive other than
#declare.  (For example, you can replace the #debug line with "#if(0) #end"
or even "#include "colors.inc"".)

-Nathan


Post a reply to this message

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