Closed ckipp01 closed 2 years ago
ya, I often write code like this:
List(1,2,3).map { x =>
f(x) // maybe do slightly more complicated things than f(x)
}
I think the gramar should be able to parse this as (rougly)
(call_expression
function: (identifier)
arguments: (anonymous_function_expression))
I'm working on a PR, but I'm getting a gnarly amount of conflicts from adding anonymous_function_expression
.
(x, y) => e
looks like a tuple until the =>
. I'm really putting the G
in GLR
parser 😢
are there performance tests, or a performance test skeleton that we can add that's standard for tree-sitter-*
repos?
@stumash you got any progress on this one? I can try to resolve it if you want?
@stumash you got any progress on this one? I can try to resolve it if you want?
I got it done. I had to leave anonymous_function_expression
for another time.
Nice @stumash! I did something similar in https://github.com/tree-sitter/tree-sitter-scala/pull/34, although I didn't abstract the change into $.arguments
– that I should have. I guess we can merge yours, and then mine since I've implemented the anonymous_function_expression
i.e. lambda_expression
. I also have some additional fixes.
so didn't #34 solve this? can we close this issue?
In Scala when you have a method that expects a single parameter the parens may be replaced with curly braces. We currently don't account for this.
For example:
While a bit contrived, both of these are valid. However, currently the above will return:
The
ERROR
here should still be acall_expression
. ~I'm a little unsure what to call the{ 3 }
sincearguments
is valid, but also a bit wrong since there can only be one. So I'm trying to think if this should be likesingle_block_argument
or something like that signifying that it is a block, but an argument as well. I also can't really find reference to this in the spec to see exactly how this should be called.~ So I was a bit wrong on this, it's just a multiline block expression, but on a single line.