POV-Ray : Newsgroups : povray.programming : of and relating to parse.cpp line 7822 & 7823 : of and relating to parse.cpp line 7822 & 7823 Server Time
15 May 2024 09:47:35 EDT (-0400)
  of and relating to parse.cpp line 7822 & 7823  
From: Charles C
Date: 12 Jan 2007 04:45:00
Message: <web.45a757f351b89e832f60260@news.povray.org>
This is not a bug report - I've already mentioned it. This is about source
code which is why it's here under "programming."



"Identifier expected, incomplete function call or spline call found
instead."

I've been spending a lot of time with SDL lines like:
#local dummy_var = -1; //bug avoidance
trying to avoid that message.  It may take 1 character change, or it may
take half an hour or more of changing non-functional code so that it
doesn't error out when dealing with many splines.  In any case, I decided
to see what I could find out about what might be causing it.  I don't have
a compiler to test with or anything, and the following surely has mistakes,
but perhaps somebody might see any wrong turns or have some more insite
etc...

From parse.cpp, line 7822 & 7823:
      // no tokens have been found or a fucntion call had no parameters in
parenthesis
      if (!((Temp_Count==-1) || (Temp_Count==1000)) &&
had_callable_identifier)
         Error("Identifier expected, incomplete function call or spline call
found instead.");

The only way to not get the Error is for the if statement to be false.
(Temp_Count==-1) || (Temp_Count==1000)) && had_callable_identifier), if
true, describes the conditions in which we will not get an error.
Unfortunately that'll leave Temp_Count== almost_anything giving us an error
plus anytime had_callable_identifier==false it'll give us an error.


So.... I noticed both Parse_RValue() and Parse_Unknown_Vector() which is
called from the Parse_RValue() set their defaults of
had_callable_identifier or equivalent to false.  Parse_Unknown_Vector()
sets Identifier_In_Call to false and then does some other things and then
uses the value of Identifier_In_Call to set Parse_RValue()'s
had_callable_identifier via a pointer.

I.e. I'm looking for any place that can set one of these variables to true.

....And I noticed that Parse_Call() is the only place where
Identifier_In_Call can be set to true, so I looked for a pathway from
Parse_R_Value() all the way through Parse_Call().   Here's that chain:


Parse_RValue() >
  Parse_Unknown_Vector() >
    Parse_Rel_Factor() >
      Parse_Num_Term() >
        Parse_Num_Factor() >
          Parse_Spline_Call() >
            Parse_Call()  .... and here's the only place where
Identifier_In_Call can be set to true.



Parse_Call() will set Identifier_In_Call to true if Allow_Identifier_In_Call
is true and the next token is not a "(". Allow_Identifier_In_Call will
indeed be true since Parse_Unknown_Vector() sets it equal to
allow_identifier which is a paremeter passed from Parse_RValue() as true.

I'm likely wrong but I think had_callable_identifier probably isn't the
cause of the trouble....

Adding non-funtional code like #declare dummy_var = -1; nearby has always
affected whether I get the error or not, and would suggest that changing
the value of token_count (by adding tokens) can affect whether the error
occurs even when the difference is not between when the statements
Temp_Count = token_count; and Temp_Count -= token_count; are performed.

Note that Temp_Count = token_count; will always be performed for a spline
identifier since it's "callable".  Supposing the UNGET in Parse_Call() sets
the token_count back by one, then Temp_Count -= token_count; should equal 1,
not -1.  Is this it?


All thoughts/corrections or the ultimate fix would all be great!
Thanks,
Charles


Post a reply to this message

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