Commit Graph

385 Commits (d24467932b917f97a670a98f8d580453818b0b10)
 

Author SHA1 Message Date
eugene yokota d24467932b
Merge pull request #277 from susliko/rework-lambda-expressions
The Gordian Knot
2023-06-08 10:50:11 +07:00
susliko a889c3c749 Rework lambda expressions
Summary
-------
`$.lambda_expression` body was changed from `$._block` to
`$._indentable_expression`. This had the following effects:
* x10 faster parser generation
* parser size reduced from 41M to 24M
* conflict with `$.self_type`, which was resolved by matching
  indent-tokens in `$.template_body`. This change, in its turn required
  scanner.c to stop emitting INDENT and OUTDENT tokens when encountering
  comments
2023-06-08 17:20:52 +07:00
eugene yokota d24edb6bf2
Merge pull request #288 from eed3si9n/wip/test_c_code
Fix C code fidelity check
2023-06-08 09:43:57 +07:00
Eugene Yokota 5029432a9e Fix C code fidelity check
Problem
-------
There's C code fidelity check in the CI process, but over time it seems
to have broken.
`needs.changedfiles.outputs.c` gets triggered for either `src/scanner.c`
or the generated `src/parser.c`, then the fidelity check logic
expects that `git diff` will be empty.
This actually won't work if you changed both `src/parser.c` and `grammar.js`
at the same time.

Solution
--------
The fix is to make a new `changedfiles.outputs.gen`. Now the new
behavior is:
1. If any C code were changed (including `src/parser.c`), run full tests
   on all 3 Oses.
2. If non-`src/parser.c` C code were changed, run fidelity check on
   Linux.
2023-06-08 09:27:01 +07:00
Chris Kipp 007a1845a4
Merge pull request #290 from tree-sitter/generation
chore: generate and sync latest changes
2023-06-08 07:12:59 +07:00
GitHub 3f6020a1ad chore: generate and sync from cd3a29c9f7 2023-06-08 05:07:00 +07:00
eugene yokota cd3a29c9f7
Merge pull request #285 from eed3si9n/wip/extends 2023-06-07 08:10:50 +07:00
Eugene Yokota cacf8d3668 scalac to 89% 2023-06-07 04:32:32 +07:00
Eugene Yokota 7c13fa896b Optimize complexity 2023-06-07 04:13:46 +07:00
Eugene Yokota 7ca15b8b78 Fix structural type in extends
Problem
-------
Structural type in extends clause fail to parse.

Solution
--------
This adds structural_type to the simple_type.
2023-06-07 02:48:06 +07:00
eugene yokota 97d88301d3
Merge pull request #284 from tree-sitter/generation
chore: generate and sync latest changes
2023-06-07 01:29:14 +07:00
GitHub acae6ddd46 chore: generate and sync from 51377c11e4 2023-06-07 05:08:19 +07:00
eugene yokota 51377c11e4
Merge pull request #278 from eed3si9n/wip/format
Use prettier to format JavaScript file
2023-06-06 11:17:18 +07:00
Eugene Yokota c340535fef Ignore the formatting commit 2023-06-06 11:00:40 +07:00
Eugene Yokota 0a8ca4c836 Apply format 2023-06-06 11:00:02 +07:00
Eugene Yokota c0c0862da6 Format JavaScript file automatically 2023-06-06 10:46:44 +07:00
eugene yokota e714736a88
Merge pull request #281 from eed3si9n/wip/repeat_pattern 2023-06-06 09:57:11 +07:00
Chris Kipp 2e32a0bd06
Merge pull request #282 from domaspoliakas/block-comment-highlighting
Added block comments to the comment highlighting query
2023-06-06 12:53:09 +07:00
Domas Poliakas e0b4206942 Added block comments to the comment highlighting query 2023-06-06 11:55:23 +07:00
eugene yokota a48f466ae5
Merge branch 'master' into wip/repeat_pattern 2023-06-06 03:06:55 +07:00
eugene yokota 5e1fcd9c32
Merge pull request #279 from eed3si9n/wip/closing_paren
Allow closing paren/bracket to outdent
2023-06-06 03:06:36 +07:00
Eugene Yokota 2d2e89f92c Repeat pattern
Problem
-------
1. Repeat pattern with `*` doesn't parse.
2. Capture pattern `@` doesn't capture wildcard.

Solution
--------
1. This implements support for `*` in pattern.
2. This also allows using `_@`.
2023-06-06 02:57:38 +07:00
Chris Kipp c09c917c28
Merge pull request #280 from eed3si9n/wip/cargo
Fix typo in Cargo.toml
2023-06-06 08:41:15 +07:00
Eugene Yokota 55126bbadd Fix typo in Cargo.toml
Problem/Solution
----------------
This fixes a typo in Cargo.toml.
2023-06-06 01:53:29 +07:00
Eugene Yokota fc8ac917ab 82% on Dotty 2023-06-06 01:26:06 +07:00
Eugene Yokota 38137ff97f Allow closing paren/bracket to outdent
Problem
-------
Braceless syntax can terminate with closing paren or bracket
of the outer context, but we don't support that.

Solution
--------
This changes the scanner so when an outdent is expected,
closing paren or bracket can inject an outdent.
2023-06-06 00:57:55 +07:00
eugene yokota 236c7b20db
Merge pull request #274 from tree-sitter/generation
chore: generate and sync latest changes
2023-06-01 12:56:27 +07:00
GitHub 141174ac05 chore: generate and sync from 9d71af4641 2023-06-01 05:09:06 +07:00
eugene yokota 9d71af4641
Merge pull request #273 from susliko/using-directive
Support Scala CLI using directives
2023-05-31 22:34:38 +07:00
susliko 5da643806c Support Scala CLI using directives
Summary
-------
Single line `$.comment` is split into a choice of `$._comment_text` and
`$.using_directive` to parse a structure of comments like
```
//> using scala 3.3.0
```
2023-05-31 23:04:52 +07:00
Kasper Kondzielski 2a837f80f3
Enable parser on sbt files (#210) 2023-05-31 14:07:58 +07:00
eugene yokota e7f7d01630
Merge pull request #272 from tree-sitter/generation 2023-05-31 01:51:11 +07:00
GitHub 066863b5c5 chore: generate and sync from 305504c509 2023-05-31 05:07:01 +07:00
eugene yokota 305504c509
Merge pull request #237 from susliko/soft-keyword-identifiers
Allow soft keywords as identifiers
2023-05-30 22:23:43 +07:00
susliko 09b54b93f8 Document relative precedences 2023-05-31 00:53:05 +07:00
susliko 64dff7f7f1 Smoke test accuracy for scala compiler is 87 now 2023-05-30 23:39:38 +07:00
susliko 4da42f4e71 Allow soft keywords as identifiers
Problem
-------
Soft keywords ('open', 'end', 'infix', etc.) are not allowed to be used
as identifiers, e.g. in
```
open()
```
Solution
-------
Introduce `$._soft_identifier` with a lower precedence than modifiers
2023-05-30 23:25:52 +07:00
eugene yokota 4684dd84a9
Merge pull request #271 from susliko/top-level-expressions
Top-level expressions
2023-05-30 11:09:18 +07:00
susliko 03d1848437 Top-level expressions
Problem
-------
Top-level expressions are not supported. However, it's a valid case for
Scala scripts or sbt configurations

Solution
-------
Now that AUTOMATIC_SEMICOLON tokens are handled at the top-level
enabling top-level expressions is done by including `$.expression` into
`$._top_level_definition`
2023-05-30 12:29:35 +07:00
Chris Kipp fad8ec3fca
Merge pull request #269 from susliko/refactor-compilation-unit
Refactor `$.compilation_unit`, optimize grammar
2023-05-30 08:43:07 +07:00
eugene yokota dacd7bdbe2
Merge pull request #270 from tree-sitter/generation 2023-05-30 01:22:27 +07:00
GitHub 9a6d34fe15 chore: generate and sync from 4e59461b19 2023-05-30 05:07:41 +07:00
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 4e59461b19
Merge pull request #266 from eed3si9n/wip/refinement 2023-05-29 17:31:12 +07:00
eugene yokota 798ec78940
Merge pull request #268 from tree-sitter/generation
chore: generate and sync latest changes
2023-05-29 01:35:16 +07:00
eugene yokota 4b7736c6e3
Merge branch 'master' into wip/refinement 2023-05-29 01:34:08 +07:00
GitHub 856e122af6 chore: generate and sync from 58e25588ae 2023-05-29 05:06:13 +07:00
eugene yokota 551e4eac07
Merge pull request #267 from eed3si9n/wip/smoke_dotty
Use Scala 3.3.0 for smoke test
2023-05-29 01:04:30 +07:00
Eugene Yokota 9725cac29a Use Scala 3.3.0 for smoke test 2023-05-29 00:55:03 +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