Support static; improve error checking

- Add support for static (file scope only)
- Improve error checking in declarations