POV-Ray : Newsgroups : povray.advanced-users : dot-notation not allowed in functions? : Re: dot-notation not allowed in functions? Server Time
27 Apr 2024 12:36:25 EDT (-0400)
  Re: dot-notation not allowed in functions?  
From: Thorsten Froehlich
Date: 3 Aug 2018 12:55:01
Message: <web.5b6488b0497a6101e31d9a330@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> I don't see an issue there.

Well, I implemented that part of the parser, and I do ;-)

> It would be a valid point if the dot operator were to be implemented as
> an operation in the function VM.

The dot operator isn't the problem. The preprcessor declares, locals and macro
argument names are.

> However, since we are talking about `SDL_VARIABLE.x` (and siblings)
> here, and not `FUNCTION_PARAMETER.x`, I see no sound reason why the
> function parser couldn't resolve the operation at parse-time.
>
> The rule would be pretty simple:
>
> If the token is an SDL variable holding a vector or colour, take a peek
> at the next token. If that token is a dot, expect a component name, and
> inject the respective value into function. If the token is not a dot (or
> the component name is invalid), raise an error.

Good luck trying. You end up making a copy of most of the identifer parser code
to support this, with lots of modifications to code that is already one of the
most fragile pieces of the regular parser, just to exclude macros and other
unwanted features getting in the way. Of cource it would "work", just that the
code would be a nightmare to support.


Post a reply to this message

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