This was 'soft-removed' in the past by removing the highlights and test
cases but we held off on fully removing the parser support. This
finishes the job so that 'try' is no longer treated as a keyword.
This should fix the integration tests. Previously they would fail
against some code in the stdlib which used 'try' as a regular variable
name.
This improvement was mentioned in the v0.31.0 release notes. This is
already supported so all I've done is remove the comment about how the
behavior does not yet exist upstream and add a test case.
Previously the 'use' node would have many 'identifier' or pattern nodes
and, with the parent commit, types as well. This change should make it
easier to figure out which children nodes of 'use' are associated with
one another.
Co-authored-by: Jonathan Arnett <jonarnett90@gmail.com>
This makes me a little uneasy, as the way that the Gleam parser parses
"let assert" is that it first parses "let", then calls
"parse_assignment" which will look to see if an "assert" comes next,
and uses this information to choose the node type.
I think a closer tree-sitter implementation would look like this:
_statement: ($) => choice($._expression, $._assignment, $.use),
...
_assignment: ($) => choice($.let, $.let_assert),
let: ($) => seq("let", $._assignment2),
let_assert: ($) => seq("let", "assert", $._assignment2)
_assignment2: ($) =>
...
However this requires an awkward "_assignment2" and isn't
substantially closer to the Gleam parser to warrant the change.
Also we could simply do `optional("assert")`, but that would make
"let" and "let assert" the same node type, which I suspect is an anti-feature.
With the latest changes to the gleam parser, code that uses let/use as
expressions is now rejected. This change reorganizes let and use under
a new '_statement' rule. This restricts let/use from taking other
let/use statements since they only accept expressions.