Repository: JoranHonig/tree-sitter-solidity (language: python)

Issue:
Minor bugs in call_expression and _call_arguments
Thanks for the wonderful work on this parser.

I was looking at setting it up for Neovim and discovered some minor bugs in the grammar definitions regarding `call_expression` and `_call_arguments`:

### `call_expression`
I think the additional `seq()` can be removed.
https://github.com/JoranHonig/tree-sitter-solidity/blob/master/grammar.js#L647
```javascript
        call_expression: $ => seq( // <--- this `seq()` may not be necessary
            seq($._expression, $._call_arguments),
        ),
```

### `_call_arguments`
In the alternative form (which is used in cases like literal struct declaration), there is a missing `seq()`:
https://github.com/JoranHonig/tree-sitter-solidity/blob/master/grammar.js#L832-L834
```javascript
        _call_arguments: $ => prec(4,
            seq(
                '(',
                commaSep(choice(
                    $._expression,
                    seq("{", commaSep($.identifier, ":", $._expression), "}"), // <--- within `commaSep(...)`, the arguments should be wrapped in `seq()`
                )),
                ')'
            ),
        ),
```
An example of this in context can be found in the [solidity by example](https://docs.soliditylang.org/en/latest/solidity-by-example.html#voting):
![image](https://user-images.githubusercontent.com/14101781/157112222-80a24798-f08d-4700-ae42-d46d15aef15f.png)



### Reference
https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.callArgumentList
![image](https://user-images.githubusercontent.com/14101781/157110590-42dade65-b6a8-40a3-b67b-7e6cfb15273e.png)



Discussion / hints:

Fix patch:
diff --git a/grammar.js b/grammar.js
index f7ab726..fa51f86 100644
--- a/grammar.js
+++ b/grammar.js
@@ -644,7 +644,7 @@ module.exports = grammar({
                 '(',
                 commaSep(choice(
                     $._expression,
-                    seq("{", commaSep($.identifier, ":", $._expression), "}"),
+                    seq("{", commaSep(seq($.identifier, ":", $._expression)), "}"),
                 )),
                 ')'
             ),
@@ -829,9 +829,7 @@ module.exports = grammar({
             field('right', $._expression)
         )),
 
-        call_expression: $ => seq(
-            seq($._expression, $._call_arguments),
-        ),
+        call_expression: $ => seq($._expression, $._call_arguments),
 
         payable_conversion_expression: $ => seq('payable', $._call_arguments),
         meta_type_expression: $ => seq('type', '(', $.type_name, ')'),


Test patch:
diff --git a/test/corpus/expressions.txt b/test/corpus/expressions.txt
index be3754d..9459528 100644
--- a/test/corpus/expressions.txt
+++ b/test/corpus/expressions.txt
@@ -127,6 +127,7 @@ Call
 contract Example {
     function example() {
         a(b);
+        c({d: e, f: g});
     }
 }
 
@@ -135,12 +136,18 @@ contract Example {
 (source_file
   (contract_declaration
     name: (identifier)
-    body: (contract_body 
+    body: (contract_body
         (function_definition
          function_name: (identifier)
-         body: (function_body 
-            (expression_statement (call_expression 
-            (identifier) 
+         body: (function_body
+            (expression_statement (call_expression
+            (identifier)
+            (identifier)))
+            (expression_statement (call_expression
+            (identifier)
+            (identifier)
+            (identifier)
+            (identifier)
             (identifier))))))))
 
 ====================
diff --git a/test/sample/test.sol b/test/sample/test.sol
index c606261..f291dff 100644
--- a/test/sample/test.sol
+++ b/test/sample/test.sol
@@ -399,6 +399,7 @@ contract test {
         address addr;
         uint256 count;
     }
+    MyStructName({addr: myAddressVar, count: myCountVar})
 }
 contract C {
     function f() {