glsl-man icon indicating copy to clipboard operation
glsl-man copied to clipboard

Failures with macro functions

Open DiThi opened this issue 7 years ago • 1 comments

I'm back

glsl.parse(`void main(){
#define thing(a, b, c) \
{ \
	a *= b+c; \
}
	uint a = 2u;
}`)

Error:

	uint a = 2u;
             ^
Expected "(" but "a" found.

It also fails with single line macros without { }, although the error is different I think.

DiThi avatar Sep 07 '17 12:09 DiThi

This is a fun one: three problems in one. First, indeed multi-line macros fail to parse and also the code generator did not generate parameter lists for macros. The above example unfortunately does not produce a multi-line macro, but it seems to cause a different issue where parsing fails if a variable declaration after a define has leading indentation.

I have to admit, it's a bit of a head scratcher, so I will have to look at this with rested eyes.

lammas avatar Sep 11 '17 20:09 lammas