POV-Ray : Newsgroups : povray.beta-test : v3.8 parse issue related to bare 'global' and 'local' keywords Server Time
23 Jun 2024 11:18:46 EDT (-0400)
  v3.8 parse issue related to bare 'global' and 'local' keywords (Message 1 to 1 of 1)  
From: William F Pokorny
Subject: v3.8 parse issue related to bare 'global' and 'local' keywords
Date: 21 Oct 2023 09:10:05
Message: <6533cdad$1@news.povray.org>
While fixing parsing issues in the povr/v4.0 fork's newer parser related 
to the 'global' and 'local' keywords, I found some are also exposures in 
the v3.8 beta 2 release too. Namely, some bare word situations are not 
being flagged that the source code intends to be errors - and which 
should be parse errors.

Code like:




// Which are more likely to come up where a user might try:

#local   localDict = local
#declare globalDict = global


// Neither assignment above works properly, but the v3.8 parser does
// not complain. The povr fork's parser will in the next release.


I only briefly looked at the relate v3.8 source, but the cause in both 
the old and new parsers looks to be the same.

In the file parser_tokenizer.cpp and the function Parser::Read_Symbol() 
there is code related to handling the two pseudo dictionaries. Look for 
the text 'pseudoDictionary'. In that code there is a line which reads:

Get_Token(); // ensures the error is reported at the right token

Delete the line or comment it. What happens is that call to Get_Token() 
- one intended to better point to the error column position - jumps the 
parsing state ahead if the next token is '#'. In other words, it jumps 
the parser past the following Warning() and Expectation_Error() calls!

Weird, but, it is what it is.

Bill P.

Post a reply to this message

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