Switch to tree-sitter-dart-orchard #557

Merged
wetneb merged 2 commits from wetneb/dart_update into main 2025-08-02 09:40:00 +02:00 AGit
Owner

New version of #405, updating the grammar to a new version.
I fixed an issue in the grammar which meant that semicolons were treated as direct children of class bodies, hence the test failure that we noticed in #405.

New version of #405, updating the grammar to a new version. I fixed an issue in the grammar which meant that semicolons were treated as direct children of class bodies, hence the test failure that we noticed in #405.
wetneb changed title from Switch to tree-sitter-dart-orchard to Switch to tree-sitter-dart-orchard 2025-08-01 23:20:34 +02:00
ada4a approved these changes 2025-08-01 23:27:19 +02:00
ada4a left a comment
Owner

LGTM, but I'd wait for @HannesGitH's input as well

LGTM, but I'd wait for @HannesGitH's input as well
Author
Owner

I was a bit worried that the semicolon issue was the tip of the iceberg, so I ran a benchmark before and after this PR:

Language Cases Exact Format Conflict Differ Parse Panic Time (s)
*.dart 185 -2 (-1.1%) -1 (-0.5%) +13 (+7.0%) -11 (-5.9%) +0 +1 (+0.5%) +0.003 (+11.7%)
↓ Before \ After → Exact Format Conflict Differ Parse Panic
Exact 25 3
Format 1 20
Conflict 49 1
Differ 11 72
Parse 3
Panic

Yay, another panic!

thread '<unnamed>' panicked at src/ast.rs:320:30:
byte index 32 is not a char boundary; it is inside '个' (bytes 31..34) of `=
    '\r\r\r\r\r\r本APP属于个人的非赢利性开源项目,以供开源社区使用,凡本APP转载的所有的文章 、图片、音频、视频文件等资料的版权归版权所有人所有,本APP采用的非本站原创文章及图片等`[...]

Also the new conflicts seem like they're worth inspecting as they are likely a symptom for a new problem in the grammar.

I was a bit worried that the semicolon issue was the tip of the iceberg, so I ran a benchmark before and after this PR: | Language | Cases | Exact | Format | Conflict | Differ | Parse | Panic | Time (s) | | -------- | ----- | ----- | ------ | -------- | ------ | ----- | ----- | -------- | | `*.dart` | 185 | -2 **(-1.1%)** | -1 **(-0.5%)** | +13 **(+7.0%)** | -11 **(-5.9%)** | +0 | +1 **(+0.5%)** | +0.003 (+11.7%) | | ↓ Before \ After → | Exact | Format | Conflict | Differ | Parse | Panic | | ------------------ | ----- | ------ | -------- | ------ | ----- | ----- | | Exact | 25 | | **3** | | | | | Format | **1** | 20 | | | | | | Conflict | | | 49 | | | **1** | | Differ | | | **11** | 72 | | | | Parse | | | | | 3 | | | Panic | | | | | | | Yay, another panic! ``` thread '<unnamed>' panicked at src/ast.rs:320:30: byte index 32 is not a char boundary; it is inside '个' (bytes 31..34) of `= '\r\r\r\r\r\r本APP属于个人的非赢利性开源项目,以供开源社区使用,凡本APP转载的所有的文章 、图片、音频、视频文件等资料的版权归版权所有人所有,本APP采用的非本站原创文章及图片等`[...] ``` Also the new conflicts seem like they're worth inspecting as they are likely a symptom for a new problem in the grammar.
Owner

ah, the panic is because we take the first 32 bytes of a &str, but that happens not to lie on a character boundary in this case

ah, the panic is because we take the first 32 _bytes_ of a `&str`, but that happens not to lie on a character boundary in this case
First-time contributor

Lgtm as well

All forks of the original tree-sitter-dart (including the one I proposed) seem rather dead so I think it's reasonable to host and use a new fork

Lgtm as well All forks of the original tree-sitter-dart (including the one I proposed) seem rather dead so I think it's reasonable to host and use a new fork
wetneb force-pushed wetneb/dart_update from 0924bf4d04 to 8dd701eeb7 2025-08-02 09:35:58 +02:00 Compare
wetneb merged commit 1a06c43fd1 into main 2025-08-02 09:40:00 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: mergiraf/mergiraf#557
No description provided.