In order to catch the error of function inside struct
it was necessary to modify the grammar to allow function definitions
and declarations inside "struct" definitions (just like classes,
interfaces and ShaderResourceGroups), this way
the ANTLR parser would let it pass, giving the chance for AZSLc
to provide a meaningful error message.
ANTLR Syntax Error message:
"no viable alternative at input
structParallaxMapping{Texture2Dm_depthMap;floatm_depthFactor;boolm_isHeightmap;floatm_parallaxShadowFactor;float2GetParallaxUV("
New AZSLc produced Error message:
"function_declared_in_struct.azsl(14,4) : Syntax error #516: structs
cannot have member functions; consider using a class."
In order to catch the error of function inside struct it was necessary to modify the grammar to allow function definitions and declarations inside "struct" definitions (just like classes, interfaces and ShaderResourceGroups), this way the ANTLR parser would let it pass, giving the chance for AZSLc to provide a meaningful error message.
ANTLR Syntax Error message: "no viable alternative at input structParallaxMapping{Texture2Dm_depthMap;floatm_depthFactor;boolm_isHeightmap;floatm_parallaxShadowFactor;float2GetParallaxUV("
New AZSLc produced Error message: "function_declared_in_struct.azsl(14,4) : Syntax error #516: structs cannot have member functions; consider using a class."
Signed-off-by: garrieta garrieta@amazon.com