Closed savq closed 1 year ago
Very nice, I will close https://github.com/tree-sitter/tree-sitter-julia/pull/43 in favor of getting this one through.
Could you also add support for empty functions, for example function f end
. These are often used to add docstrings.
This is awesome, thanks!
Just wanted to report a minor issue I found in which sometimes type assertions can be parsed as symbols, see this example
Another minor issue, the β
character in for
loops is not being recognized (should be @keyword.operator
to match in
).
Just wanted to report a minor issue I found in which sometimes type assertions can be parsed as symbols, see this example
@ExpandingMan The PR fixes this π
Another minor issue, the β character in for loops is not being recognized (should be @keyword.operator to match in).
This can be fixed in either the grammar or the queries, and it's a bit unrelated to the rest of the PR. I'll add a fix for this in nvim-treesitter first.
Ok. All the updated rules and their correspoding tests should be ready.
Should this be merged, @maxbrunsfeld ? Seems like a significant improvement.
Regarding slurp_expression
, would splat_expression
be more appropriate? I see ...
described as the "splat operator" more than anything else. You'll also see it called the "splat operator" (but not the "slurp operator") in Python, Ruby, and other places.
I wrote the wrong thing in the PR comment (I updated it). For future reference:
spread_parameter
was renamed to slurp_parameter
(here)spread_expression
was renamed to splat_expression
(in #83)That's the "correct" naming convention in Julia. See What does the ...
operator do?
Types and modules
Functions
where
clauses.function() ... end
). Consider them function definitions, not function expressions.Function parameters and scoped identifiers
do_clause
.spread_parameter
toslurp_parameter
(yes, that's the real name)._primary_expression
andprefixed_string_literal
as types intyped_parameter
andreturn_type
.Misc
selected_import
and_import_list
. These cannot be used in the same import statement.Caveats:
where
is actually a binary operator. It can be used in places beyond function definitions. A new rule could be added in the future to handle more use cases._parameter
rule as suggested here, but this caused more conflicts than necessary.do_clause
parameters mandatory.assignment_expression
still allowscall_expression
in the LHS....
a "slurp" comes from here: What does the...
operator do?Once assignment patterns are fixed, these conflicts could be removed (and
_parameter
could finally be added), but I think that belongs in another PR.Closes #26 Closes #40 Closes #41 Closes #42 Closes #36, but the implementation is different from #43 Closes #57 Closes #60 Closes #61 Closes #63