POV-Ray : Newsgroups : povray.programming : Parsing an object : Re: Parsing an object Server Time
28 Jul 2024 12:33:18 EDT (-0400)
  Re: Parsing an object  
From: Ron Parker
Date: 17 Jan 2001 09:25:39
Message: <slrn96bar4.et0.ron.parker@fwi.com>
On 17 Jan 2001 09:17:21 -0500, Warp wrote:
>  How should I parse that so that it would accept any form of an object and
>not just object identifiers?

Call Parse_Object, which will return a pointer to an OBJECT or NULL if 
one wasn't found.  If you absolutely want the object to be able to appear
anywhere inside the curly braces, as it can in your code below, you will 
want to call Parse_Object between the UNGET and the EXIT in your OTHERWISE
clause.  However, I recommend calling Parse_Object before your EXPECT loop
and just requiring it to be the first thing inside the curly braces.

Also, since Parse_Object already recognizes OBJECT_ID_TOKENs as objects,
you can remove that CASE.

Remember to free up the object when you're done with it (even if it was
an object ID; Parse_Object makes a copy.)

>  I'm currently parsing it this way:
>
>    EXPECT
>      CASE (OBJECT_ID_TOKEN)
>        Object = Token.Data;
>      END_CASE
>
>      ... (parsing of the other allowed keywords here) ...
>
>      OTHERWISE
>        UNGET
>        EXIT
>      END_CASE
>    END_EXPECT
>
>
>  How should I modify that?    


-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

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