darklang / dark

Darklang main repo, including language, backend, and infra
https://darklang.com
Other
1.65k stars 90 forks source link

Tree-sitter grammar: support Constant Declaration #5377

Closed OceanOak closed 2 months ago

OceanOak commented 3 months ago

Changelog:

Tree-sitter-darklang
- Update the grammar to support Constant Declaration

5321

StachuDotNet commented 2 months ago

I would expect this to be much simpler: rather than reinvent each grammar part, the RHS of a const declaration should be a normal Expression - and in the parser side of things (or maybe later, even), that's where we could error on trying to set an 'illegal' (unsupported) constant.

Edit: Hmm - I need to think about this a bit more. In ProgramTypes, we have separate things for each legal constant option. Maybe this is OK, or maybe we should make PT a bit simpler :thinking: