@willbooster/tree-sitter-xml 1.0.1 → 1.0.2
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 +4 -4
- package/dtd/src/node-types.json +18 -3
- 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 +21 -6
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`) 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.
|
|
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
|
|
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
|
}
|
|
@@ -516,6 +516,21 @@
|
|
|
516
516
|
]
|
|
517
517
|
}
|
|
518
518
|
},
|
|
519
|
+
{
|
|
520
|
+
"type": "content",
|
|
521
|
+
"named": false,
|
|
522
|
+
"fields": {},
|
|
523
|
+
"children": {
|
|
524
|
+
"multiple": true,
|
|
525
|
+
"required": false,
|
|
526
|
+
"types": [
|
|
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
|
}
|
|
@@ -517,12 +517,12 @@
|
|
|
517
517
|
"named": true,
|
|
518
518
|
"fields": {
|
|
519
519
|
"content": {
|
|
520
|
-
"multiple":
|
|
520
|
+
"multiple": false,
|
|
521
521
|
"required": false,
|
|
522
522
|
"types": [
|
|
523
523
|
{
|
|
524
|
-
"type": "
|
|
525
|
-
"named":
|
|
524
|
+
"type": "content",
|
|
525
|
+
"named": false
|
|
526
526
|
}
|
|
527
527
|
]
|
|
528
528
|
}
|
|
@@ -659,6 +659,21 @@
|
|
|
659
659
|
]
|
|
660
660
|
}
|
|
661
661
|
},
|
|
662
|
+
{
|
|
663
|
+
"type": "content",
|
|
664
|
+
"named": false,
|
|
665
|
+
"fields": {},
|
|
666
|
+
"children": {
|
|
667
|
+
"multiple": true,
|
|
668
|
+
"required": false,
|
|
669
|
+
"types": [
|
|
670
|
+
{
|
|
671
|
+
"type": "_Reference",
|
|
672
|
+
"named": true
|
|
673
|
+
}
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
},
|
|
662
677
|
{
|
|
663
678
|
"type": "content",
|
|
664
679
|
"named": true,
|