POV-Ray : Newsgroups : povray.beta-test : Restructured Parser wants Testing : Re: Restructured Parser wants Testing Server Time
23 Apr 2024 16:06:04 EDT (-0400)
  Re: Restructured Parser wants Testing  
From: clipka
Date: 24 May 2018 13:35:43
Message: <5b06f7ef$1@news.povray.org>
Am 24.05.2018 um 18:07 schrieb Bald Eagle:

> Is it possible to write a simple read/write SDL file to open and process another
> malformed SDL file and write it with the correct forms?

It is -- for generous definitions of "possible" ;)

POV-Ray isn't particularly good at doing string operations.

> Not ideal but it (perhaps naively) seems like it would be a simple workaround.

I've now decided to go for a different approach: Translating each string
literal into two values, one to be used in generic contexts (with escape
sequences resolved), and another to be used in contexts where filenames
are expected (with escape sequences ignored). This leaves it up to the
parser proper to decide whether it wants one or the other.


One remaining issue would be the treatment of `\"`: If we wanted to
ignore all escape sequences, this should be interpreted as a backslash
followed by the end of the string, but in all other contexts it should
be interpreted as a literal double quote character; so even deciding
where the string ends would be a context-sensitive thing.

Fortunately, this is more of an academic issue, as trailing backslashes
aren't valid in file names anyway. (Directories, yes, but then they
would have to be combined with filenames via `concat` to form a valid
file name, and there the context would again be considered generic.)
Also, POV-Ray v3.7.0 already treats `\"` as escaped double quote even in
filenames (despite the character not even being valid there), and
according to the v3.0 docs this has always been the case.


Post a reply to this message

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