@willbooster/tree-sitter-xml 1.0.2 → 2.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
@@ -14,19 +14,19 @@ to its authors and contributors. This is not an official release of that project
14
14
 
15
15
  This fork builds on the grammars and queries of upstream's version 0.7.0 and generates the parsers with the
16
16
  [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parsers carry that fork's own ABI
17
- number (`0x57420001`) and load only with that fork's runtime, version 2.0.0 or later: upstream's tree-sitter runtime
18
- rejects them. The XML scanner adapts to the generated array API with the change upstream itself made after 0.7.0. The
19
- parsers differ from upstream's 0.7.0 packages in these ways:
17
+ number (`0x57420006`) and load with that fork's runtime, version 7.0.5 or later in the 7.x series. The XML scanner
18
+ adapts to the generated array API with the change upstream itself made after 0.7.0. The parsers differ from
19
+ upstream's 0.7.0 packages in these ways:
20
20
 
21
21
  - A NUL character inside a quoted literal, such as an attribute value (`AttValue`), an entity value (`EntityValue`),
22
22
  or a system literal (`SystemLiteral`), is part of that token, where upstream's lexer reports an error.
23
23
  - Where a NUL character cannot be part of any token, the `ERROR` node covers it as it covers any other unexpected
24
24
  character, without the unexpected-character node that upstream's parsers put inside it.
25
25
 
26
- - Nonempty attribute values (`AttValue` and `PseudoAttValue`) expose their full unquoted value through the `content`
27
- field. This field points to an anonymous `content` node wrapping text and references. Access references through this
28
- wrapper using the node API; references are not direct children of the attribute-value node. Empty values have no
29
- `content` field.
26
+ - Nonempty attribute values (`AttValue` and `PseudoAttValue`) and entity values (`EntityValue`) expose their full
27
+ unquoted value through the `content` field. This field points to an anonymous `content` node wrapping text and
28
+ references. Access references through this wrapper using the node API; references are not direct children of the
29
+ value node. Empty values have no `content` field.
30
30
 
31
31
  It holds two grammars, as upstream does: `xml` parses XML documents, including an internal DTD subset, and `dtd`
32
32
  parses external DTD files.
@@ -34,7 +34,8 @@ parses external DTD files.
34
34
  ## Usage
35
35
 
36
36
  The npm package ships `tree-sitter-xml.wasm` and `tree-sitter-dtd.wasm` for
37
- [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 2.0.0 or later, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
37
+ [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 7.0.5 or later in the 7.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers.
38
+ In Node.js and Bun, load the grammar from its path:
38
39
 
39
40
  ```js
40
41
  import { fileURLToPath } from 'node:url';
@@ -82,8 +83,8 @@ fuzzed with:
82
83
 
83
84
  ```toml
84
85
  [dependencies]
85
- tree-sitter = { package = "willbooster-tree-sitter", version = "2" }
86
- tree-sitter-xml = { package = "willbooster-tree-sitter-xml", version = "1" }
86
+ tree-sitter = { package = "willbooster-tree-sitter", version = "7.0.5" }
87
+ tree-sitter-xml = { package = "willbooster-tree-sitter-xml", version = "2" }
87
88
  ```
88
89
 
89
90
  ```rust
package/common/common.mjs CHANGED
@@ -38,14 +38,14 @@ export const att_value = ($, q) =>
38
38
  export const entity_value = ($, q) =>
39
39
  seq(
40
40
  q,
41
- field(
41
+ optional(field(
42
42
  'content',
43
- repeat(choice(
43
+ alias(repeat1(choice(
44
44
  new RegExp(`[^<%&${q}]`),
45
45
  $.PEReference,
46
46
  $._Reference
47
- ))
48
- ),
47
+ )), 'content')
48
+ )),
49
49
  q
50
50
  );
51
51
 
@@ -199,16 +199,12 @@
199
199
  "named": true,
200
200
  "fields": {
201
201
  "content": {
202
- "multiple": true,
202
+ "multiple": false,
203
203
  "required": false,
204
204
  "types": [
205
205
  {
206
- "type": "PEReference",
207
- "named": true
208
- },
209
- {
210
- "type": "_Reference",
211
- "named": true
206
+ "type": "content",
207
+ "named": false
212
208
  }
213
209
  ]
214
210
  }
@@ -524,6 +520,10 @@
524
520
  "multiple": true,
525
521
  "required": false,
526
522
  "types": [
523
+ {
524
+ "type": "PEReference",
525
+ "named": true
526
+ },
527
527
  {
528
528
  "type": "_Reference",
529
529
  "named": true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-xml",
3
- "version": "1.0.2",
3
+ "version": "2.0.0",
4
4
  "description": "XML & DTD grammars for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -53,7 +53,7 @@
53
53
  "@willbooster/oxfmt-config": "1.2.2",
54
54
  "@willbooster/oxlint-config": "1.4.8",
55
55
  "@willbooster/wb": "22.26.1",
56
- "@willbooster/web-tree-sitter": "2.0.28",
56
+ "@willbooster/web-tree-sitter": "7.0.5",
57
57
  "conventional-changelog-conventionalcommits": "10.4.0",
58
58
  "lefthook": "2.2.1",
59
59
  "oxfmt": "0.72.0",
@@ -66,7 +66,7 @@
66
66
  "wrangler": "4.147.0"
67
67
  },
68
68
  "peerDependencies": {
69
- "@willbooster/web-tree-sitter": "^2.0.0"
69
+ "@willbooster/web-tree-sitter": "^7.0.5"
70
70
  },
71
71
  "peerDependenciesMeta": {
72
72
  "@willbooster/web-tree-sitter": {
Binary file
Binary file
package/tree-sitter.json CHANGED
@@ -36,7 +36,7 @@
36
36
  }
37
37
  ],
38
38
  "metadata": {
39
- "version": "1.0.2",
39
+ "version": "2.0.0",
40
40
  "license": "MIT",
41
41
  "description": "XML & DTD grammars for tree-sitter",
42
42
  "authors": [
@@ -276,16 +276,12 @@
276
276
  "named": true,
277
277
  "fields": {
278
278
  "content": {
279
- "multiple": true,
279
+ "multiple": false,
280
280
  "required": false,
281
281
  "types": [
282
282
  {
283
- "type": "PEReference",
284
- "named": true
285
- },
286
- {
287
- "type": "_Reference",
288
- "named": true
283
+ "type": "content",
284
+ "named": false
289
285
  }
290
286
  ]
291
287
  }
@@ -667,6 +663,10 @@
667
663
  "multiple": true,
668
664
  "required": false,
669
665
  "types": [
666
+ {
667
+ "type": "PEReference",
668
+ "named": true
669
+ },
670
670
  {
671
671
  "type": "_Reference",
672
672
  "named": true