@ac-kit/format-xpath 0.0.0-stage → 0.1.1
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/CHANGELOG.md +91 -0
- package/LICENSE +28 -0
- package/README.md +223 -2
- package/dist/_axes.d.ts +18 -0
- package/dist/_axes.d.ts.map +1 -0
- package/dist/_axes.js +124 -0
- package/dist/_axes.js.map +1 -0
- package/dist/_code-points.d.ts +13 -0
- package/dist/_code-points.d.ts.map +1 -0
- package/dist/_code-points.js +40 -0
- package/dist/_code-points.js.map +1 -0
- package/dist/_compare.d.ts +14 -0
- package/dist/_compare.d.ts.map +1 -0
- package/dist/_compare.js +160 -0
- package/dist/_compare.js.map +1 -0
- package/dist/_compile.d.ts +87 -0
- package/dist/_compile.d.ts.map +1 -0
- package/dist/_compile.js +262 -0
- package/dist/_compile.js.map +1 -0
- package/dist/_convert.d.ts +16 -0
- package/dist/_convert.d.ts.map +1 -0
- package/dist/_convert.js +46 -0
- package/dist/_convert.js.map +1 -0
- package/dist/_evaluate.d.ts +15 -0
- package/dist/_evaluate.d.ts.map +1 -0
- package/dist/_evaluate.js +160 -0
- package/dist/_evaluate.js.map +1 -0
- package/dist/_foreign-functions.d.ts +7 -0
- package/dist/_foreign-functions.d.ts.map +1 -0
- package/dist/_foreign-functions.js +54 -0
- package/dist/_foreign-functions.js.map +1 -0
- package/dist/_functions.d.ts +24 -0
- package/dist/_functions.d.ts.map +1 -0
- package/dist/_functions.js +312 -0
- package/dist/_functions.js.map +1 -0
- package/dist/_lexer.d.ts +23 -0
- package/dist/_lexer.d.ts.map +1 -0
- package/dist/_lexer.js +211 -0
- package/dist/_lexer.js.map +1 -0
- package/dist/_node-test.d.ts +15 -0
- package/dist/_node-test.d.ts.map +1 -0
- package/dist/_node-test.js +123 -0
- package/dist/_node-test.js.map +1 -0
- package/dist/_number.d.ts +15 -0
- package/dist/_number.d.ts.map +1 -0
- package/dist/_number.js +31 -0
- package/dist/_number.js.map +1 -0
- package/dist/_parse-bounded.d.ts +17 -0
- package/dist/_parse-bounded.d.ts.map +1 -0
- package/dist/_parse-bounded.js +107 -0
- package/dist/_parse-bounded.js.map +1 -0
- package/dist/_parser.d.ts +15 -0
- package/dist/_parser.d.ts.map +1 -0
- package/dist/_parser.js +391 -0
- package/dist/_parser.js.map +1 -0
- package/dist/_run.d.ts +169 -0
- package/dist/_run.d.ts.map +1 -0
- package/dist/_run.js +646 -0
- package/dist/_run.js.map +1 -0
- package/dist/_walk-expression.d.ts +8 -0
- package/dist/_walk-expression.d.ts.map +1 -0
- package/dist/_walk-expression.js +54 -0
- package/dist/_walk-expression.js.map +1 -0
- package/dist/ast.d.ts +110 -0
- package/dist/ast.d.ts.map +1 -0
- package/dist/ast.js +2 -0
- package/dist/ast.js.map +1 -0
- package/dist/compile-xpath.d.ts +97 -0
- package/dist/compile-xpath.d.ts.map +1 -0
- package/dist/compile-xpath.js +105 -0
- package/dist/compile-xpath.js.map +1 -0
- package/dist/errors.d.ts +52 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +68 -0
- package/dist/errors.js.map +1 -0
- package/dist/evaluate-xpath.d.ts +11 -0
- package/dist/evaluate-xpath.d.ts.map +1 -0
- package/dist/evaluate-xpath.js +11 -0
- package/dist/evaluate-xpath.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/limits.d.ts +77 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +74 -0
- package/dist/limits.js.map +1 -0
- package/dist/parse-xpath.d.ts +27 -0
- package/dist/parse-xpath.d.ts.map +1 -0
- package/dist/parse-xpath.js +41 -0
- package/dist/parse-xpath.js.map +1 -0
- package/dist/values.d.ts +68 -0
- package/dist/values.d.ts.map +1 -0
- package/dist/values.js +28 -0
- package/dist/values.js.map +1 -0
- package/package.json +68 -3
package/dist/_run.js
ADDED
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
import { walkTree } from "@ac-kit/algo";
|
|
2
|
+
import { HTML_NAMESPACE, MarkupStringValueLengthError, markupAttributeValue, markupStringValue, markupTextRunStart, XML_NAMESPACE, XMLNS_NAMESPACE, } from "@ac-kit/model-markup";
|
|
3
|
+
import { XPathTypeError, XPathUnboundVariableError } from "./errors.js";
|
|
4
|
+
import { XPathLimitExceededError } from "./limits.js";
|
|
5
|
+
import { isXPathAttributeNode, isXPathNamespaceNode, XPATH_NODE_KIND, } from "./values.js";
|
|
6
|
+
/** Where a node sits among the nodes sharing its owner, for document order. */
|
|
7
|
+
const SELF_SLOT_ = 0;
|
|
8
|
+
const NAMESPACE_SLOT_ = 1;
|
|
9
|
+
const ATTRIBUTE_SLOT_ = 2;
|
|
10
|
+
/**
|
|
11
|
+
* The state of one evaluation: the shape's members read once, the work budget,
|
|
12
|
+
* the document mode, and the memos an evaluation builds — wrapper nodes,
|
|
13
|
+
* sibling positions, roots, document order, ids. Nothing outlives the
|
|
14
|
+
* evaluation, so a tree changed between two evaluations is never read stale.
|
|
15
|
+
*/
|
|
16
|
+
export class EvaluationRun {
|
|
17
|
+
budget;
|
|
18
|
+
maxStringLength;
|
|
19
|
+
variables;
|
|
20
|
+
kindOf;
|
|
21
|
+
childrenOf;
|
|
22
|
+
parentOf;
|
|
23
|
+
localNameOf;
|
|
24
|
+
namespaceOf;
|
|
25
|
+
prefixOf;
|
|
26
|
+
attributesOf;
|
|
27
|
+
attributeLocalNameOf;
|
|
28
|
+
attributeNamespaceOf;
|
|
29
|
+
attributePrefixOf;
|
|
30
|
+
attributeValueOf;
|
|
31
|
+
dataOf;
|
|
32
|
+
targetOf;
|
|
33
|
+
/** Whether name tests follow the HTML rules (HTML Standard §2.1.11). */
|
|
34
|
+
html;
|
|
35
|
+
shapeSiblingIndexOf;
|
|
36
|
+
namespacesInScopeOf;
|
|
37
|
+
namespacesInScopeWithin;
|
|
38
|
+
compareDocumentOrder;
|
|
39
|
+
elementByIdOf;
|
|
40
|
+
/** The caller's shape with this run's sibling positions, for string-values. */
|
|
41
|
+
valueShape;
|
|
42
|
+
attributeNodes = new Map();
|
|
43
|
+
attributeIndices = new Map();
|
|
44
|
+
namespaceNodes = new Map();
|
|
45
|
+
namespaceIndices = new Map();
|
|
46
|
+
siblingIndices = new Map();
|
|
47
|
+
roots = new Map();
|
|
48
|
+
treeIds = new Map();
|
|
49
|
+
orders = new Map();
|
|
50
|
+
ids = new Map();
|
|
51
|
+
variableValues = new Map();
|
|
52
|
+
constructor(shape, budget, maxStringLength, contextNode, documentMode, variables) {
|
|
53
|
+
this.budget = budget;
|
|
54
|
+
this.maxStringLength = maxStringLength;
|
|
55
|
+
this.variables = variables;
|
|
56
|
+
this.kindOf = shape.kindOf;
|
|
57
|
+
this.childrenOf = shape.childrenOf;
|
|
58
|
+
this.parentOf = shape.parentOf;
|
|
59
|
+
this.localNameOf = shape.localNameOf;
|
|
60
|
+
this.namespaceOf = shape.namespaceOf;
|
|
61
|
+
this.prefixOf = shape.prefixOf;
|
|
62
|
+
this.attributesOf = shape.attributesOf;
|
|
63
|
+
this.attributeLocalNameOf = shape.attributeLocalNameOf;
|
|
64
|
+
this.attributeNamespaceOf = shape.attributeNamespaceOf;
|
|
65
|
+
this.attributePrefixOf = shape.attributePrefixOf;
|
|
66
|
+
this.attributeValueOf = shape.attributeValueOf;
|
|
67
|
+
this.dataOf = shape.dataOf;
|
|
68
|
+
this.targetOf = shape.targetOf;
|
|
69
|
+
this.shapeSiblingIndexOf = shape.siblingIndexOf;
|
|
70
|
+
this.namespacesInScopeOf = shape.namespacesInScopeOf;
|
|
71
|
+
this.compareDocumentOrder = shape.compareDocumentOrder;
|
|
72
|
+
this.elementByIdOf = shape.elementByIdOf;
|
|
73
|
+
this.namespacesInScopeWithin = shape.namespacesInScopeWithin;
|
|
74
|
+
// Every member forwarded by name, so a shape inheriting its members
|
|
75
|
+
// (a prototype, a class instance) is read the same.
|
|
76
|
+
this.valueShape = {
|
|
77
|
+
kindOf: shape.kindOf,
|
|
78
|
+
parentOf: shape.parentOf,
|
|
79
|
+
childrenOf: shape.childrenOf,
|
|
80
|
+
siblingIndexOf: shape.siblingIndexOf ?? ((node) => this.siblingIndex(node)),
|
|
81
|
+
documentModeOf: shape.documentModeOf,
|
|
82
|
+
localNameOf: shape.localNameOf,
|
|
83
|
+
namespaceOf: shape.namespaceOf,
|
|
84
|
+
prefixOf: shape.prefixOf,
|
|
85
|
+
attributesOf: shape.attributesOf,
|
|
86
|
+
attributeLocalNameOf: shape.attributeLocalNameOf,
|
|
87
|
+
attributeNamespaceOf: shape.attributeNamespaceOf,
|
|
88
|
+
attributePrefixOf: shape.attributePrefixOf,
|
|
89
|
+
attributeValueOf: shape.attributeValueOf,
|
|
90
|
+
dataOf: shape.dataOf,
|
|
91
|
+
targetOf: shape.targetOf,
|
|
92
|
+
};
|
|
93
|
+
const mode = documentMode ?? shape.documentModeOf(this.treeNodeOf(contextNode));
|
|
94
|
+
this.html = mode !== "xml";
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The value of a variable, a node-set adopted into this evaluation and put in
|
|
98
|
+
* document order the first time it is read.
|
|
99
|
+
*
|
|
100
|
+
* @throws {XPathUnboundVariableError} When `key` is not bound.
|
|
101
|
+
* @throws {XPathTypeError} When it is bound to something that is not an XPath
|
|
102
|
+
* value, or a node-set holding a node {@link adopt} rejects.
|
|
103
|
+
*/
|
|
104
|
+
variable(key) {
|
|
105
|
+
const known = this.variableValues.get(key);
|
|
106
|
+
if (known !== undefined) {
|
|
107
|
+
return known;
|
|
108
|
+
}
|
|
109
|
+
if (this.variables === undefined || !this.variables.has(key)) {
|
|
110
|
+
throw new XPathUnboundVariableError(key);
|
|
111
|
+
}
|
|
112
|
+
const value = this.variables.get(key);
|
|
113
|
+
let resolved;
|
|
114
|
+
if (typeof value === "string" ||
|
|
115
|
+
typeof value === "number" ||
|
|
116
|
+
typeof value === "boolean") {
|
|
117
|
+
resolved = value;
|
|
118
|
+
}
|
|
119
|
+
else if (Array.isArray(value)) {
|
|
120
|
+
const nodes = [];
|
|
121
|
+
for (const node of value) {
|
|
122
|
+
this.budget.spend(1);
|
|
123
|
+
nodes.push(this.adopt(node));
|
|
124
|
+
}
|
|
125
|
+
resolved = this.sortUnique(nodes);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
throw new XPathTypeError(`XPath variable $${key} is not bound to a string, number, boolean or node array`, null);
|
|
129
|
+
}
|
|
130
|
+
this.variableValues.set(key, resolved);
|
|
131
|
+
return resolved;
|
|
132
|
+
}
|
|
133
|
+
/** The tree node a node is or belongs to: itself, or a wrapper's owner. */
|
|
134
|
+
treeNodeOf(node) {
|
|
135
|
+
return isXPathAttributeNode(node) || isXPathNamespaceNode(node)
|
|
136
|
+
? node.owner
|
|
137
|
+
: node;
|
|
138
|
+
}
|
|
139
|
+
kind(node) {
|
|
140
|
+
if (isXPathAttributeNode(node)) {
|
|
141
|
+
return "attribute";
|
|
142
|
+
}
|
|
143
|
+
if (isXPathNamespaceNode(node)) {
|
|
144
|
+
return "namespace";
|
|
145
|
+
}
|
|
146
|
+
return this.kindOf(node);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Checks the length of a string the evaluation produces against
|
|
150
|
+
* `maxStringLength`.
|
|
151
|
+
*
|
|
152
|
+
* @throws {XPathLimitExceededError} Of kind `"stringLength"`.
|
|
153
|
+
*/
|
|
154
|
+
checkStringLength(length) {
|
|
155
|
+
if (length > this.maxStringLength) {
|
|
156
|
+
throw new XPathLimitExceededError("stringLength", this.maxStringLength);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/** Charges a string about to be built, checking it against `maxStringLength`. */
|
|
160
|
+
spendString(length) {
|
|
161
|
+
this.checkStringLength(length);
|
|
162
|
+
this.budget.spend(length);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* `text`, a string the evaluation produced, once checked against
|
|
166
|
+
* `maxStringLength`.
|
|
167
|
+
*/
|
|
168
|
+
produce(text) {
|
|
169
|
+
this.checkStringLength(text.length);
|
|
170
|
+
return text;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The position of `node` among its parent's children: the shape's, a position
|
|
174
|
+
* recorded while enumerating, or a scan charged to the budget.
|
|
175
|
+
*/
|
|
176
|
+
siblingIndex(node) {
|
|
177
|
+
if (this.shapeSiblingIndexOf !== undefined) {
|
|
178
|
+
return this.shapeSiblingIndexOf(node);
|
|
179
|
+
}
|
|
180
|
+
const known = this.siblingIndices.get(node);
|
|
181
|
+
if (known !== undefined) {
|
|
182
|
+
return known;
|
|
183
|
+
}
|
|
184
|
+
const parent = this.parentOf(node);
|
|
185
|
+
if (parent === null) {
|
|
186
|
+
return 0;
|
|
187
|
+
}
|
|
188
|
+
const siblings = this.childrenOf(parent);
|
|
189
|
+
this.budget.spend(siblings.length);
|
|
190
|
+
for (let index = 0; index < siblings.length; index++) {
|
|
191
|
+
this.siblingIndices.set(siblings[index], index);
|
|
192
|
+
}
|
|
193
|
+
const index = this.siblingIndices.get(node);
|
|
194
|
+
if (index === undefined) {
|
|
195
|
+
throw new TypeError("The shape's parentOf names a parent whose childrenOf does not hold the node");
|
|
196
|
+
}
|
|
197
|
+
return index;
|
|
198
|
+
}
|
|
199
|
+
/** Records a position learned while enumerating, when the shape has none. */
|
|
200
|
+
noteSiblingIndex(node, index) {
|
|
201
|
+
if (this.shapeSiblingIndexOf === undefined) {
|
|
202
|
+
this.siblingIndices.set(node, index);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
isText(node) {
|
|
206
|
+
return this.kindOf(node) === "text";
|
|
207
|
+
}
|
|
208
|
+
/** Whether the text run starting at `siblings[start]` has any data. O(run). */
|
|
209
|
+
runHasData(siblings, start) {
|
|
210
|
+
for (let index = start; index < siblings.length; index++) {
|
|
211
|
+
this.budget.spend(1);
|
|
212
|
+
const sibling = siblings[index];
|
|
213
|
+
if (!this.isText(sibling)) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
if (this.dataOf(sibling).length > 0) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Whether a child is an XPath node: not a doctype, and for text the first
|
|
224
|
+
* node of a run holding some data.
|
|
225
|
+
*/
|
|
226
|
+
isVisibleChild(siblings, index) {
|
|
227
|
+
const child = siblings[index];
|
|
228
|
+
const kind = this.kindOf(child);
|
|
229
|
+
if (kind === "doctype") {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
if (kind !== "text") {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
if (index > 0 && this.isText(siblings[index - 1])) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
return this.runHasData(siblings, index);
|
|
239
|
+
}
|
|
240
|
+
/** Calls `visit` on each XPath child of `parent`, in document order. */
|
|
241
|
+
forEachChild(parent, visit) {
|
|
242
|
+
const children = this.childrenOf(parent);
|
|
243
|
+
for (let index = 0; index < children.length; index++) {
|
|
244
|
+
this.budget.spend(1);
|
|
245
|
+
if (this.isVisibleChild(children, index)) {
|
|
246
|
+
const child = children[index];
|
|
247
|
+
this.noteSiblingIndex(child, index);
|
|
248
|
+
visit(child);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Calls `visit` on the XPath descendants of `node` in document order, `node`
|
|
254
|
+
* itself first when `includeSelf`. Iterative.
|
|
255
|
+
*/
|
|
256
|
+
forEachDescendant(node, includeSelf, visit) {
|
|
257
|
+
walkTree(node, this.childrenOf, (visited, parent, siblingIndex) => {
|
|
258
|
+
if (parent === undefined) {
|
|
259
|
+
if (includeSelf) {
|
|
260
|
+
visit(visited);
|
|
261
|
+
}
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
const siblings = this.childrenOf(parent);
|
|
265
|
+
if (this.isVisibleChild(siblings, siblingIndex)) {
|
|
266
|
+
this.noteSiblingIndex(visited, siblingIndex);
|
|
267
|
+
visit(visited);
|
|
268
|
+
}
|
|
269
|
+
return undefined;
|
|
270
|
+
}, { budget: this.budget });
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The XPath siblings after (`direction` 1) or before (`-1`) `node`, nearest
|
|
274
|
+
* first. A text node's own run is skipped.
|
|
275
|
+
*/
|
|
276
|
+
forEachSibling(node, direction, visit) {
|
|
277
|
+
this.budget.spend(1);
|
|
278
|
+
const parent = this.parentOf(node);
|
|
279
|
+
if (parent === null) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const siblings = this.childrenOf(parent);
|
|
283
|
+
let index = this.siblingIndex(node) + direction;
|
|
284
|
+
if (direction === 1) {
|
|
285
|
+
while (index < siblings.length &&
|
|
286
|
+
this.isText(siblings[index]) &&
|
|
287
|
+
this.isText(node)) {
|
|
288
|
+
this.budget.spend(1);
|
|
289
|
+
index++;
|
|
290
|
+
}
|
|
291
|
+
for (; index < siblings.length; index++) {
|
|
292
|
+
this.budget.spend(1);
|
|
293
|
+
if (this.isVisibleChild(siblings, index)) {
|
|
294
|
+
this.noteSiblingIndex(siblings[index], index);
|
|
295
|
+
visit(siblings[index]);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
while (index >= 0) {
|
|
301
|
+
this.budget.spend(1);
|
|
302
|
+
const sibling = siblings[index];
|
|
303
|
+
const kind = this.kindOf(sibling);
|
|
304
|
+
if (kind === "text") {
|
|
305
|
+
let start = index;
|
|
306
|
+
while (start > 0 && this.isText(siblings[start - 1])) {
|
|
307
|
+
this.budget.spend(1);
|
|
308
|
+
start--;
|
|
309
|
+
}
|
|
310
|
+
if (this.runHasData(siblings, start)) {
|
|
311
|
+
this.noteSiblingIndex(siblings[start], start);
|
|
312
|
+
visit(siblings[start]);
|
|
313
|
+
}
|
|
314
|
+
index = start - 1;
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
if (kind !== "doctype") {
|
|
318
|
+
this.noteSiblingIndex(sibling, index);
|
|
319
|
+
visit(sibling);
|
|
320
|
+
}
|
|
321
|
+
index--;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* The node standing for a tree node a caller supplied: a text node is
|
|
326
|
+
* replaced by the first node of its run (`markupTextRunStart`, charged).
|
|
327
|
+
*
|
|
328
|
+
* @throws {XPathTypeError} For a doctype, or a text node whose run holds no
|
|
329
|
+
* data — neither is a node of the XPath data model.
|
|
330
|
+
*/
|
|
331
|
+
adoptTreeNode(node) {
|
|
332
|
+
switch (this.kindOf(node)) {
|
|
333
|
+
case "doctype":
|
|
334
|
+
throw new XPathTypeError("A doctype is not an XPath node", null);
|
|
335
|
+
case "text": {
|
|
336
|
+
const start = markupTextRunStart(this.valueShape, node, this.budget);
|
|
337
|
+
const parent = this.parentOf(start);
|
|
338
|
+
const hasData = parent === null
|
|
339
|
+
? this.dataOf(start).length > 0
|
|
340
|
+
: this.runHasData(this.childrenOf(parent), this.siblingIndex(start));
|
|
341
|
+
if (!hasData) {
|
|
342
|
+
throw new XPathTypeError("A text node whose run is empty is not an XPath node", null);
|
|
343
|
+
}
|
|
344
|
+
return start;
|
|
345
|
+
}
|
|
346
|
+
default:
|
|
347
|
+
return node;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/** The root of the tree holding `node`, memoised for every node on the way. */
|
|
351
|
+
rootOf(node) {
|
|
352
|
+
this.budget.spend(1);
|
|
353
|
+
const start = this.treeNodeOf(node);
|
|
354
|
+
const path = [];
|
|
355
|
+
let current = start;
|
|
356
|
+
let root;
|
|
357
|
+
for (;;) {
|
|
358
|
+
root = this.roots.get(current);
|
|
359
|
+
if (root !== undefined) {
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
path.push(current);
|
|
363
|
+
this.budget.spend(1);
|
|
364
|
+
const parent = this.parentOf(current);
|
|
365
|
+
if (parent === null) {
|
|
366
|
+
root = current;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
current = parent;
|
|
370
|
+
}
|
|
371
|
+
for (const visited of path) {
|
|
372
|
+
this.roots.set(visited, root);
|
|
373
|
+
}
|
|
374
|
+
return root;
|
|
375
|
+
}
|
|
376
|
+
/** One attribute node per owner and attribute for the whole evaluation. */
|
|
377
|
+
attributeNode(owner, attribute, index, given) {
|
|
378
|
+
let byAttribute = this.attributeNodes.get(owner);
|
|
379
|
+
if (byAttribute === undefined) {
|
|
380
|
+
byAttribute = new Map();
|
|
381
|
+
this.attributeNodes.set(owner, byAttribute);
|
|
382
|
+
}
|
|
383
|
+
let wrapper = byAttribute.get(attribute);
|
|
384
|
+
if (wrapper === undefined) {
|
|
385
|
+
wrapper = given ?? { [XPATH_NODE_KIND]: "attribute", owner, attribute };
|
|
386
|
+
byAttribute.set(attribute, wrapper);
|
|
387
|
+
this.attributeIndices.set(wrapper, index);
|
|
388
|
+
}
|
|
389
|
+
return wrapper;
|
|
390
|
+
}
|
|
391
|
+
/** Calls `visit` on the attribute nodes of an element, `xmlns` ones excluded. */
|
|
392
|
+
forEachAttribute(element, visit) {
|
|
393
|
+
const attributes = this.attributesOf(element);
|
|
394
|
+
for (let index = 0; index < attributes.length; index++) {
|
|
395
|
+
this.budget.spend(1);
|
|
396
|
+
const attribute = attributes[index];
|
|
397
|
+
if (this.attributeNamespaceOf(attribute) !== XMLNS_NAMESPACE) {
|
|
398
|
+
visit(this.attributeNode(element, attribute, index));
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* The namespace nodes of an element, in the shape's order: every binding in
|
|
404
|
+
* scope with a non-empty URI, the `xml` binding always among them. Read
|
|
405
|
+
* through `namespacesInScopeWithin` with this evaluation's budget when the
|
|
406
|
+
* shape has it, `namespacesInScopeOf` otherwise; charged one unit per
|
|
407
|
+
* binding, again on every later visit of the same element.
|
|
408
|
+
*/
|
|
409
|
+
namespaceNodesOf(element) {
|
|
410
|
+
return this.namespaceScope(element).nodes;
|
|
411
|
+
}
|
|
412
|
+
namespaceScope(element) {
|
|
413
|
+
const known = this.namespaceNodes.get(element);
|
|
414
|
+
if (known !== undefined) {
|
|
415
|
+
this.budget.spend(known.nodes.length);
|
|
416
|
+
return known;
|
|
417
|
+
}
|
|
418
|
+
const scope = { nodes: [], byPrefix: new Map() };
|
|
419
|
+
const add = (prefix, uri) => {
|
|
420
|
+
this.budget.spend(1);
|
|
421
|
+
if (uri === "" || scope.byPrefix.has(prefix)) {
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
const wrapper = {
|
|
425
|
+
[XPATH_NODE_KIND]: "namespace",
|
|
426
|
+
owner: element,
|
|
427
|
+
prefix,
|
|
428
|
+
uri,
|
|
429
|
+
};
|
|
430
|
+
this.namespaceIndices.set(wrapper, scope.nodes.length);
|
|
431
|
+
scope.nodes.push(wrapper);
|
|
432
|
+
scope.byPrefix.set(prefix, wrapper);
|
|
433
|
+
};
|
|
434
|
+
const bindings = this.namespacesInScopeWithin !== undefined
|
|
435
|
+
? this.namespacesInScopeWithin(element, this.budget)
|
|
436
|
+
: this.namespacesInScopeOf?.(element);
|
|
437
|
+
if (bindings !== undefined) {
|
|
438
|
+
for (const binding of bindings) {
|
|
439
|
+
add(binding.prefix, binding.uri);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
add("xml", XML_NAMESPACE);
|
|
443
|
+
this.namespaceNodes.set(element, scope);
|
|
444
|
+
return scope;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* The node of this evaluation standing for a node the caller supplied — a
|
|
448
|
+
* context node or a member of a node-set variable — after the visibility
|
|
449
|
+
* rules of the axes: a text node's run start, the one wrapper for an
|
|
450
|
+
* attribute's owner and attribute, or for a namespace's owner and prefix.
|
|
451
|
+
*
|
|
452
|
+
* @throws {XPathTypeError} For a doctype, a text node of an empty run, an
|
|
453
|
+
* attribute its owner does not hold or that declares a namespace (`xmlns`,
|
|
454
|
+
* `xmlns:p`, which are namespace nodes), or a namespace not in scope at its
|
|
455
|
+
* owner.
|
|
456
|
+
*/
|
|
457
|
+
adopt(node) {
|
|
458
|
+
if (isXPathAttributeNode(node)) {
|
|
459
|
+
if (this.attributeNamespaceOf(node.attribute) === XMLNS_NAMESPACE) {
|
|
460
|
+
throw new XPathTypeError("A namespace declaration is not an attribute node", null);
|
|
461
|
+
}
|
|
462
|
+
const attributes = this.attributesOf(node.owner);
|
|
463
|
+
this.budget.spend(attributes.length);
|
|
464
|
+
for (let index = 0; index < attributes.length; index++) {
|
|
465
|
+
if (attributes[index] === node.attribute) {
|
|
466
|
+
return this.attributeNode(node.owner, node.attribute, index, node);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
throw new XPathTypeError("An attribute node its owner does not hold", null);
|
|
470
|
+
}
|
|
471
|
+
if (isXPathNamespaceNode(node)) {
|
|
472
|
+
const found = this.kindOf(node.owner) === "element"
|
|
473
|
+
? this.namespaceScope(node.owner).byPrefix.get(node.prefix)
|
|
474
|
+
: undefined;
|
|
475
|
+
if (found === undefined) {
|
|
476
|
+
throw new XPathTypeError("A namespace node not in scope at its owner", null);
|
|
477
|
+
}
|
|
478
|
+
return found;
|
|
479
|
+
}
|
|
480
|
+
return this.adoptTreeNode(node);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* The string-value of a node (XPath 1.0 §5), through `markupStringValue` for
|
|
484
|
+
* tree nodes, charged to the budget.
|
|
485
|
+
*/
|
|
486
|
+
stringValue(node) {
|
|
487
|
+
if (isXPathAttributeNode(node)) {
|
|
488
|
+
const value = this.attributeValueOf(node.attribute);
|
|
489
|
+
this.spendString(value.length);
|
|
490
|
+
return value;
|
|
491
|
+
}
|
|
492
|
+
if (isXPathNamespaceNode(node)) {
|
|
493
|
+
this.spendString(node.uri.length);
|
|
494
|
+
return node.uri;
|
|
495
|
+
}
|
|
496
|
+
const tree = node;
|
|
497
|
+
switch (this.kindOf(tree)) {
|
|
498
|
+
case "comment":
|
|
499
|
+
case "processingInstruction": {
|
|
500
|
+
const data = this.dataOf(tree);
|
|
501
|
+
this.spendString(data.length);
|
|
502
|
+
return data;
|
|
503
|
+
}
|
|
504
|
+
case "doctype":
|
|
505
|
+
return "";
|
|
506
|
+
default:
|
|
507
|
+
try {
|
|
508
|
+
return markupStringValue(this.valueShape, tree, {
|
|
509
|
+
budget: this.budget,
|
|
510
|
+
maxLength: this.maxStringLength,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
catch (error) {
|
|
514
|
+
if (error instanceof MarkupStringValueLengthError) {
|
|
515
|
+
throw new XPathLimitExceededError("stringLength", this.maxStringLength, { cause: error });
|
|
516
|
+
}
|
|
517
|
+
throw error;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
/** Whether an element is an HTML element read under the HTML rules. */
|
|
522
|
+
isHtmlElement(element) {
|
|
523
|
+
return this.html && this.namespaceOf(element) === HTML_NAMESPACE;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Document order between two nodes of this evaluation (XPath 1.0 §5): an
|
|
527
|
+
* element, then its namespace nodes, then its attributes, then its children.
|
|
528
|
+
* Nodes of different trees are ordered by the order their trees were first
|
|
529
|
+
* compared in: stable within the evaluation, otherwise unspecified.
|
|
530
|
+
*/
|
|
531
|
+
compare(a, b) {
|
|
532
|
+
if (a === b) {
|
|
533
|
+
return 0;
|
|
534
|
+
}
|
|
535
|
+
const ownerA = this.treeNodeOf(a);
|
|
536
|
+
const ownerB = this.treeNodeOf(b);
|
|
537
|
+
if (ownerA !== ownerB) {
|
|
538
|
+
return this.compareTreeNodes(ownerA, ownerB);
|
|
539
|
+
}
|
|
540
|
+
const slotA = this.slotOf(a);
|
|
541
|
+
const slotB = this.slotOf(b);
|
|
542
|
+
if (slotA !== slotB) {
|
|
543
|
+
return slotA - slotB;
|
|
544
|
+
}
|
|
545
|
+
return this.subIndexOf(a) - this.subIndexOf(b);
|
|
546
|
+
}
|
|
547
|
+
slotOf(node) {
|
|
548
|
+
if (isXPathAttributeNode(node)) {
|
|
549
|
+
return ATTRIBUTE_SLOT_;
|
|
550
|
+
}
|
|
551
|
+
return isXPathNamespaceNode(node) ? NAMESPACE_SLOT_ : SELF_SLOT_;
|
|
552
|
+
}
|
|
553
|
+
subIndexOf(node) {
|
|
554
|
+
if (isXPathAttributeNode(node)) {
|
|
555
|
+
return this.attributeIndices.get(node) ?? 0;
|
|
556
|
+
}
|
|
557
|
+
if (isXPathNamespaceNode(node)) {
|
|
558
|
+
return this.namespaceIndices.get(node) ?? 0;
|
|
559
|
+
}
|
|
560
|
+
return 0;
|
|
561
|
+
}
|
|
562
|
+
compareTreeNodes(a, b) {
|
|
563
|
+
const rootA = this.rootOf(a);
|
|
564
|
+
const rootB = this.rootOf(b);
|
|
565
|
+
if (rootA !== rootB) {
|
|
566
|
+
return this.treeIdOf(rootA) - this.treeIdOf(rootB);
|
|
567
|
+
}
|
|
568
|
+
if (this.compareDocumentOrder !== undefined) {
|
|
569
|
+
return this.compareDocumentOrder(a, b);
|
|
570
|
+
}
|
|
571
|
+
this.indexTree(rootA);
|
|
572
|
+
return this.orders.get(a) - this.orders.get(b);
|
|
573
|
+
}
|
|
574
|
+
treeIdOf(root) {
|
|
575
|
+
let id = this.treeIds.get(root);
|
|
576
|
+
if (id === undefined) {
|
|
577
|
+
id = this.treeIds.size;
|
|
578
|
+
this.treeIds.set(root, id);
|
|
579
|
+
}
|
|
580
|
+
return id;
|
|
581
|
+
}
|
|
582
|
+
/** Numbers every node of the tree under `root` in pre-order, once. */
|
|
583
|
+
indexTree(root) {
|
|
584
|
+
if (this.orders.has(root)) {
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
walkTree(root, this.childrenOf, (node) => {
|
|
588
|
+
this.orders.set(node, this.orders.size);
|
|
589
|
+
return undefined;
|
|
590
|
+
}, { budget: this.budget });
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* `nodes` in document order without duplicates; the input array may be
|
|
594
|
+
* reordered. O(k log k) comparisons, charged.
|
|
595
|
+
*/
|
|
596
|
+
sortUnique(nodes) {
|
|
597
|
+
if (nodes.length < 2) {
|
|
598
|
+
return nodes;
|
|
599
|
+
}
|
|
600
|
+
this.budget.spend(nodes.length);
|
|
601
|
+
const unique = Array.from(new Set(nodes));
|
|
602
|
+
let sorted = true;
|
|
603
|
+
for (let index = 1; index < unique.length; index++) {
|
|
604
|
+
if (this.compare(unique[index - 1], unique[index]) > 0) {
|
|
605
|
+
sorted = false;
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if (!sorted) {
|
|
610
|
+
this.budget.spend(unique.length * Math.ceil(Math.log2(unique.length)));
|
|
611
|
+
unique.sort((a, b) => this.compare(a, b));
|
|
612
|
+
}
|
|
613
|
+
return unique;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* The first element in document order under `root` whose no-namespace `id`
|
|
617
|
+
* attribute is `id`: the shape's index when it has one, otherwise a table
|
|
618
|
+
* built by one walk of the tree, once per evaluation.
|
|
619
|
+
*/
|
|
620
|
+
elementById(root, id) {
|
|
621
|
+
if (this.elementByIdOf !== undefined) {
|
|
622
|
+
this.budget.spend(1);
|
|
623
|
+
return this.elementByIdOf(root, id);
|
|
624
|
+
}
|
|
625
|
+
let table = this.ids.get(root);
|
|
626
|
+
if (table === undefined) {
|
|
627
|
+
const built = new Map();
|
|
628
|
+
walkTree(root, this.childrenOf, (node) => {
|
|
629
|
+
if (this.kindOf(node) === "element") {
|
|
630
|
+
const value = markupAttributeValue(this.valueShape, node, "id", null, this.budget);
|
|
631
|
+
if (value !== null && value !== "") {
|
|
632
|
+
this.budget.spend(value.length);
|
|
633
|
+
if (!built.has(value)) {
|
|
634
|
+
built.set(value, node);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return undefined;
|
|
639
|
+
}, { budget: this.budget });
|
|
640
|
+
table = built;
|
|
641
|
+
this.ids.set(root, table);
|
|
642
|
+
}
|
|
643
|
+
return table.get(id) ?? null;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
//# sourceMappingURL=_run.js.map
|
package/dist/_run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_run.js","sourceRoot":"","sources":["../src/_run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EACN,cAAc,EAGd,4BAA4B,EAE5B,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,eAAe,GACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,GAKf,MAAM,aAAa,CAAC;AAKrB,+EAA+E;AAC/E,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,eAAe,GAAG,CAAC,CAAC;AAQ1B;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IA6Ef,MAAM;IACN,eAAe;IAGP,SAAS;IAhFlB,MAAM,CAA+C;IACrD,UAAU,CAAmD;IAC7D,QAAQ,CAAiD;IACzD,WAAW,CAAoD;IAC/D,WAAW,CAAoD;IAC/D,QAAQ,CAAiD;IACzD,YAAY,CAAqD;IACjE,oBAAoB,CAGH;IACjB,oBAAoB,CAGH;IACjB,iBAAiB,CAGH;IACd,gBAAgB,CAGH;IACb,MAAM,CAA+C;IACrD,QAAQ,CAAiD;IAElE,wEAAwE;IAC/D,IAAI,CAAU;IAEN,mBAAmB,CAEvB;IACI,mBAAmB,CAGX;IACR,uBAAuB,CAGX;IACZ,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