haxiomic / haxe-glsl-parser

GLSL ES 1.0 parser in Haxe
MIT License
26 stars 7 forks source link

Error parsing macro expression with field access #12

Open deanm opened 7 years ago

deanm commented 7 years ago
#define CLAMP01(x) clamp(x, 0.0, 1.0)

float x = CLAMP01(a - b);

Compiles fine, but:

#define CLAMP01(x) clamp(x, 0.0, 1.0)

float x = CLAMP01(a - b.x);

Results in a syntax error

haxiomic commented 7 years ago

Thanks for the report, seems to be caused triggered when the field access name is the same as the macro argument

#define CLAMP01(cat) clamp(cat, 0.0, 1.0)

float x = CLAMP01(a.y - b.cat);

now if we do anything except b.cat it will process correctly