Commit Graph

7 Commits (99e0b3b0ae096da2883590b3563d4eb6a52a15e3)

Author SHA1 Message Date
Jonathan Arnett 94861e0161
Apply some formatting changes to README 2021-12-14 11:46:47 +07:00
Jonathan Arnett 83bad86c24 Add support for public external functions and public external types 2021-12-14 01:46:23 +07:00
Jonathan Arnett 068ae5178f Add support for external function statements 2021-12-14 01:35:59 +07:00
Jonathan Arnett eaa2cc2026 Update the TODO and TODONE lists 2021-12-14 00:11:41 +07:00
Jonathan Arnett 25c5af2aa7 Better constant type parsing, still not my favorite
Types for constants are more restricted than types for other parts of
the language. The way that the Gleam parser handles this is by having
the `parse_type` function pass along a `for_const` boolean, which is
used to limit valid subnodes. I tried replicating this functionality in
tree-sitter by creating a `parse_type($, for_const)` function, and
calling that instead of `$.type`. tree-sitter did not like this, saying
that the call stack became too deep.

Thus, I arrived at my current solution, which is simply to have
largely duplicate type rules for constants vs not-constants.

Another possible approach would be to _generate_ the type rules via a
`gen_types($, for_const)` function, which could be embedded into the
rules list like so:

```
/* Special constant types */
...gen_types($, true),

// other stuff

/* Types */
...types($, false),
```

I may try that later.
2021-12-13 17:18:55 +07:00
Jonathan Arnett 6f67643edf
Update README with notes about constants 2021-12-13 11:16:11 +07:00
Jonathan Arnett 7a820c581f Initial commit 2021-12-12 04:53:43 +07:00