rmordechay/glsl-plugin-idea

Error on unintialized struct array

Closed this issue · 3 comments

Hey im having the plugin report an error when i create a struct array variable without initializing it. This seems to compile fine under vulkan but the plugin is not happy.

CastRecord[MAX_DEPTH] steps;
//                   ^ ERROR: ',' or ';' expected, got 'steps'

Plugin version: 1.0.6 (223 fork)

Hi @alphaqu
Im currently in a vacation. Will be back in 2 weeks. I will look into it once I'm back.

I checked that. This seemingly naive problem is pretty hard to solve and is at the core of a pretty hard problem that I still haven't found a way to solve. I want to push first some small changes that I did and have a look at that later.

If you are interested in the details of what is the problem: the parser cannot differentiate (well) between variables and types, as both are just names. In your case, the parser think it's a variable, where in fact it's a type, and a variable is not allowed for this syntax (only types), so it throws an error. (that's why vulkan has no problem with it). So the goal is to make the parser understand that in this case it's a type and not a variable, and then it'll work. But this is hard to accomplish.

hi @alphaqu this can be closed no?