(Note: this PR builds on the earlier one for parser error recovery)
The basic idea here is to funnel all parsing of declarations through one place, so that the parser no longer enforces any restrictions on where declarations can appear, or how they can nest. As a result, it is now possible to syntactically represent things like:
A global variable declaration
A "member function" declaration inside a struct type
A module nested inside another module
Actually making any of those cases work is, of course, work for another day.
Probably the most contentious bits of this PR are:
I removed the notion of "alternate names" for components, since they are completely unlike other declaration forms, and conflict with HLSL semantic syntax
I removed the ability to declare multiple variables per statement, like int a, b. This could be re-introduced if we decide we need it (and we may), but if we do it I wanted to do it in a less kludgy way.
(Note: this PR builds on the earlier one for parser error recovery)
The basic idea here is to funnel all parsing of declarations through one place, so that the parser no longer enforces any restrictions on where declarations can appear, or how they can nest. As a result, it is now possible to syntactically represent things like:
struct
typeActually making any of those cases work is, of course, work for another day.
Probably the most contentious bits of this PR are:
I removed the notion of "alternate names" for components, since they are completely unlike other declaration forms, and conflict with HLSL semantic syntax
I removed the ability to declare multiple variables per statement, like
int a, b
. This could be re-introduced if we decide we need it (and we may), but if we do it I wanted to do it in a less kludgy way.