@willbooster/tree-sitter-xml 3.0.1 → 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 +6 -4
- package/common/common.mjs +5 -2
- package/package.json +3 -3
- package/tree-sitter-dtd.wasm +0 -0
- package/tree-sitter-xml.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ 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 (`
|
|
17
|
+
number (`0x57420009`) and load with that fork's runtime, version 13.0.0 or later in the 13.x series. The XML scanner
|
|
18
18
|
adapts to the generated array API with the change upstream itself made after 0.7.0. The parsers differ from
|
|
19
19
|
upstream's 0.7.0 packages in these ways:
|
|
20
20
|
|
|
@@ -23,6 +23,8 @@ upstream's 0.7.0 packages in these ways:
|
|
|
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
|
+
- Names and enumeration tokens use the [XML 1.0 Unicode character ranges](https://www.w3.org/TR/xml/#NT-NameStartChar),
|
|
27
|
+
including supplementary characters, in attributes, references, and DTD declarations.
|
|
26
28
|
- Generic processing instructions accept multiline content and question marks up to the closing `?>`, including
|
|
27
29
|
when another instruction or markup immediately follows.
|
|
28
30
|
- Nonempty attribute values (`AttValue` and `PseudoAttValue`) and entity values (`EntityValue`) expose their full
|
|
@@ -36,7 +38,7 @@ parses external DTD files.
|
|
|
36
38
|
## Usage
|
|
37
39
|
|
|
38
40
|
The npm package ships `tree-sitter-xml.wasm` and `tree-sitter-dtd.wasm` for
|
|
39
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version
|
|
41
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 13.0.0 or later in the 13.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers.
|
|
40
42
|
In Node.js and Bun, load the grammar from its path:
|
|
41
43
|
|
|
42
44
|
```js
|
|
@@ -85,8 +87,8 @@ fuzzed with:
|
|
|
85
87
|
|
|
86
88
|
```toml
|
|
87
89
|
[dependencies]
|
|
88
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
89
|
-
tree-sitter-xml = { package = "willbooster-tree-sitter-xml", version = "
|
|
90
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "13.0.0" }
|
|
91
|
+
tree-sitter-xml = { package = "willbooster-tree-sitter-xml", version = "4" }
|
|
90
92
|
```
|
|
91
93
|
|
|
92
94
|
```rust
|
package/common/common.mjs
CHANGED
|
@@ -70,6 +70,9 @@ export const rseq = (...rules) => repeat(seq(...rules));
|
|
|
70
70
|
/** @param {RuleOrLiteral[]} rules */
|
|
71
71
|
export const rseq1 = (...rules) => repeat1(seq(...rules));
|
|
72
72
|
|
|
73
|
+
const nameStartChars = String.raw`:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}`;
|
|
74
|
+
const nameChars = String.raw`${nameStartChars}\-.0-9\u00B7\u0300-\u036F\u203F-\u2040`;
|
|
75
|
+
|
|
73
76
|
const O = optional;
|
|
74
77
|
|
|
75
78
|
/** @type {Record<string, ($: GrammarSymbols<any>) => RuleOrLiteral>} */
|
|
@@ -309,9 +312,9 @@ export const rules = {
|
|
|
309
312
|
|
|
310
313
|
_S: _ => /[ \t\r\n]+/,
|
|
311
314
|
|
|
312
|
-
Name: _ =>
|
|
315
|
+
Name: _ => new RegExp(`[${nameStartChars}][${nameChars}]*`, 'u'),
|
|
313
316
|
|
|
314
|
-
Nmtoken: _ =>
|
|
317
|
+
Nmtoken: _ => new RegExp(`[${nameChars}]+`, 'u'),
|
|
315
318
|
|
|
316
319
|
_Reference: $ => choice($.EntityRef, $.CharRef),
|
|
317
320
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-xml",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.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.2",
|
|
56
|
-
"@willbooster/web-tree-sitter": "
|
|
56
|
+
"@willbooster/web-tree-sitter": "13.0.0",
|
|
57
57
|
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
58
58
|
"lefthook": "2.2.2",
|
|
59
59
|
"oxfmt": "0.73.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"wrangler": "4.147.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@willbooster/web-tree-sitter": "^
|
|
69
|
+
"@willbooster/web-tree-sitter": "^13.0.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependenciesMeta": {
|
|
72
72
|
"@willbooster/web-tree-sitter": {
|
package/tree-sitter-dtd.wasm
CHANGED
|
Binary file
|
package/tree-sitter-xml.wasm
CHANGED
|
Binary file
|