I'm tackling variables now, and I'm pretty confident how it will work. Scoping rules are lexical. So, works like C/C++. Each scope can have 1 (1!!!) assignment of a variable. Multiple assignments just overwrite each other. So for instance:
Code: Select all
...
set $diffuseColor "1 1 1 0"
diffuse $diffuseColor
set $diffuseColor "1 0 0 1"
specular $diffuseColor
...
Above I used the set $varName <value> form. What do you all think about that? It seems reasonable to me for variable assignment, though I'm sure there is a more elegant format. Then again, this is very explicit and I'm a fan of that. I was thinking maybe we should distinguish the set keyword a little more. Variables start with '$' and no other keyword can start with that character. Maybe "set" can become "%set". Since this is almost like a pre-processing phase during compilation, I don't want this processing to "get in the way" of things like properties which may have the word "set" in them somewhere.
With regards to what is legal as values. Either a single token such as
Code: Select all
set $var 1
Code: Select all
set $var "affector Test
{
position $x $y $z
}"
Code: Select all
Particles/Test : Particles/Base{
set $x 10
set $y 10
set $z 15
$var
}