glsl icon indicating copy to clipboard operation
glsl copied to clipboard

Parser crashes when function-like define does not end with semicolon

Open unjello opened this issue 4 years ago • 1 comments

Parser cannot handle a case with function-like preprocessor being called without a semicolon, even if it's not technically required if proper preprocessor were run, because the semicolon is inside the definition:

#define X(x) x = 1.;

void main() {
    float f;
    X(f)
}

or it's not even required, because the definition is a for-loop:

#define X for(float i=0.; i<1.; i+= 1.) {}
void main() {
    X
}

unjello avatar Jul 12 '21 09:07 unjello

I actually have no idea how to fix it other than introducing define's lookup table and adding actual logic to the parser, which is why I've decided to work around this for now, and not to fix it this very moment. Any thoughts?

unjello avatar Jul 12 '21 10:07 unjello