@willbooster/tree-sitter-haskell 13.1.2 → 14.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. This package supports the fork's runtime version 10.0.2 or later within 10.x in the 10.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. This package supports the fork's runtime version 10.0.2 or later within 10.x; 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. The fork's node and query contracts are described below.
19
19
 
@@ -42,7 +42,7 @@ reports an error: the lexers of the WillBooster/tree-sitter generator let charac
42
42
  ## Usage
43
43
 
44
44
  The npm package ships `tree-sitter-haskell.wasm` for
45
- [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 10.0.2 or later within 10.x in the 10.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
45
+ [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 10.0.2 or later within 10.x, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
46
46
 
47
47
  ```js
48
48
  import { fileURLToPath } from 'node:url';
@@ -90,6 +90,8 @@ Declaration names and variable/operator callees remain indexed through nested pa
90
90
 
91
91
  Function and type declaration-head parentheses are anonymous syntax: the enclosing declaration directly exposes its `name`, parameter groups and infix `head` fields. Parentheses inside parameters and types retain their existing nodes. A grouped variable name, including a qualified name, uses one `parenthesized_name` node with a direct name child, independent of grouping depth. A symbolic variable operator keeps its required prefix parentheses in `prefix_id`: `(<+>)` and `(Demo.<+>)` remain `prefix_id`, while redundant grouping such as `((<+>))` adds one `parenthesized_name` wrapper around that node. This also applies to unapplied names; only function position creates a call reference or call highlight. A parenthesized simple binding name uses `parenthesized_name` in the `bind` node's `name` field, retaining one wrapper at any grouping depth. Complex expressions retain ordinary `parens` nodes. These changes affect public syntax trees.
92
92
 
93
+ Local `where` clauses form a `where_clause` node spanning the keyword and its binding block. Enclosing bindings, functions and case alternatives expose it through their `binds` field; the clause's optional `binds` field contains `local_binds`. The latter's `decl` fields and source ranges are unchanged. This provides a single named node for selecting or identifying the scope of `where` without including the enclosing declaration. For `let`, `binds` directly contains `local_binds`. Queries can still capture sibling `"where"` and `local_binds` nodes to obtain their separate ranges.
94
+
93
95
  Operator uses retain unresolved source order. Expressions use `operator_chain` with repeated `operand` and `operator` fields: `6 * 7 == 42` has operands `6`, `7`, `42` and operators `*`, `==`. Application stays inside an operand; explicit parentheses and greedy block bodies retain their own grouping. A `prefix_operator` field records each named `prefix_negation` token at its source position, including unary-only chains. Its semantic extent depends on fixities and language extensions, so the tree does not assign it an operand subtree.
94
96
 
95
97
  Type, pattern and constraint operators use `infix_chain` with repeated `operand` and `operator` fields, even for a single operator. Function, type and data declaration heads retain the `infix` node because they define one operator. Instance and standalone deriving implementation tags identify a class only for a single-operator head; multi-operator heads require fixity resolution by the caller.
package/grammar/decl.js CHANGED
@@ -64,7 +64,7 @@ module.exports = {
64
64
  field('match', alias($._simple_bind_match, $.match)),
65
65
  repeat1(field('match', alias($._bind_match, $.match))),
66
66
  ),
67
- optional($._where_binds),
67
+ optional(field('binds', $.where_clause)),
68
68
  ),
69
69
 
70
70
  _function_name: $ => field('name', $._var),
@@ -124,7 +124,7 @@ module.exports = {
124
124
 
125
125
  local_binds: $ => layout($, field('decl', $._local_decl)),
126
126
 
127
- _where_binds: $ => seq($._where, optional(field('binds', $.local_binds))),
127
+ where_clause: $ => seq($._where, optional(field('binds', $.local_binds))),
128
128
 
129
129
  _foreign_calling_keyword: _ => token(choice(
130
130
  'ccall',
package/grammar/exp.js CHANGED
@@ -209,13 +209,13 @@ module.exports = {
209
209
  alternative: $ => seq(
210
210
  field('pattern', $._pat),
211
211
  $._matches,
212
- optional($._where_binds),
212
+ optional(field('binds', $.where_clause)),
213
213
  ),
214
214
 
215
215
  _nalt: $ => seq(
216
216
  field('patterns', $.patterns),
217
217
  $._matches,
218
- optional($._where_binds),
218
+ optional(field('binds', $.where_clause)),
219
219
  ),
220
220
 
221
221
  alternatives: $ => layout_sort($, $._cmd_layout_start_case, field('alternative', $.alternative)),
@@ -906,7 +906,7 @@
906
906
  "required": false,
907
907
  "types": [
908
908
  {
909
- "type": "local_binds",
909
+ "type": "where_clause",
910
910
  "named": true
911
911
  }
912
912
  ]
@@ -1200,7 +1200,7 @@
1200
1200
  "required": false,
1201
1201
  "types": [
1202
1202
  {
1203
- "type": "local_binds",
1203
+ "type": "where_clause",
1204
1204
  "named": true
1205
1205
  }
1206
1206
  ]
@@ -1602,7 +1602,7 @@
1602
1602
  "required": false,
1603
1603
  "types": [
1604
1604
  {
1605
- "type": "local_binds",
1605
+ "type": "where_clause",
1606
1606
  "named": true
1607
1607
  }
1608
1608
  ]
@@ -3134,7 +3134,7 @@
3134
3134
  "required": false,
3135
3135
  "types": [
3136
3136
  {
3137
- "type": "local_binds",
3137
+ "type": "where_clause",
3138
3138
  "named": true
3139
3139
  }
3140
3140
  ]
@@ -6934,6 +6934,22 @@
6934
6934
  }
6935
6935
  }
6936
6936
  },
6937
+ {
6938
+ "type": "where_clause",
6939
+ "named": true,
6940
+ "fields": {
6941
+ "binds": {
6942
+ "multiple": false,
6943
+ "required": false,
6944
+ "types": [
6945
+ {
6946
+ "type": "local_binds",
6947
+ "named": true
6948
+ }
6949
+ ]
6950
+ }
6951
+ }
6952
+ },
6937
6953
  {
6938
6954
  "type": "wildcard",
6939
6955
  "named": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-haskell",
3
- "version": "13.1.2",
3
+ "version": "14.0.0",
4
4
  "description": "Haskell grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -886,7 +886,7 @@
886
886
  "required": false,
887
887
  "types": [
888
888
  {
889
- "type": "local_binds",
889
+ "type": "where_clause",
890
890
  "named": true
891
891
  }
892
892
  ]
@@ -1180,7 +1180,7 @@
1180
1180
  "required": false,
1181
1181
  "types": [
1182
1182
  {
1183
- "type": "local_binds",
1183
+ "type": "where_clause",
1184
1184
  "named": true
1185
1185
  }
1186
1186
  ]
@@ -1566,7 +1566,7 @@
1566
1566
  "required": false,
1567
1567
  "types": [
1568
1568
  {
1569
- "type": "local_binds",
1569
+ "type": "where_clause",
1570
1570
  "named": true
1571
1571
  }
1572
1572
  ]
@@ -3052,7 +3052,7 @@
3052
3052
  "required": false,
3053
3053
  "types": [
3054
3054
  {
3055
- "type": "local_binds",
3055
+ "type": "where_clause",
3056
3056
  "named": true
3057
3057
  }
3058
3058
  ]
@@ -6731,6 +6731,22 @@
6731
6731
  }
6732
6732
  }
6733
6733
  },
6734
+ {
6735
+ "type": "where_clause",
6736
+ "named": true,
6737
+ "fields": {
6738
+ "binds": {
6739
+ "multiple": false,
6740
+ "required": false,
6741
+ "types": [
6742
+ {
6743
+ "type": "local_binds",
6744
+ "named": true
6745
+ }
6746
+ ]
6747
+ }
6748
+ }
6749
+ },
6734
6750
  {
6735
6751
  "type": "wildcard",
6736
6752
  "named": true,
Binary file
Binary file
package/tree-sitter.json CHANGED
@@ -35,7 +35,7 @@
35
35
  }
36
36
  ],
37
37
  "metadata": {
38
- "version": "13.1.2",
38
+ "version": "14.0.0",
39
39
  "license": "MIT",
40
40
  "description": "Haskell grammar for tree-sitter",
41
41
  "authors": [