csyonghe / Spire

Other
174 stars 22 forks source link

Unify parser handling of declarations #77

Closed tangent-vector closed 7 years ago

tangent-vector commented 7 years ago

Note: this has been tested against the automated tests (such as they are), but not against the engine example (since it seems to be in a state of flux). Let me know if I should try to test against the engine before checking this in.

The big picture here is that any flavor of declaration is now allowed in any context where declarations are expected (global scope, body of a struct, body of a shader, etc.), and also any modifier keywords or attributes are allowed on any declaration (you can declare a public param int foo; at global scope).

It is (or rather, will be) up to later semantic analysis steps to rule out the cases that shouldn't be allowed, but we know that the parser won't stop us from supporting scenarios like:

You get the point.

tangent-vector commented 7 years ago

Note: this definitely breaks the GameEngine project, so please don't merge this right away.

Actually, I'll close it (again) for now.

tangent-vector commented 7 years ago

Just pushed some bug fixes, so this should be clear to merge.