@willbooster/tree-sitter-xml 1.0.1 → 1.0.3
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 -1
- package/common/common.mjs +8 -8
- package/dtd/src/node-types.json +25 -10
- package/package.json +1 -1
- package/tree-sitter-dtd.wasm +0 -0
- package/tree-sitter-xml.wasm +0 -0
- package/tree-sitter.json +1 -1
- package/xml/src/node-types.json +28 -13
package/README.md
CHANGED
|
@@ -16,13 +16,18 @@ This fork builds on the grammars and queries of upstream's version 0.7.0 and gen
|
|
|
16
16
|
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parsers carry that fork's own ABI
|
|
17
17
|
number (`0x57420001`) and load only with that fork's runtime, version 2.0.0 or later: upstream's tree-sitter runtime
|
|
18
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
|
|
19
|
+
parsers differ from 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`) 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
|
+
|
|
26
31
|
It holds two grammars, as upstream does: `xml` parses XML documents, including an internal DTD subset, and `dtd`
|
|
27
32
|
parses external DTD files.
|
|
28
33
|
|
package/common/common.mjs
CHANGED
|
@@ -21,13 +21,13 @@ export const pubid_char = (q) =>
|
|
|
21
21
|
export const att_value = ($, q) =>
|
|
22
22
|
seq(
|
|
23
23
|
q,
|
|
24
|
-
field(
|
|
24
|
+
optional(field(
|
|
25
25
|
'content',
|
|
26
|
-
|
|
26
|
+
alias(repeat1(choice(
|
|
27
27
|
new RegExp(`[^<&${q}]`),
|
|
28
28
|
$._Reference
|
|
29
|
-
))
|
|
30
|
-
),
|
|
29
|
+
)), 'content')
|
|
30
|
+
)),
|
|
31
31
|
q
|
|
32
32
|
);
|
|
33
33
|
|
|
@@ -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
|
-
|
|
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
|
|
package/dtd/src/node-types.json
CHANGED
|
@@ -121,12 +121,12 @@
|
|
|
121
121
|
"named": true,
|
|
122
122
|
"fields": {
|
|
123
123
|
"content": {
|
|
124
|
-
"multiple":
|
|
124
|
+
"multiple": false,
|
|
125
125
|
"required": false,
|
|
126
126
|
"types": [
|
|
127
127
|
{
|
|
128
|
-
"type": "
|
|
129
|
-
"named":
|
|
128
|
+
"type": "content",
|
|
129
|
+
"named": false
|
|
130
130
|
}
|
|
131
131
|
]
|
|
132
132
|
}
|
|
@@ -199,16 +199,12 @@
|
|
|
199
199
|
"named": true,
|
|
200
200
|
"fields": {
|
|
201
201
|
"content": {
|
|
202
|
-
"multiple":
|
|
202
|
+
"multiple": false,
|
|
203
203
|
"required": false,
|
|
204
204
|
"types": [
|
|
205
205
|
{
|
|
206
|
-
"type": "
|
|
207
|
-
"named":
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
"type": "_Reference",
|
|
211
|
-
"named": true
|
|
206
|
+
"type": "content",
|
|
207
|
+
"named": false
|
|
212
208
|
}
|
|
213
209
|
]
|
|
214
210
|
}
|
|
@@ -516,6 +512,25 @@
|
|
|
516
512
|
]
|
|
517
513
|
}
|
|
518
514
|
},
|
|
515
|
+
{
|
|
516
|
+
"type": "content",
|
|
517
|
+
"named": false,
|
|
518
|
+
"fields": {},
|
|
519
|
+
"children": {
|
|
520
|
+
"multiple": true,
|
|
521
|
+
"required": false,
|
|
522
|
+
"types": [
|
|
523
|
+
{
|
|
524
|
+
"type": "PEReference",
|
|
525
|
+
"named": true
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"type": "_Reference",
|
|
529
|
+
"named": true
|
|
530
|
+
}
|
|
531
|
+
]
|
|
532
|
+
}
|
|
533
|
+
},
|
|
519
534
|
{
|
|
520
535
|
"type": "contentspec",
|
|
521
536
|
"named": true,
|
package/package.json
CHANGED
package/tree-sitter-dtd.wasm
CHANGED
|
Binary file
|
package/tree-sitter-xml.wasm
CHANGED
|
Binary file
|
package/tree-sitter.json
CHANGED
package/xml/src/node-types.json
CHANGED
|
@@ -121,12 +121,12 @@
|
|
|
121
121
|
"named": true,
|
|
122
122
|
"fields": {
|
|
123
123
|
"content": {
|
|
124
|
-
"multiple":
|
|
124
|
+
"multiple": false,
|
|
125
125
|
"required": false,
|
|
126
126
|
"types": [
|
|
127
127
|
{
|
|
128
|
-
"type": "
|
|
129
|
-
"named":
|
|
128
|
+
"type": "content",
|
|
129
|
+
"named": false
|
|
130
130
|
}
|
|
131
131
|
]
|
|
132
132
|
}
|
|
@@ -276,16 +276,12 @@
|
|
|
276
276
|
"named": true,
|
|
277
277
|
"fields": {
|
|
278
278
|
"content": {
|
|
279
|
-
"multiple":
|
|
279
|
+
"multiple": false,
|
|
280
280
|
"required": false,
|
|
281
281
|
"types": [
|
|
282
282
|
{
|
|
283
|
-
"type": "
|
|
284
|
-
"named":
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
"type": "_Reference",
|
|
288
|
-
"named": true
|
|
283
|
+
"type": "content",
|
|
284
|
+
"named": false
|
|
289
285
|
}
|
|
290
286
|
]
|
|
291
287
|
}
|
|
@@ -517,12 +513,12 @@
|
|
|
517
513
|
"named": true,
|
|
518
514
|
"fields": {
|
|
519
515
|
"content": {
|
|
520
|
-
"multiple":
|
|
516
|
+
"multiple": false,
|
|
521
517
|
"required": false,
|
|
522
518
|
"types": [
|
|
523
519
|
{
|
|
524
|
-
"type": "
|
|
525
|
-
"named":
|
|
520
|
+
"type": "content",
|
|
521
|
+
"named": false
|
|
526
522
|
}
|
|
527
523
|
]
|
|
528
524
|
}
|
|
@@ -659,6 +655,25 @@
|
|
|
659
655
|
]
|
|
660
656
|
}
|
|
661
657
|
},
|
|
658
|
+
{
|
|
659
|
+
"type": "content",
|
|
660
|
+
"named": false,
|
|
661
|
+
"fields": {},
|
|
662
|
+
"children": {
|
|
663
|
+
"multiple": true,
|
|
664
|
+
"required": false,
|
|
665
|
+
"types": [
|
|
666
|
+
{
|
|
667
|
+
"type": "PEReference",
|
|
668
|
+
"named": true
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"type": "_Reference",
|
|
672
|
+
"named": true
|
|
673
|
+
}
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
},
|
|
662
677
|
{
|
|
663
678
|
"type": "content",
|
|
664
679
|
"named": true,
|