Commit Graph

19 Commits (8df06b69b0304b3ca955495f57b6ac13fd275647)

Author SHA1 Message Date
Jonathan Arnett 81670f48fa
Add support for function constants (#37) 2022-08-22 14:53:32 +07:00
Jonathan Arnett c560cb63e9 Remove note about error case tests from README 2022-03-11 14:39:48 +07:00
Jonathan Arnett fb3105752f Add Usage section to README 2022-01-04 03:42:10 +07:00
Jonathan Arnett 524b120893 Consistify style 2022-01-04 03:42:10 +07:00
Jonathan Arnett acb389971e Add very important missing 💁 emoji 2022-01-03 00:35:26 +07:00
Jonathan Arnett 7fb4cbbfdb Add syntax highlighting queries! 2022-01-03 00:26:47 +07:00
Jonathan Arnett 399ea8eca9 Merged discard_var into discard, var into identifier 2022-01-03 00:26:47 +07:00
Jonathan Arnett 7a8f36bc24 Add gotcha note about function_call node 2022-01-02 14:36:30 +07:00
Jonathan Arnett b27cc2673b Document a few gotchas 2022-01-02 13:46:52 +07:00
Jonathan Arnett 4648a013e7 Fix test
I don't really like the format of this error, but I'm not sure how much
I can do about that.
2022-01-02 13:46:52 +07:00
Jonathan Arnett dbf9063de1 "Finish" parsing
This commit primarily introduces the ability to parse custom types and
type aliases. The tests for these constructs are contained in the
subsequent commit, because they were written against the "cleaned up"
AST.
2022-01-01 19:57:20 +07:00
Jonathan Arnett 7c1ce5e840 Finished first pass at function parsing 2021-12-31 03:08:48 +07:00
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