hadronized / glsl

GLSL parser for Rust
191 stars 27 forks source link

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

Open unjello opened 3 years ago

unjello commented 3 years ago

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 commented 3 years ago

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?