@willbooster/tree-sitter-haskell 3.0.0 → 4.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 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 4.0.2 or later in the 4.x series; upstream's runtime rejects it.
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 6.0.0 or later in the 6.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.
@@ -22,6 +22,7 @@ readme that the comments in `grammar.js` refer to.
22
22
 
23
23
  The fork's main differences from upstream 0.23.1 are:
24
24
 
25
+ - **Whitespace**: horizontal tabs separate tokens, are accepted before Haddock markers, and advance layout to the next eight-column tab stop.
25
26
  - **MultilineStrings**: triple-quoted literals retain their complete source as a single `string` node, including embedded quotes, escapes, and string gaps.
26
27
  - **Comment scanning**: empty block comments such as `{--}` terminate at their closing delimiter and preserve following code.
27
28
  An ordinary line comment does not absorb a following marked Haddock comment.
@@ -42,7 +43,7 @@ reports an error: the lexers of the WillBooster/tree-sitter generator let charac
42
43
  ## Usage
43
44
 
44
45
  The npm package ships `tree-sitter-haskell.wasm` for
45
- [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 4.0.2 or later in the 4.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
46
+ [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 6.0.0 or later in the 6.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
46
47
 
47
48
  ```js
48
49
  import { fileURLToPath } from 'node:url';
@@ -88,8 +89,8 @@ fuzzed with:
88
89
 
89
90
  ```toml
90
91
  [dependencies]
91
- tree-sitter = { package = "willbooster-tree-sitter", version = "4.0.2" }
92
- tree-sitter-haskell = { package = "willbooster-tree-sitter-haskell", version = "3" }
92
+ tree-sitter = { package = "willbooster-tree-sitter", version = "6.0.0" }
93
+ tree-sitter-haskell = { package = "willbooster-tree-sitter-haskell", version = "4" }
93
94
  ```
94
95
 
95
96
  ```rust
@@ -129,7 +130,7 @@ and the release build regenerate the parsers before compiling them.
129
130
  edits each corpus case at random, reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`,
130
131
  `TREE_SITTER_ITERATIONS`, and `TREE_SITTER_EDITS` run other or more edits;
131
132
  - a check that the real-world Haskell files in `examples/`, the checked-in ones and those of the cloned repositories, fail to
132
- parse exactly as listed in `script/known-failures.txt`; upstream's prebuilt parser fails on the same files. The first run clones the repositories. The example repositories are pinned to commits in
133
+ parse exactly as listed in `script/known-failures.txt`. The first run clones the repositories. The example repositories are pinned to commits in
133
134
  `script/parse-examples`. After a grammar change or a moved pin alters that list, `script/parse-examples` rewrites it;
134
135
  review its diff before committing;
135
136
  - a performance check (`test/unit/performance.test.ts`) that recovering from an error on each line takes linear
@@ -26,8 +26,8 @@ module.exports = {
26
26
 
27
27
  char: _ => magic_hash(
28
28
  choice(
29
- /'[^']'/,
30
- /'\\[^ ]*'/,
29
+ /'[^'\r\n\f]'/,
30
+ seq("'\\", choice("'", /[^'\p{White_Space}]+/), "'"),
31
31
  ),
32
32
  ),
33
33
 
package/grammar.js CHANGED
@@ -51,11 +51,9 @@ module.exports = grammar({
51
51
  ...inline,
52
52
  ...conflicts,
53
53
 
54
- /**
55
- * These rules may occur anywhere in the grammar and don't have to be specified in productions.
56
- */
57
54
  extras: $ => [
58
55
  /\p{Zs}/,
56
+ /\t/,
59
57
  /\n/,
60
58
  /\r/,
61
59
  $.cpp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-haskell",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "Haskell grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -48,7 +48,7 @@
48
48
  "@willbooster/oxfmt-config": "1.2.2",
49
49
  "@willbooster/oxlint-config": "1.4.8",
50
50
  "@willbooster/wb": "22.26.1",
51
- "@willbooster/web-tree-sitter": "4.0.2",
51
+ "@willbooster/web-tree-sitter": "6.0.0",
52
52
  "conventional-changelog-conventionalcommits": "10.4.0",
53
53
  "lefthook": "2.2.1",
54
54
  "oxfmt": "0.72.0",
@@ -61,7 +61,7 @@
61
61
  "wrangler": "4.147.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "@willbooster/web-tree-sitter": "^4.0.2"
64
+ "@willbooster/web-tree-sitter": "^6.0.0"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "@willbooster/web-tree-sitter": {
@@ -827,6 +827,16 @@
827
827
  "type": "annotated",
828
828
  "named": true,
829
829
  "fields": {
830
+ "bind": {
831
+ "multiple": false,
832
+ "required": false,
833
+ "types": [
834
+ {
835
+ "type": "variable",
836
+ "named": true
837
+ }
838
+ ]
839
+ },
830
840
  "kind": {
831
841
  "multiple": false,
832
842
  "required": true,
@@ -840,10 +850,18 @@
840
850
  },
841
851
  "children": {
842
852
  "multiple": false,
843
- "required": true,
853
+ "required": false,
844
854
  "types": [
845
855
  {
846
- "type": "type_param",
856
+ "type": "invisible",
857
+ "named": true
858
+ },
859
+ {
860
+ "type": "parens",
861
+ "named": true
862
+ },
863
+ {
864
+ "type": "wildcard",
847
865
  "named": true
848
866
  }
849
867
  ]
@@ -3341,17 +3359,36 @@
3341
3359
  {
3342
3360
  "type": "inferred",
3343
3361
  "named": true,
3344
- "fields": {},
3362
+ "fields": {
3363
+ "bind": {
3364
+ "multiple": false,
3365
+ "required": false,
3366
+ "types": [
3367
+ {
3368
+ "type": "variable",
3369
+ "named": true
3370
+ }
3371
+ ]
3372
+ }
3373
+ },
3345
3374
  "children": {
3346
3375
  "multiple": false,
3347
- "required": true,
3376
+ "required": false,
3348
3377
  "types": [
3349
3378
  {
3350
3379
  "type": "annotated",
3351
3380
  "named": true
3352
3381
  },
3353
3382
  {
3354
- "type": "type_param",
3383
+ "type": "invisible",
3384
+ "named": true
3385
+ },
3386
+ {
3387
+ "type": "parens",
3388
+ "named": true
3389
+ },
3390
+ {
3391
+ "type": "wildcard",
3355
3392
  "named": true
3356
3393
  }
3357
3394
  ]
@@ -3361,6 +3398,16 @@
3361
3398
  "type": "infix",
3362
3399
  "named": true,
3363
3400
  "fields": {
3401
+ "bind": {
3402
+ "multiple": true,
3403
+ "required": false,
3404
+ "types": [
3405
+ {
3406
+ "type": "variable",
3407
+ "named": true
3408
+ }
3409
+ ]
3410
+ },
3364
3411
  "left_operand": {
3365
3412
  "multiple": false,
3366
3413
  "required": true,
@@ -4330,6 +4377,16 @@
4330
4377
  "type": "parens",
4331
4378
  "named": true,
4332
4379
  "fields": {
4380
+ "bind": {
4381
+ "multiple": false,
4382
+ "required": false,
4383
+ "types": [
4384
+ {
4385
+ "type": "variable",
4386
+ "named": true
4387
+ }
4388
+ ]
4389
+ },
4333
4390
  "expression": {
4334
4391
  "multiple": false,
4335
4392
  "required": false,
@@ -4444,7 +4501,15 @@
4444
4501
  "named": true
4445
4502
  },
4446
4503
  {
4447
- "type": "type_param",
4504
+ "type": "invisible",
4505
+ "named": true
4506
+ },
4507
+ {
4508
+ "type": "parens",
4509
+ "named": true
4510
+ },
4511
+ {
4512
+ "type": "wildcard",
4448
4513
  "named": true
4449
4514
  }
4450
4515
  ]
@@ -4793,17 +4858,36 @@
4793
4858
  {
4794
4859
  "type": "quantified_variables",
4795
4860
  "named": true,
4796
- "fields": {},
4861
+ "fields": {
4862
+ "bind": {
4863
+ "multiple": true,
4864
+ "required": false,
4865
+ "types": [
4866
+ {
4867
+ "type": "variable",
4868
+ "named": true
4869
+ }
4870
+ ]
4871
+ }
4872
+ },
4797
4873
  "children": {
4798
4874
  "multiple": true,
4799
- "required": true,
4875
+ "required": false,
4800
4876
  "types": [
4801
4877
  {
4802
4878
  "type": "inferred",
4803
4879
  "named": true
4804
4880
  },
4805
4881
  {
4806
- "type": "type_param",
4882
+ "type": "invisible",
4883
+ "named": true
4884
+ },
4885
+ {
4886
+ "type": "parens",
4887
+ "named": true
4888
+ },
4889
+ {
4890
+ "type": "wildcard",
4807
4891
  "named": true
4808
4892
  }
4809
4893
  ]
@@ -4998,7 +5082,7 @@
4998
5082
  "named": true,
4999
5083
  "fields": {
5000
5084
  "arrow": {
5001
- "multiple": true,
5085
+ "multiple": false,
5002
5086
  "required": false,
5003
5087
  "types": [
5004
5088
  {
@@ -5723,13 +5807,32 @@
5723
5807
  {
5724
5808
  "type": "type_params",
5725
5809
  "named": true,
5726
- "fields": {},
5810
+ "fields": {
5811
+ "bind": {
5812
+ "multiple": true,
5813
+ "required": false,
5814
+ "types": [
5815
+ {
5816
+ "type": "variable",
5817
+ "named": true
5818
+ }
5819
+ ]
5820
+ }
5821
+ },
5727
5822
  "children": {
5728
5823
  "multiple": true,
5729
- "required": true,
5824
+ "required": false,
5730
5825
  "types": [
5731
5826
  {
5732
- "type": "type_param",
5827
+ "type": "invisible",
5828
+ "named": true
5829
+ },
5830
+ {
5831
+ "type": "parens",
5832
+ "named": true
5833
+ },
5834
+ {
5835
+ "type": "wildcard",
5733
5836
  "named": true
5734
5837
  }
5735
5838
  ]
Binary file
package/tree-sitter.json CHANGED
@@ -15,7 +15,7 @@
15
15
  }
16
16
  ],
17
17
  "metadata": {
18
- "version": "3.0.0",
18
+ "version": "4.0.0",
19
19
  "license": "MIT",
20
20
  "description": "Haskell grammar for tree-sitter",
21
21
  "authors": [