@willbooster/tree-sitter-haskell 8.3.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/grammar/comment.js +13 -0
- package/grammar/externals.js +5 -2
- package/grammar.js +2 -0
- package/hsc/src/node-types.json +49 -7
- package/package.json +3 -3
- package/queries/injections.scm +1 -1
- package/src/node-types.json +49 -7
- package/tree-sitter-haskell.wasm +0 -0
- package/tree-sitter-hsc.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Haskell grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), f
|
|
|
13
13
|
to its authors and contributors. This is not an official release of that project.
|
|
14
14
|
|
|
15
15
|
This fork is based on upstream's version 0.23.1 grammar and generates the parser with the
|
|
16
|
-
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries that fork's own ABI number, so it loads only with that fork's runtime, version 7.0.
|
|
16
|
+
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries that fork's own ABI number, so it loads only with that fork's runtime, version 7.0.7 or later in the 7.x series; upstream's runtime rejects it.
|
|
17
17
|
[Upstream's README at that version](https://github.com/tree-sitter/tree-sitter-haskell/blob/v0.23.1/README.md) lists
|
|
18
18
|
the supported language extensions and, under "Querying", explains how to query the grammar's supertypes; it is the
|
|
19
19
|
readme that the comments in `grammar.js` refer to.
|
|
@@ -24,7 +24,8 @@ The fork's main differences from upstream 0.23.1 are:
|
|
|
24
24
|
|
|
25
25
|
- **Whitespace**: horizontal tabs separate tokens, are accepted before Haddock markers, and advance layout to the next eight-column tab stop.
|
|
26
26
|
- **MultilineStrings**: triple-quoted literals retain their complete source as a single `string` node, including embedded quotes, escapes, and string gaps.
|
|
27
|
-
- **Comment scanning**:
|
|
27
|
+
- **Comment scanning**: comments and Haddock nodes expose a named `content` child, preserving body whitespace and excluding outer delimiters. Ordinary comment injection captures this child.
|
|
28
|
+
Empty block comments such as `{--}` terminate at their closing delimiter and preserve following code.
|
|
28
29
|
An ordinary line comment does not absorb a following marked Haddock comment.
|
|
29
30
|
Unmarked continuation lines remain in their preceding Haddock block, including space or tab indentation and LF or CRLF newlines.
|
|
30
31
|
First-column ordinary comments combine with LF line endings.
|
|
@@ -39,7 +40,7 @@ reports an error: the lexers of the WillBooster/tree-sitter generator let charac
|
|
|
39
40
|
## Usage
|
|
40
41
|
|
|
41
42
|
The npm package ships `tree-sitter-haskell.wasm` for
|
|
42
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 7.0.
|
|
43
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 7.0.7 or later in the 7.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
|
|
43
44
|
|
|
44
45
|
```js
|
|
45
46
|
import { fileURLToPath } from 'node:url';
|
|
@@ -97,7 +98,7 @@ fuzzed with:
|
|
|
97
98
|
|
|
98
99
|
```toml
|
|
99
100
|
[dependencies]
|
|
100
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "7.0.
|
|
101
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "7.0.7" }
|
|
101
102
|
tree-sitter-haskell = { package = "willbooster-tree-sitter-haskell", version = "8" }
|
|
102
103
|
```
|
|
103
104
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
|
|
3
|
+
comment: $ => choice(
|
|
4
|
+
seq('{-', $._cond_comment_block, $.content, '-}'),
|
|
5
|
+
seq(alias(/--+/, '--'), $._cond_comment_line, $.content),
|
|
6
|
+
),
|
|
7
|
+
|
|
8
|
+
haddock: $ => choice(
|
|
9
|
+
seq('{-', $._cond_haddock_block, alias(choice('|', '^'), 'haddock_marker'), $.content, '-}'),
|
|
10
|
+
seq(alias(/--+/, '--'), $._cond_haddock_line, alias(choice('|', '^'), 'haddock_marker'), $.content),
|
|
11
|
+
),
|
|
12
|
+
|
|
13
|
+
}
|
package/grammar/externals.js
CHANGED
|
@@ -98,8 +98,11 @@ module.exports = {
|
|
|
98
98
|
// Detect and emit text nodes for comments and CPP.
|
|
99
99
|
// In particular, #else branches of CPP conditionals a fully contained in the resulting node, since their nonlinear
|
|
100
100
|
// nature means they cannot be parsed.
|
|
101
|
-
$.
|
|
102
|
-
$.
|
|
101
|
+
$._cond_comment_block,
|
|
102
|
+
$._cond_haddock_block,
|
|
103
|
+
$._cond_comment_line,
|
|
104
|
+
$._cond_haddock_line,
|
|
105
|
+
$.content,
|
|
103
106
|
$.cpp,
|
|
104
107
|
$.pragma,
|
|
105
108
|
|
package/grammar.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const
|
|
2
2
|
class_ = require('./grammar/class.js'),
|
|
3
|
+
comment = require('./grammar/comment.js'),
|
|
3
4
|
conflicts = require('./grammar/conflicts.js'),
|
|
4
5
|
context = require('./grammar/context.js'),
|
|
5
6
|
data = require('./grammar/data.js'),
|
|
@@ -29,6 +30,7 @@ module.exports = grammar({
|
|
|
29
30
|
),
|
|
30
31
|
|
|
31
32
|
...general,
|
|
33
|
+
...comment,
|
|
32
34
|
...type,
|
|
33
35
|
...context,
|
|
34
36
|
...exp,
|
package/hsc/src/node-types.json
CHANGED
|
@@ -1518,6 +1518,22 @@
|
|
|
1518
1518
|
}
|
|
1519
1519
|
}
|
|
1520
1520
|
},
|
|
1521
|
+
{
|
|
1522
|
+
"type": "comment",
|
|
1523
|
+
"named": true,
|
|
1524
|
+
"extra": true,
|
|
1525
|
+
"fields": {},
|
|
1526
|
+
"children": {
|
|
1527
|
+
"multiple": false,
|
|
1528
|
+
"required": true,
|
|
1529
|
+
"types": [
|
|
1530
|
+
{
|
|
1531
|
+
"type": "content",
|
|
1532
|
+
"named": true
|
|
1533
|
+
}
|
|
1534
|
+
]
|
|
1535
|
+
}
|
|
1536
|
+
},
|
|
1521
1537
|
{
|
|
1522
1538
|
"type": "conditional",
|
|
1523
1539
|
"named": true,
|
|
@@ -3317,6 +3333,22 @@
|
|
|
3317
3333
|
}
|
|
3318
3334
|
}
|
|
3319
3335
|
},
|
|
3336
|
+
{
|
|
3337
|
+
"type": "haddock",
|
|
3338
|
+
"named": true,
|
|
3339
|
+
"extra": true,
|
|
3340
|
+
"fields": {},
|
|
3341
|
+
"children": {
|
|
3342
|
+
"multiple": false,
|
|
3343
|
+
"required": true,
|
|
3344
|
+
"types": [
|
|
3345
|
+
{
|
|
3346
|
+
"type": "content",
|
|
3347
|
+
"named": true
|
|
3348
|
+
}
|
|
3349
|
+
]
|
|
3350
|
+
}
|
|
3351
|
+
},
|
|
3320
3352
|
{
|
|
3321
3353
|
"type": "haskell",
|
|
3322
3354
|
"named": true,
|
|
@@ -6534,6 +6566,10 @@
|
|
|
6534
6566
|
"type": "-",
|
|
6535
6567
|
"named": false
|
|
6536
6568
|
},
|
|
6569
|
+
{
|
|
6570
|
+
"type": "--",
|
|
6571
|
+
"named": false
|
|
6572
|
+
},
|
|
6537
6573
|
{
|
|
6538
6574
|
"type": "->",
|
|
6539
6575
|
"named": false
|
|
@@ -6542,6 +6578,10 @@
|
|
|
6542
6578
|
"type": "->.",
|
|
6543
6579
|
"named": false
|
|
6544
6580
|
},
|
|
6581
|
+
{
|
|
6582
|
+
"type": "-}",
|
|
6583
|
+
"named": false
|
|
6584
|
+
},
|
|
6545
6585
|
{
|
|
6546
6586
|
"type": ".",
|
|
6547
6587
|
"named": false
|
|
@@ -6635,12 +6675,11 @@
|
|
|
6635
6675
|
"named": false
|
|
6636
6676
|
},
|
|
6637
6677
|
{
|
|
6638
|
-
"type": "
|
|
6639
|
-
"named": true
|
|
6640
|
-
"extra": true
|
|
6678
|
+
"type": "constructor",
|
|
6679
|
+
"named": true
|
|
6641
6680
|
},
|
|
6642
6681
|
{
|
|
6643
|
-
"type": "
|
|
6682
|
+
"type": "content",
|
|
6644
6683
|
"named": true
|
|
6645
6684
|
},
|
|
6646
6685
|
{
|
|
@@ -6701,9 +6740,8 @@
|
|
|
6701
6740
|
"named": false
|
|
6702
6741
|
},
|
|
6703
6742
|
{
|
|
6704
|
-
"type": "
|
|
6705
|
-
"named":
|
|
6706
|
-
"extra": true
|
|
6743
|
+
"type": "haddock_marker",
|
|
6744
|
+
"named": false
|
|
6707
6745
|
},
|
|
6708
6746
|
{
|
|
6709
6747
|
"type": "hiding",
|
|
@@ -6870,6 +6908,10 @@
|
|
|
6870
6908
|
"type": "{",
|
|
6871
6909
|
"named": false
|
|
6872
6910
|
},
|
|
6911
|
+
{
|
|
6912
|
+
"type": "{-",
|
|
6913
|
+
"named": false
|
|
6914
|
+
},
|
|
6873
6915
|
{
|
|
6874
6916
|
"type": "|",
|
|
6875
6917
|
"named": false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-haskell",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Haskell grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
52
52
|
"@willbooster/oxlint-config": "1.4.8",
|
|
53
53
|
"@willbooster/wb": "22.26.1",
|
|
54
|
-
"@willbooster/web-tree-sitter": "7.0.
|
|
54
|
+
"@willbooster/web-tree-sitter": "7.0.7",
|
|
55
55
|
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
56
56
|
"lefthook": "2.2.1",
|
|
57
57
|
"oxfmt": "0.72.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"wrangler": "4.147.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@willbooster/web-tree-sitter": "^7.0.
|
|
67
|
+
"@willbooster/web-tree-sitter": "^7.0.7"
|
|
68
68
|
},
|
|
69
69
|
"peerDependenciesMeta": {
|
|
70
70
|
"@willbooster/web-tree-sitter": {
|
package/queries/injections.scm
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(quoter) @injection.language
|
|
5
5
|
(quasiquote_body) @injection.content)
|
|
6
6
|
|
|
7
|
-
((comment) @injection.content
|
|
7
|
+
((comment (content) @injection.content)
|
|
8
8
|
(#set! injection.language "comment"))
|
|
9
9
|
|
|
10
10
|
; -----------------------------------------------------------------------------
|
package/src/node-types.json
CHANGED
|
@@ -1482,6 +1482,22 @@
|
|
|
1482
1482
|
}
|
|
1483
1483
|
}
|
|
1484
1484
|
},
|
|
1485
|
+
{
|
|
1486
|
+
"type": "comment",
|
|
1487
|
+
"named": true,
|
|
1488
|
+
"extra": true,
|
|
1489
|
+
"fields": {},
|
|
1490
|
+
"children": {
|
|
1491
|
+
"multiple": false,
|
|
1492
|
+
"required": true,
|
|
1493
|
+
"types": [
|
|
1494
|
+
{
|
|
1495
|
+
"type": "content",
|
|
1496
|
+
"named": true
|
|
1497
|
+
}
|
|
1498
|
+
]
|
|
1499
|
+
}
|
|
1500
|
+
},
|
|
1485
1501
|
{
|
|
1486
1502
|
"type": "conditional",
|
|
1487
1503
|
"named": true,
|
|
@@ -3227,6 +3243,22 @@
|
|
|
3227
3243
|
}
|
|
3228
3244
|
}
|
|
3229
3245
|
},
|
|
3246
|
+
{
|
|
3247
|
+
"type": "haddock",
|
|
3248
|
+
"named": true,
|
|
3249
|
+
"extra": true,
|
|
3250
|
+
"fields": {},
|
|
3251
|
+
"children": {
|
|
3252
|
+
"multiple": false,
|
|
3253
|
+
"required": true,
|
|
3254
|
+
"types": [
|
|
3255
|
+
{
|
|
3256
|
+
"type": "content",
|
|
3257
|
+
"named": true
|
|
3258
|
+
}
|
|
3259
|
+
]
|
|
3260
|
+
}
|
|
3261
|
+
},
|
|
3230
3262
|
{
|
|
3231
3263
|
"type": "haskell",
|
|
3232
3264
|
"named": true,
|
|
@@ -6327,6 +6359,10 @@
|
|
|
6327
6359
|
"type": "-",
|
|
6328
6360
|
"named": false
|
|
6329
6361
|
},
|
|
6362
|
+
{
|
|
6363
|
+
"type": "--",
|
|
6364
|
+
"named": false
|
|
6365
|
+
},
|
|
6330
6366
|
{
|
|
6331
6367
|
"type": "->",
|
|
6332
6368
|
"named": false
|
|
@@ -6335,6 +6371,10 @@
|
|
|
6335
6371
|
"type": "->.",
|
|
6336
6372
|
"named": false
|
|
6337
6373
|
},
|
|
6374
|
+
{
|
|
6375
|
+
"type": "-}",
|
|
6376
|
+
"named": false
|
|
6377
|
+
},
|
|
6338
6378
|
{
|
|
6339
6379
|
"type": ".",
|
|
6340
6380
|
"named": false
|
|
@@ -6428,12 +6468,11 @@
|
|
|
6428
6468
|
"named": false
|
|
6429
6469
|
},
|
|
6430
6470
|
{
|
|
6431
|
-
"type": "
|
|
6432
|
-
"named": true
|
|
6433
|
-
"extra": true
|
|
6471
|
+
"type": "constructor",
|
|
6472
|
+
"named": true
|
|
6434
6473
|
},
|
|
6435
6474
|
{
|
|
6436
|
-
"type": "
|
|
6475
|
+
"type": "content",
|
|
6437
6476
|
"named": true
|
|
6438
6477
|
},
|
|
6439
6478
|
{
|
|
@@ -6494,9 +6533,8 @@
|
|
|
6494
6533
|
"named": false
|
|
6495
6534
|
},
|
|
6496
6535
|
{
|
|
6497
|
-
"type": "
|
|
6498
|
-
"named":
|
|
6499
|
-
"extra": true
|
|
6536
|
+
"type": "haddock_marker",
|
|
6537
|
+
"named": false
|
|
6500
6538
|
},
|
|
6501
6539
|
{
|
|
6502
6540
|
"type": "hiding",
|
|
@@ -6655,6 +6693,10 @@
|
|
|
6655
6693
|
"type": "{",
|
|
6656
6694
|
"named": false
|
|
6657
6695
|
},
|
|
6696
|
+
{
|
|
6697
|
+
"type": "{-",
|
|
6698
|
+
"named": false
|
|
6699
|
+
},
|
|
6658
6700
|
{
|
|
6659
6701
|
"type": "|",
|
|
6660
6702
|
"named": false
|
package/tree-sitter-haskell.wasm
CHANGED
|
Binary file
|
package/tree-sitter-hsc.wasm
CHANGED
|
Binary file
|