Closed AndrewRayCode closed 5 years ago
Here's a line from a Three.js shader which fails parsing:
const str = `vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight ) {;}`; const t = tokenize(str); const p = parse(t);
Error:
expected user defined type, struct or keyword, gotIncidentLight at line 1
It's failing in struct_or_type on this line
struct_or_type
return unexpected('expected user defined type, struct or keyword, got '+token.data)
It might be failing this check
if(token.data === 'struct') { if(!(stmt.flags & DECL_ALLOW_STRUCT)) { return unexpected('cannot nest structs') } state.unshift(struct()) return Advance }
Because the token.data isn't 'struct' even though it's a user defined struct
Actually I think this is an issue with glsl-token-descope. It doesn't descope struct names used in fn arguments
Here's a line from a Three.js shader which fails parsing:
Error:
It's failing in
struct_or_type
on this lineIt might be failing this check
Because the token.data isn't 'struct' even though it's a user defined struct