Commit Graph

170 Commits (1d3a1f9f18c2592a7326effb5783e6d080729a3d)

Author SHA1 Message Date
susliko 4b2cbc2e7c Refactor `$.compilation_unit`, optimize grammar
Summary
-------
`$.compilation_unit` is now a sequence of top-level stats separated by
`$.semicolon`

This change has two effects:
- Grammar optimization:
  - ~10% faster generation time
  - lower number of parser states ([before](https://gist.github.com/susliko/f950b997a98c54bbfd88969a949346fd), [after](https://gist.github.com/susliko/236a85dce46219c5868c494d7f5cf629))
  - parser size reduction from 43M to 36M
- It seems to me, that handling `$._automatic_semicolon` on the top level is a
  prerequisite to support top-level expressions (https://github.com/tree-sitter/tree-sitter-scala/issues/198) and leading infix operators (https://github.com/tree-sitter/tree-sitter-scala/issues/141)
2023-05-30 01:22:14 +07:00
Eugene Yokota 4801dc8a44 Refinement
Problem
-------
Compound type with refinement (structural type with a parent)
doesn't parse.

Solution
--------
This adds support for it.
It collides with context bounds `A: B: C`, so the precedence is set to
-1.
2023-05-29 00:16:55 +07:00
susliko 42bab6dc9c Self-types in braceless trait definitions
Problem
-------
Self-types are not parsed in braceless trait definitions:
```scala
trait A:
  this: B =>
````

Solution
-------
Move existing `$.self_type` rule in trait definition into indented scope.
Rebalance `$.self_type` precedence.
Without explicit precedence it looses to `$.call_expression` in
```scala
trait A {
  self: B =>
  def f = ""
}
```
With static precedence instead of dynamic it leads to errors in
definitions like:
```scala
class A
  x: Int // this should be $.ascription_expression
enum B:
  case C
```
2023-05-28 17:43:10 +07:00
Eugene Yokota ec70a4503a val defn with ids
Problem
-------
`val` definitions with multiple identifiers are not supported.

Solution
--------
This implements `identifiers`, which acts like a pattern.
2023-05-27 21:27:28 +07:00
susliko 63493b2f45 Annotations on enums
Problem
-------
Annotations on Scala 3 enums and their cases are not supported, e.g.
```scala
@A enum E:
  @A("") @B case A

```

Solution
-------
Allow annotations in enum definitions
2023-05-28 02:44:45 +07:00
eugene yokota 8ba8016ae5
Merge pull request #251 from susliko/nested-multiline-comments
Nested block comments
2023-05-27 19:29:16 +07:00
susliko 693c651b50 Nested block comments
Problem
-------
Nested block comments are not parsed, e.g.
```
/* /* */ */
```

Solution
-------
Leave $.comment for single-line comments.
Introduce $.block_comment for block-comments.
Make $.block_comment out of several tokens to be able to detect nested
block comments
2023-05-28 01:16:58 +07:00
eugene yokota 5a6fcbdddd
Merge pull request #249 from susliko/class-lazy-params
By-name class parameters
2023-05-27 18:15:30 +07:00
susliko 2a1c3c9faf By-name class parameters
Problem
-------
By-name parameters in class definitions were not supported:
```
class A(a: => B)
```

Solution
-------
Support by-name parameters by changing the rule describing class
parameter type from `$._type` to `$._param_type`
2023-05-27 23:03:03 +07:00
susliko 4069d72047 Correct type bounds
Problem
-------
The grammar assumes upper type bound to go before lower type bound.
Although, in Scala it's the opposite:
```
TypeBounds ::= [‘>:’ Type] [‘<:’ Type]
```

Solution
-------
Swap type bounds' order in the grammar
2023-05-27 22:30:53 +07:00
eugene yokota 17a19b0f05
Merge pull request #244 from eed3si9n/wip/match_type
Match type
2023-05-27 04:12:22 +07:00
susliko bac013bec8 Better catch clause
Problem
-------
Catch-clause is not parsed when case is on the same line as 'catch':
```
try a catch b: C => d
```

Solution
-------
Intoduce `$._expr_case_clause` alternative to the catch-clause
2023-05-26 23:37:52 +07:00
Eugene Yokota 41dcb78406 Remove unnecessary precedence 2023-05-26 11:09:00 +07:00
Eugene Yokota e292682508 Match type
This implements support for Scala 3 match types.
2023-05-26 10:18:32 +07:00
Eugene Yokota 6271277c8e Symbolic import
Problem
-------
symbolic import doesn't work.

Solution
--------
This switches a few things to `_identififer`
to fix the import.
2023-05-25 22:33:08 +07:00
susliko 8cb5a00a1d Using clause in $.arguments
Problem
-------
Scala 3 introduced using clauses to function call expressions:
```scala
f(using A)
```
The grammar did not allow that

Solution
-------
Add `choice` between regular and using-clause argument lists in
`$.arguments`
2023-05-25 18:34:21 +07:00
susliko c34e34e42a Intoduce `$._class_definition`
Problem
-------
Addition of optional `$.derives_clause` to the `$.class_definition` blowed its
states from ~500 to ~700 and doubled maximum memory usage during
generation. I've noticed, that the same addition of `$.derives_clause` to
the `$.object_definition` did not result in an increase of states. The
reason for this seems to be hidden in a separate rule
`$._object_definition`, that matches everything after the 'object' keyword

Solution
-------
Introduce `$._class_definition`, that matches everything after the
'class' keyword. This restrains the state machine blow when adding
support for `$.derives_clause`
2023-05-24 23:54:19 +07:00
susliko 978c64d888 Derives clause for classes and objects
Problem
-------
Derives clause is only defined for enums, but not for classes and
objects

Solution
-------
Include optional `$.derives_clause` in class and object definitions
2023-05-24 21:07:54 +07:00
susliko 4dadee71d5 fix: case clauses with guards
Problem
-------
Guards in case clauses are thought to be lambda expressions sometimes,
e.g. in
```scala
{case a if b => c}
```
This happens, because `$.lambda_expression` has a higher parsing
precedence than `$._simple_expression`

Solution
-------
Avoid using numeric parsing precedence for `$.lambda_expression`.
Resolve specific conflicts instead
2023-05-24 19:01:40 +07:00
susliko b869fdcc35 fix: Anonymous parameters in `using` clauses
Problem
-------
`$.parameters` required each param to have a name, so `using` clauses like
`def x(using X =:= X)` failed to parse

Solution
-------
Introduce `$._using_parameters_clause`, which allows anonymous parameters
2023-05-21 23:27:17 +07:00
susliko 3a69f2c8bd fix: Anonymous alias and structural given instances 2023-05-20 00:37:04 +07:00
ghostbuster91 50e5bf3179 fix: Correctly handle _ separator in integer literals 2023-03-12 15:29:05 +07:00
Anton Sviridov cb34635bca Abstract type definitions 2023-01-28 08:50:35 +07:00
eugene yokota f7b83364c7
Fix semicolon on package (#184)
Problem
-------
Package declaration with semicolon fails to parse.

Solution
--------
This adds an optional semicolon to fix that.
2023-01-28 07:45:37 +07:00
Anton Sviridov d67e84cded
Fix `as` import renaming in Scala 3 (#175) 2023-01-24 16:01:49 +07:00
Anton Sviridov b74eb241df String interpolation case pattern 2023-01-22 16:13:24 +07:00
Eugene Yokota dc3f68fe8b Fixes pattern match with guard
Problem
-------
Currently pattern match with guard doesn't parse.

Solution
--------
This implements it by creating an intermediate node called `_case_pattern` with right associativity.
2023-01-20 11:20:49 +07:00
Eugene Yokota 944196126a Trailing commas
Problem
-------
Trailing commas are not supported.

Solution
--------
This adds support for that.
2023-01-19 01:39:30 +07:00
Chris Kipp 71b408eed0 feat: add an explicit interpolator field
_The problem_

Currently when you come across string interpolation you don't get any
special highlighting for the actual interpolator meaning:

```scala
ivy"com.lihaoyi::os-lib:0.9.0"
```

I all colored the same.

_The Solution_

The pr makes 2 changes.

- The `identifier` we use for the interpolator now becomes a field for
  no reason other than I thought it'd be nice to just give it a name
- A hightlight query that captures it and assigns it to `function.call`.
2023-01-18 08:21:39 +07:00
eugene yokota c764e31a99
Merge pull request #143 from eed3si9n/wip/annotation
Fixes annotation, sort of
2023-01-15 11:22:15 +07:00
Chris Kipp 73d5a6680c
Merge pull request #146 from eed3si9n/wip/singleton_types
Singleton type
2023-01-15 09:07:10 +07:00
Eugene Yokota 4c3cb92b4b Singleton type
Problem
-------
Currently singleton types are treated as `stable_type_identifier`.

Solution
--------
This adds `singleton_type`.
2023-01-14 15:37:55 +07:00
Eugene Yokota 8851250f35 Context function
This adds support for context function.
2023-01-14 15:04:25 +07:00
Eugene Yokota 0b7fd00750 Fixes annotation, sort of
Problem
-------
1. class constructor should accept annotation, but it doesn't.
2. Apparently Scala 3 does allow zero, one, or multiple parameter list
   to an annotation, and differentiated between the class parameter by
   its lack of type ascription.

Solution
--------
1. Add optional annotation for constructor. At this point, we can at
   least parse the code with annotation on the ctor.
2. Unfortunatley, however, tree-sitter doesn't make enough lookahead to
   distinguish postfix expr or ascription expression `(x: Int)`,
   for now the class parameters will end up being parsed as arguments to
   the annotation.
2023-01-14 00:29:24 +07:00
Eugene Yokota b5fd12eaab Fixes extends clause
Problem
-------
1. In Scala 3, extends clause can be comma separated.
2. In Scala 2 or 3 extends clause can ctor with parameters:
   `class D with E(x) with F(y)`.

Solution
--------
`extends` is now followed by *constructor applications* separated by
either `with` or `,` as opposed to treating them as a compound type.
2023-01-13 14:40:20 +07:00
Eugene Yokota fe6ff49ee8 Fix operator_identifier
Problem
-------
1. Currently `//` ends up matching `operator_identier`
2. There's also a bug in regex.

Solution
--------
1. Implement a workaround to avoid `//`.
2. Escape `-`, copying from the identifier regex.
2023-01-13 04:04:58 +07:00
eugene yokota c110fbaece
Merge pull request #128 from eed3si9n/wip/fewer_braces
SIP-44 Fewer braces support
2023-01-12 14:36:28 +07:00
eugene yokota 5991810787
Merge pull request #130 from ghostbuster91/structural-types-2
Add support for structural types
2023-01-12 13:54:45 +07:00
Eugene Yokota a7e9394935 Add support for indented_cases in colon_argument 2023-01-12 12:58:53 +07:00
Eugene Yokota ffcbfc90a9 SIP-44 Fewer braces support
Fixes https://github.com/tree-sitter/tree-sitter-scala/issues/127

Problem
-------
Currently our grammar does not support the fewer braces syntax,
which basically lets us pass the last argument as a block after `:`.

Solution
--------
This implements fewer braces support for call_expression,
infix_expression, with and without the lambda start.
2023-01-12 10:45:32 +07:00
ghostbuster91 332a3bb0fc Add support for structural types 2023-01-12 16:12:48 +07:00
Eugene Yokota 77ea27edbe Fixes instance_expression
Problem
-------
Current grammar accepts expression immeidately after `new`,
which is not correct, and doesn't work for Scala 3 syntax.

Solution
--------
This fixes it by actually using `$.template_body`.
It does create a tricky conflict between `new A: <block>`
construct and `new A: <type>`.
To deal with that, we are using `prec.dynamic`.
2023-01-11 19:15:42 +07:00
eugene yokota 8677ff40db
Creates a dummy node for import_selectors (#126)
Problem
-------
When Neovim encounters an unknown node type in the highlight query it
not only not highlight, but it displays confusing error message to the
buffer.

Solution
--------
For now, we should create a dummy node.
2023-01-11 08:24:07 +07:00
Anton Sviridov 94b7758931 Export clauses 2023-01-10 10:34:18 +07:00
Eugene Yokota 996b7849eb Fixes for expression
Fixes https://github.com/tree-sitter/tree-sitter-scala/issues/123

Problem
-------
Guard `if something` isn't supported in the for expression.

Solution
--------
This implements it.
2023-01-10 05:18:28 +07:00
eugene yokota 24daf6e55b
Merge pull request #118 from eed3si9n/wip/spec-correct
Spec-correct identifier
2023-01-10 04:48:54 +07:00
Eugene Yokota 4bb8fab0bc Don't use stable_identifier for imports
Problem
-------
stable_identifier ends up matching to things like `a.*`
so it can't be used for the import path since we want
`*` to be parsed as `import_wildcard`

Solution
--------
Make our own import path using a chain of `identifier`.
2023-01-10 04:40:08 +07:00
Eugene Yokota 0c6d589a17 Spec-correct identifier
Problem
-------
The `identifier` token is hacked together, so we never quite get the
parsing right.

Solution
--------
My friend Ethan Atkins at some point experimented with generating
tree-sitter grammar out of EBNF (https://github.com/eatkins/tree-sitter-ebnf-generator/tree/master/examples/scala)
and his identifier, as far as I know is spec-correct.
We simplified the regex a bit to fit into the tree-sitter's unsigned
short int count, but it should be comparable.
2023-01-10 04:39:47 +07:00
Anton Sviridov 6120785552
Transparent, open, infix (#119) 2023-01-10 09:03:36 +07:00
Eugene Yokota bf4102c863 Include operator-like identifier as simple expression
Problem
-------
Currently operator-like identifiers are not part of the simple
expression, so you can't call `::(123)`.

Solution
--------
This includes `$.operator_identifier` into `_simple_expression`,
and further improves the expression hierarchy.

Note that this removes test on double-prefix-expression.
It's not allowed in Scala spec to have double-prefix.
2023-01-09 18:54:50 +07:00
Anton Sviridov 80cb5ed88f Inline def, if, given, match 2023-01-09 22:48:08 +07:00
Anton Sviridov f05407f2f6 Scala 3 enums: fix simple case inheritance 2023-01-09 21:43:23 +07:00
Anton Sviridov 71e8ac0974 Test and use shadow node
- Bump dotty/scala library percentage
2023-01-09 21:04:58 +07:00
eugene yokota d6b7af22e7
Merge pull request #115 from eed3si9n/wip/self_type
Scala 2/3: Self-types
2023-01-09 15:42:53 +07:00
Anton Sviridov b2aca74cca Scala 2/3: Self-types 2023-01-09 11:53:58 +07:00
Eugene Yokota 9612c985de Extension method support 2023-01-09 11:38:16 +07:00
Chris Kipp 00c7662633
Merge branch 'master' into wip/macros 2023-01-09 10:21:12 +07:00
Eugene Yokota bede9225ce Restore symbol_literal for backward compatiblity 2023-01-09 02:27:26 +07:00
Chris Kipp 8f9d5b407c
Merge branch 'master' into wip/givens_fix 2023-01-09 08:18:04 +07:00
Eugene Yokota ce34cd5343 Scala 3 macros
Fixes https://github.com/tree-sitter/tree-sitter-scala/issues/109

This implements support for Scala 3 macros.
2023-01-09 02:08:40 +07:00
Eugene Yokota f20ce3b469 Fixes givens
Problem
-------
Current grammar doesn't handle a common givens pattern:

```
given Context = ctx
```

Solution
--------
This fixes it by denoting name etc optional.
2023-01-08 23:57:54 +07:00
Eugene Yokota efa49c8c73 Improve expression hierarchy
Problem
-------
Currently we use `$.expression` everywhere even though it often
requires much narrower set of expressions.

Solution
--------
Now that we've gained some memory budget, this adds
`_simple_expression`, mirroring the EBNF, and adjusts
`infix_expression` etc to use narrower choice of expression tokens.
With this change, the smoke test for Scala 2 library jumps to 95%.
2023-01-08 23:24:35 +07:00
Eugene Yokota 8c863108a3 Optimize codegen memory usage, part 2
Problem
-------
Memory usage already regressed a bit to 15GB.

```
$ /usr/bin/time -f  "%P %M" node_modules/.bin/tree-sitter generate
99% 15625000
```

Running

```
$ node_modules/.bin/tree-sitter generate --report-states-for-rule compilation_unit
given_definition              	4434
type_definition               	2538
function_definition           	2322
```

show that `given_definition` might be the culprit.

Solution
--------
Apply the same `class_constructor` trick to `given_definition`, enum,
`function_definition`, `function_declaration`, bringing down the memory
usage down to one (1) GB.

```
$ /usr/bin/time -f "%P %M" node_modules/.bin/tree-sitter generate
99% 1078896
```
2023-01-08 21:10:15 +07:00
eugene yokota 76b01899ba
Merge pull request #103 from keynmol/sync-and-update-highlights
Sync and improve highlighting queries, add Scala 3 specific constructs and tests
2023-01-08 12:05:36 +07:00
Anton Sviridov c69a3eccc8 Update query highlights and add tests 2023-01-08 13:42:33 +07:00
Eugene Yokota ea144d8c84 Givens instance
This implements support for givens instances.
2023-01-08 02:43:13 +07:00
Eugene Yokota fda7a2e0b1 Optimize codegen memory usage
Problem
-------
Currently codegen uses 34GB, which is more than my desktop can handle.
ahlinc kindly let us know about `--report-states-for-rule` flag to try
the identify some choke points.
To my surprise `class_definition` uses 3728 states.

Solution
--------
This adds intermediate node called `_class_constructor`, which is right
associated to deal with the modifiers, but now `class_definition` can
be left associated.

After this change:
```
$ /usr/bin/time -f "%M" node_modules/.bin/tree-sitter generate
11723152
```
This brings down memory usage to 11GB.
2023-01-08 02:11:22 +07:00
eugene yokota 27894cb8ed
Merge pull request #89 from keynmol/enums
Enums (Scala 3)
2023-01-07 13:46:20 +07:00
Anton Sviridov 3a95da330e
Merge branch 'master' into enums 2023-01-07 18:26:16 +07:00
Anton Sviridov cf65cc4b7d
Merge branch 'master' into opaque-type-alias 2023-01-07 18:05:26 +07:00
Chris Kipp 9006e28107 fix: remove hidden arrow node
This reverts a change made in
fa8d64b77e (diff-919ac210accac9ecc55a76d10a7590e3d85ca3f0e165b52d30f08faee486d0cbL140-R142)
where we introduced `_arrow`. This change will break the current neovim
highlights and we don't need it to be a named node.

refs: https://github.com/nvim-treesitter/nvim-treesitter/pull/4113
2023-01-07 15:29:38 +07:00
Anton Sviridov 94b97b7f52 Opaque type aliases [grammar, highlights, tests] 2023-01-07 13:39:57 +07:00
Chris Kipp db093957f2
Merge branch 'master' into literal-types 2023-01-07 12:09:36 +07:00
Anton Sviridov b5551b74a2 Literal types [grammar, tests] 2023-01-07 07:59:12 +07:00
Anton Sviridov d676a93f08 Enums (Scala 3) [grammar, tests] 2023-01-07 07:58:34 +07:00
Eugene Yokota 091c804ae0 Using clauses
Problem
-------
Scala 3 syntax uses `using` to denote implicit parameters.

Solution
--------
Allow both `implicit` and `using`.
2023-01-07 02:38:45 +07:00
Nathan Fulton 4c9d74120a Adds support for $ in identifiers. 2023-01-04 16:36:04 +07:00
Anton Sviridov 0d94e6ee2a Handle backquoted identifiers [grammar and tests] 2023-01-04 08:07:55 +07:00
Eugene Yokota 8c358ddf37 Scala 3 for expression 2022-12-20 11:38:51 +07:00
Eugene Yokota f440283f4f Scala 3 while expression 2022-12-20 11:38:51 +07:00
Eugene Yokota 5d129d3bd9 Scala 3 match expression 2022-12-20 11:38:51 +07:00
Eugene Yokota debb382b38 Scala 3 try-catch support 2022-12-20 11:38:51 +07:00
Eugene Yokota 83aaa6020e Fix indent/outdent tracking
Problem
-------
Given something like
    class A:
      def a() =
        ()

    def a() = 1
the scanner only outdents once, so it fails to parse the above.

Solution
--------
Track `last_indentation_size` in the payload to indicate last
outdent (default: -1). If it's not -1 that means there was an outdent.
This then checks if the last_indentation_size qualified for another
outdent.
2022-12-20 11:38:50 +07:00
Eugene Yokota fa8d64b77e Optional braces, part 2
Problem
-------
Currently Scala 3 optional braces syntax does not work.
Specifically, in this PR I want to address decls/defns not
properly grouped under the right owner in part 1.

Solution
--------
1. This brings in indent/outdent impl by keynmol
2. Introduce `_indentable_expression`.
   This allows us to limit where indent/outdent shows up without
   confusing tree-sitter too much. To start, val/def/var defn
   and if-expressions are given indentable expression.
2022-12-17 21:10:45 +07:00
Anton Sviridov 0002b5f094 Indent/Outdent external parser 2022-12-15 13:09:29 +07:00
Eugene Yokota 43d8c3b80b Optional braces, part 1
Problem
-------
Currently Scala 3 optional braces syntax does not work.

Solution
--------
This implements initial attempt on dealing with colon
instead of braces.
Note that this does not implement any indent/outdent tracking
so the second `val` onwards will not be added in `template_body`
but it should improve the highlighting a bit.
2022-12-14 22:58:38 +07:00
Stuart Mashaal 7609d81bd7 replace conflict with precedence 2022-05-22 18:44:53 +07:00
Stuart Mashaal 542a1e8e78 lambda_expression can have _block as body 2022-05-22 18:29:49 +07:00
Anton Sviridov 8599058ef2
Fix wildcard Scala 3 imports (#44) 2022-05-09 16:17:13 +07:00
Stevan Milic 0a3dd53a7f
Fix pattern definition (#38) (#39) 2021-10-10 10:34:22 +07:00
Stevan Milic 98f703493d
Add lambda expression (#34)
Fix call expression to allow block as arguments (#21)

Update for comprehension to handle patterns

Fix for comprehension to detect assignment as an enumerator

Add access modifiers

Update trait, object and class parameter to support modifiers

Update scanner to support `with` on a new line

Update function definition/declaration to support operator naming

Update field expression to support operators as methods

Co-authored-by: Stevan Milic <stevan.milic@tradecore.com>
2021-10-07 09:03:08 +07:00
Stevan Milic e79f8cd2d0
Update expression rule (#33)
* add postfix expression

* add ascription expression
2021-08-31 13:41:54 +07:00
Stevan Milic 60c3afcdea
Allow `extends` to be on a new line (#31)
Co-authored-by: Stevan Milic <stevan.milic@tradecore.com>
2021-08-29 11:14:12 +07:00
Stuart Mashaal ec38674996
add while/do loops and for-comprehension (#30) 2021-08-08 14:43:30 +07:00
Denis Pyshev f80daaa212
Miscallleneous stuff (#27)
* Null literal

* Unit expression, required for `for {...} ()` case

* Add `return` expression

* Add `throw` expression

* Apply changes per review

Remove redundant token fun call.
2021-07-19 13:26:02 +07:00
Denis Pyshev bfa2a81388
Feature/literals (#25)
* Fix typo

* Rework literals part of grammar

Introduce hierarchy of literals as it is done in Scala language grammar.
Move existing literal types into hierarcy under `literal` parent.
Add and extend literals for integer and floating point numbers.
Add test cases for integer and floating point numbers in corpus.
Adjust existing test cases to changes.

Also fixes #24

* Apply review comments

Hide `literal` node from appearing in s-expressions and increasing
amount of states.
Update test cases according to grammar change.

* Add automatic changes

Add tree-sitter dependency update by npm.
Add atomatic changes in parser and grammar from building the parser.
2021-06-23 15:37:27 +07:00
Chris Kipp fb23ed9a99
Add in support for boolean, character, and symbol literals. (#22)
* This adds in support for boolean, character, and symbol literals.

Previously we would just handle boolean literals and character literals
as identifiers, and wouldn't handle symbol literals.

* Fix CI
2021-04-01 10:11:15 +07:00
Chris Kipp f7721fd339
Enhance string interpolation model (#20) 2021-03-12 10:13:24 +07:00
Chris Kipp 63f103cc87
Allow for catch and finally in try expression to be on a new line (#16)
* Allow for catch and finally in try expression to be on a new line

* Fix actions to run on all pull requests
2021-03-12 09:41:49 +07:00
Tuấn-Anh Nguyễn 211bb726bb
Various improvements (#13)
* Add supertypes

* Support multi-line case clauses

* Allow definitions in case clauses, expressions in class/object bodies

* Add annotations, infix patterns, implicit parameters

* Add tree-sitter CLI declaration to package.json

* Add annotations on type parameters

* Add type annotations, type projections; fix compound types

* Fix operator_identifier regexp

* Add tuple types and repeated parameter types

* Give infix_pattern higher precedence than capture_pattern

* Make infix_type nestable

* Allow body-less trait_definition

* Allow omitting parens when function_type's input is a single type

* Put all alternatives function_type's parameters under parameter_types

* Give alternative_pattern lower precedence than typed_pattern

* Remove parenthesized_pattern

* Allow empty body in case_clause

* Regenerate parser
2020-07-13 13:31:00 +07:00