xslt-processor 3.0.1 → 3.1.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.
Files changed (226) hide show
  1. package/constants.d.ts +12 -12
  2. package/constants.js +16 -16
  3. package/dom/functions.d.ts +14 -14
  4. package/dom/functions.js +56 -57
  5. package/dom/functions.js.map +1 -1
  6. package/dom/index.d.ts +6 -6
  7. package/dom/index.js +22 -22
  8. package/dom/util.d.ts +7 -7
  9. package/dom/util.js +42 -43
  10. package/dom/util.js.map +1 -1
  11. package/dom/xdocument.d.ts +16 -16
  12. package/dom/xdocument.js +73 -74
  13. package/dom/xdocument.js.map +1 -1
  14. package/dom/xml-functions.d.ts +58 -58
  15. package/dom/xml-functions.js +369 -370
  16. package/dom/xml-functions.js.map +1 -1
  17. package/dom/xml-output-options.d.ts +6 -6
  18. package/dom/xml-output-options.js +2 -2
  19. package/dom/xml-parser.d.ts +47 -47
  20. package/dom/xml-parser.js +307 -307
  21. package/dom/xml-parser.js.map +1 -1
  22. package/dom/xmltoken.d.ts +12 -12
  23. package/dom/xmltoken.js +101 -101
  24. package/dom/xnode.d.ts +73 -73
  25. package/dom/xnode.js +450 -450
  26. package/dom/xnode.js.map +1 -1
  27. package/index.d.ts +4 -4
  28. package/index.js +12 -12
  29. package/package.json +7 -7
  30. package/test-without-jest.d.ts +1 -0
  31. package/test-without-jest.js +63 -0
  32. package/test-without-jest.js.map +1 -0
  33. package/umd/constants.d.ts +12 -12
  34. package/umd/dom/functions.d.ts +14 -14
  35. package/umd/dom/index.d.ts +6 -6
  36. package/umd/dom/util.d.ts +7 -7
  37. package/umd/dom/xdocument.d.ts +16 -16
  38. package/umd/dom/xml-functions.d.ts +58 -58
  39. package/umd/dom/xml-output-options.d.ts +6 -6
  40. package/umd/dom/xml-parser.d.ts +47 -47
  41. package/umd/dom/xmltoken.d.ts +12 -12
  42. package/umd/dom/xnode.d.ts +73 -73
  43. package/umd/index.d.ts +4 -4
  44. package/umd/test-without-jest.d.ts +1 -0
  45. package/umd/xpath/common-function.d.ts +8 -8
  46. package/umd/xpath/expr-context.d.ts +116 -111
  47. package/umd/xpath/expressions/binary-expr.d.ts +11 -11
  48. package/umd/xpath/expressions/expression.d.ts +4 -4
  49. package/umd/xpath/expressions/filter-expr.d.ts +9 -9
  50. package/umd/xpath/expressions/function-call-expr.d.ts +12 -12
  51. package/umd/xpath/expressions/index.d.ts +13 -13
  52. package/umd/xpath/expressions/literal-expr.d.ts +7 -7
  53. package/umd/xpath/expressions/location-expr.d.ts +15 -15
  54. package/umd/xpath/expressions/number-expr.d.ts +7 -7
  55. package/umd/xpath/expressions/path-expr.d.ts +9 -9
  56. package/umd/xpath/expressions/predicate-expr.d.ts +8 -8
  57. package/umd/xpath/expressions/step-expr.d.ts +25 -25
  58. package/umd/xpath/expressions/token-expr.d.ts +7 -7
  59. package/umd/xpath/expressions/unary-minus-expr.d.ts +8 -8
  60. package/umd/xpath/expressions/union-expr.d.ts +9 -9
  61. package/umd/xpath/expressions/variable-expr.d.ts +7 -7
  62. package/umd/xpath/functions/index.d.ts +4 -2
  63. package/umd/xpath/functions/internal-functions.d.ts +2 -2
  64. package/umd/xpath/functions/non-standard.d.ts +12 -12
  65. package/umd/xpath/functions/standard-20.d.ts +5 -5
  66. package/umd/xpath/functions/standard.d.ts +40 -40
  67. package/umd/xpath/functions/xslt-specific.d.ts +3 -0
  68. package/umd/xpath/grammar-rule-candidate.d.ts +8 -8
  69. package/umd/xpath/index.d.ts +3 -3
  70. package/umd/xpath/match-resolver.d.ts +55 -55
  71. package/umd/xpath/node-tests/index.d.ts +8 -8
  72. package/umd/xpath/node-tests/node-test-any.d.ts +6 -6
  73. package/umd/xpath/node-tests/node-test-comment.d.ts +6 -6
  74. package/umd/xpath/node-tests/node-test-element-or-attribute.d.ts +6 -6
  75. package/umd/xpath/node-tests/node-test-name.d.ts +10 -10
  76. package/umd/xpath/node-tests/node-test-nc.d.ts +9 -9
  77. package/umd/xpath/node-tests/node-test-pi.d.ts +8 -8
  78. package/umd/xpath/node-tests/node-test-text.d.ts +6 -6
  79. package/umd/xpath/node-tests/node-test.d.ts +5 -5
  80. package/umd/xpath/tokens.d.ts +62 -62
  81. package/umd/xpath/values/boolean-value.d.ts +11 -11
  82. package/umd/xpath/values/index.d.ts +5 -5
  83. package/umd/xpath/values/node-set-value.d.ts +11 -11
  84. package/umd/xpath/values/node-value.d.ts +7 -7
  85. package/umd/xpath/values/number-value.d.ts +11 -11
  86. package/umd/xpath/values/string-value.d.ts +11 -11
  87. package/umd/xpath/xpath-grammar-rules.d.ts +68 -68
  88. package/umd/xpath/xpath-token-rule.d.ts +7 -7
  89. package/umd/xpath/xpath.d.ts +174 -174
  90. package/umd/xpathdebug.d.ts +2 -2
  91. package/umd/xslt/index.d.ts +3 -3
  92. package/umd/xslt/xslt-decimal-format-settings.d.ts +28 -28
  93. package/umd/xslt/xslt-options.d.ts +7 -7
  94. package/umd/xslt/xslt-parameter.d.ts +5 -5
  95. package/umd/xslt/xslt.d.ts +260 -207
  96. package/umd/xslt-processor.js +1 -15
  97. package/umd/xslt-processor.js.map +1 -1
  98. package/xpath/common-function.d.ts +8 -8
  99. package/xpath/common-function.js +31 -32
  100. package/xpath/common-function.js.map +1 -1
  101. package/xpath/expr-context.d.ts +116 -111
  102. package/xpath/expr-context.js +190 -189
  103. package/xpath/expr-context.js.map +1 -1
  104. package/xpath/expressions/binary-expr.d.ts +11 -11
  105. package/xpath/expressions/binary-expr.js +165 -165
  106. package/xpath/expressions/binary-expr.js.map +1 -1
  107. package/xpath/expressions/expression.d.ts +4 -4
  108. package/xpath/expressions/expression.js +9 -9
  109. package/xpath/expressions/filter-expr.d.ts +9 -9
  110. package/xpath/expressions/filter-expr.js +52 -52
  111. package/xpath/expressions/filter-expr.js.map +1 -1
  112. package/xpath/expressions/function-call-expr.d.ts +12 -12
  113. package/xpath/expressions/function-call-expr.js +96 -95
  114. package/xpath/expressions/function-call-expr.js.map +1 -1
  115. package/xpath/expressions/index.d.ts +13 -13
  116. package/xpath/expressions/index.js +29 -29
  117. package/xpath/expressions/literal-expr.d.ts +7 -7
  118. package/xpath/expressions/literal-expr.js +33 -33
  119. package/xpath/expressions/literal-expr.js.map +1 -1
  120. package/xpath/expressions/location-expr.d.ts +15 -15
  121. package/xpath/expressions/location-expr.js +98 -98
  122. package/xpath/expressions/location-expr.js.map +1 -1
  123. package/xpath/expressions/number-expr.d.ts +7 -7
  124. package/xpath/expressions/number-expr.js +33 -33
  125. package/xpath/expressions/number-expr.js.map +1 -1
  126. package/xpath/expressions/path-expr.d.ts +9 -9
  127. package/xpath/expressions/path-expr.js +51 -51
  128. package/xpath/expressions/path-expr.js.map +1 -1
  129. package/xpath/expressions/predicate-expr.d.ts +8 -8
  130. package/xpath/expressions/predicate-expr.js +40 -40
  131. package/xpath/expressions/predicate-expr.js.map +1 -1
  132. package/xpath/expressions/step-expr.d.ts +25 -25
  133. package/xpath/expressions/step-expr.js +280 -280
  134. package/xpath/expressions/step-expr.js.map +1 -1
  135. package/xpath/expressions/token-expr.d.ts +7 -7
  136. package/xpath/expressions/token-expr.js +33 -33
  137. package/xpath/expressions/token-expr.js.map +1 -1
  138. package/xpath/expressions/unary-minus-expr.d.ts +8 -8
  139. package/xpath/expressions/unary-minus-expr.js +33 -33
  140. package/xpath/expressions/unary-minus-expr.js.map +1 -1
  141. package/xpath/expressions/union-expr.d.ts +9 -9
  142. package/xpath/expressions/union-expr.js +50 -50
  143. package/xpath/expressions/union-expr.js.map +1 -1
  144. package/xpath/expressions/variable-expr.d.ts +7 -7
  145. package/xpath/expressions/variable-expr.js +32 -32
  146. package/xpath/expressions/variable-expr.js.map +1 -1
  147. package/xpath/functions/index.d.ts +4 -2
  148. package/xpath/functions/index.js +20 -18
  149. package/xpath/functions/index.js.map +1 -1
  150. package/xpath/functions/internal-functions.d.ts +2 -2
  151. package/xpath/functions/internal-functions.js +21 -22
  152. package/xpath/functions/internal-functions.js.map +1 -1
  153. package/xpath/functions/non-standard.d.ts +12 -12
  154. package/xpath/functions/non-standard.js +44 -45
  155. package/xpath/functions/non-standard.js.map +1 -1
  156. package/xpath/functions/standard-20.d.ts +5 -5
  157. package/xpath/functions/standard-20.js +25 -26
  158. package/xpath/functions/standard-20.js.map +1 -1
  159. package/xpath/functions/standard.d.ts +40 -40
  160. package/xpath/functions/standard.js +441 -442
  161. package/xpath/functions/standard.js.map +1 -1
  162. package/xpath/functions/xslt-specific.d.ts +3 -0
  163. package/xpath/functions/xslt-specific.js +14 -0
  164. package/xpath/functions/xslt-specific.js.map +1 -0
  165. package/xpath/grammar-rule-candidate.d.ts +8 -8
  166. package/xpath/grammar-rule-candidate.js +2 -2
  167. package/xpath/index.d.ts +3 -3
  168. package/xpath/index.js +19 -19
  169. package/xpath/match-resolver.d.ts +55 -55
  170. package/xpath/match-resolver.js +136 -136
  171. package/xpath/match-resolver.js.map +1 -1
  172. package/xpath/node-tests/index.d.ts +8 -8
  173. package/xpath/node-tests/index.js +17 -17
  174. package/xpath/node-tests/node-test-any.d.ts +6 -6
  175. package/xpath/node-tests/node-test-any.js +14 -14
  176. package/xpath/node-tests/node-test-comment.d.ts +6 -6
  177. package/xpath/node-tests/node-test-comment.js +14 -14
  178. package/xpath/node-tests/node-test-element-or-attribute.d.ts +6 -6
  179. package/xpath/node-tests/node-test-element-or-attribute.js +15 -15
  180. package/xpath/node-tests/node-test-name.d.ts +10 -10
  181. package/xpath/node-tests/node-test-name.js +38 -38
  182. package/xpath/node-tests/node-test-name.js.map +1 -1
  183. package/xpath/node-tests/node-test-nc.d.ts +9 -9
  184. package/xpath/node-tests/node-test-nc.js +16 -16
  185. package/xpath/node-tests/node-test-pi.d.ts +8 -8
  186. package/xpath/node-tests/node-test-pi.js +16 -16
  187. package/xpath/node-tests/node-test-text.d.ts +6 -6
  188. package/xpath/node-tests/node-test-text.js +14 -14
  189. package/xpath/node-tests/node-test.d.ts +5 -5
  190. package/xpath/node-tests/node-test.js +2 -2
  191. package/xpath/tokens.d.ts +62 -62
  192. package/xpath/tokens.js +300 -300
  193. package/xpath/values/boolean-value.d.ts +11 -11
  194. package/xpath/values/boolean-value.js +23 -23
  195. package/xpath/values/index.d.ts +5 -5
  196. package/xpath/values/index.js +46 -46
  197. package/xpath/values/node-set-value.d.ts +11 -11
  198. package/xpath/values/node-set-value.js +27 -27
  199. package/xpath/values/node-set-value.js.map +1 -1
  200. package/xpath/values/node-value.d.ts +7 -7
  201. package/xpath/values/node-value.js +2 -2
  202. package/xpath/values/number-value.d.ts +11 -11
  203. package/xpath/values/number-value.js +23 -23
  204. package/xpath/values/string-value.d.ts +11 -11
  205. package/xpath/values/string-value.js +23 -23
  206. package/xpath/xpath-grammar-rules.d.ts +68 -68
  207. package/xpath/xpath-grammar-rules.js +74 -74
  208. package/xpath/xpath-token-rule.d.ts +7 -7
  209. package/xpath/xpath-token-rule.js +2 -2
  210. package/xpath/xpath.d.ts +174 -174
  211. package/xpath/xpath.js +911 -911
  212. package/xpath/xpath.js.map +1 -1
  213. package/xpathdebug.d.ts +2 -2
  214. package/xpathdebug.js +187 -187
  215. package/xpathdebug.js.map +1 -1
  216. package/xslt/index.d.ts +3 -3
  217. package/xslt/index.js +19 -19
  218. package/xslt/xslt-decimal-format-settings.d.ts +28 -28
  219. package/xslt/xslt-decimal-format-settings.js +2 -2
  220. package/xslt/xslt-options.d.ts +7 -7
  221. package/xslt/xslt-options.js +2 -2
  222. package/xslt/xslt-parameter.d.ts +5 -5
  223. package/xslt/xslt-parameter.js +2 -2
  224. package/xslt/xslt.d.ts +260 -207
  225. package/xslt/xslt.js +1290 -1126
  226. package/xslt/xslt.js.map +1 -1
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=xpath-token-rule.js.map
package/xpath/xpath.d.ts CHANGED
@@ -1,174 +1,174 @@
1
- import { ExprContext } from './expr-context';
2
- import { BinaryExpr, FunctionCallExpr, LiteralExpr, LocationExpr, NumberExpr, PathExpr, PredicateExpr, StepExpr, TokenExpr, UnaryMinusExpr, UnionExpr, VariableExpr } from './expressions';
3
- import { Expression } from './expressions/expression';
4
- import { XPathTokenRule } from './xpath-token-rule';
5
- import { XNode } from '../dom';
6
- import { NodeTestAny, NodeTestElementOrAttribute, NodeTestNC, NodeTestName, NodeTestText, NodeTestComment, NodeTestPI, NodeTest } from './node-tests';
7
- import { NodeValue } from './values';
8
- export declare class XPath {
9
- xPathParseCache: any;
10
- xPathRules: any[];
11
- xPathLog: (message: string) => void;
12
- lexerCount: number;
13
- parseCount: number;
14
- reduceCount: number;
15
- xPathGrammarRules: ((number | {
16
- label: string;
17
- key: any;
18
- } | (XPathTokenRule | {
19
- label: string;
20
- key: any;
21
- })[] | ((rel: any, slash: any, step: any) => any))[] | (number | {
22
- label: string;
23
- key: any;
24
- } | {
25
- label: string;
26
- key: any;
27
- }[] | ((nodeTest: any, axis?: string) => StepExpr))[] | (number | {
28
- label: string;
29
- key: any;
30
- } | {
31
- label: string;
32
- }[] | ((name: any, pareno: any, arg1: any, args: any) => FunctionCallExpr))[] | (number | {
33
- label: string;
34
- key: any;
35
- } | {
36
- label: string;
37
- }[] | ((expr: any, predicates: any) => any))[] | (number | boolean | {
38
- label: string;
39
- key: any;
40
- } | (XPathTokenRule | {
41
- label: string;
42
- key: any;
43
- })[] | ((expr1: any, op: any, expr2: any) => BinaryExpr))[])[];
44
- constructor();
45
- makeTokenExpr(m: any): TokenExpr;
46
- passExpr(e: any): any;
47
- makeLocationExpr1(slash: any, rel: any): any;
48
- makeLocationExpr2(dslash: any, rel: any): any;
49
- makeLocationExpr3(): LocationExpr;
50
- makeLocationExpr4(dslash: any): LocationExpr;
51
- makeLocationExpr5(step: any): LocationExpr;
52
- makeLocationExpr6(rel: any, slash: any, step: any): any;
53
- makeLocationExpr7(rel: any, dslash: any, step: any): any;
54
- makeStepExpr1(dot: any): StepExpr;
55
- makeStepExpr2(ddot: any): StepExpr;
56
- makeStepExpr3(axisname: any, axis: any, nodeTest: any): StepExpr;
57
- makeStepExpr4(at: any, nodeTest: any): StepExpr;
58
- makeStepExpr5(nodeTest: any, axis?: string): StepExpr;
59
- makeStepExpr6(step: any, predicate: any): any;
60
- makeAbbrevStep(abbrev: any): StepExpr;
61
- makeNodeTestExpr1(): NodeTestElementOrAttribute;
62
- makeNodeTestExpr2(ncname: any): NodeTestNC;
63
- makeNodeTestExpr3(qname: TokenExpr): NodeTestName;
64
- makeNodeTestExpr4(typeo: any): NodeTestAny | NodeTestComment | NodeTestPI | NodeTestText;
65
- makeNodeTestExpr5(typeo: any, target: any): NodeTestPI;
66
- makePredicateExpr(pareno: any, expression: any): PredicateExpr;
67
- makePrimaryExpr(pareno: any, expression: any): any;
68
- makeFunctionCallExpr1(name: any): FunctionCallExpr;
69
- makeFunctionCallExpr2(name: any, pareno: any, arg1: any, args: any): FunctionCallExpr;
70
- makeArgumentExpr(comma: any, expression: any): any;
71
- makeUnionExpr(expr1: Expression, pipe: TokenExpr, expr2: Expression): UnionExpr;
72
- makePathExpr1(filter: any, slash: any, rel: any): PathExpr;
73
- makePathExpr2(filter: any, dslash: any, rel: any): PathExpr;
74
- makeFilterExpr(expr: any, predicates: any): any;
75
- makeUnaryMinusExpr(minus: any, expr: any): UnaryMinusExpr;
76
- makeBinaryExpr(expr1: any, op: any, expr2: any): BinaryExpr;
77
- makeLiteralExpr(token: any): LiteralExpr;
78
- makeNumberExpr(token: any): NumberExpr;
79
- makeVariableReference(dollar: any, name: any): VariableExpr;
80
- /**
81
- * Used before parsing for optimization of common simple cases. See
82
- * the begin of xPathParse() for which they are.
83
- * @param expression The XPath expression.
84
- * @param axis The axis, if required. Default is 'child'.
85
- * @returns An `Expression` object.
86
- */
87
- makeSimpleExpr(expression: string, axis?: string): Expression;
88
- makeSimpleExpr2(expr: any): LocationExpr;
89
- stackToString(stack: any[]): string;
90
- xPathCacheLookup(expr: any): any;
91
- xPathCollectDescendants(nodeList: XNode[], node: XNode, opt_tagName?: string): void;
92
- xPathCollectDescendantsReverse(nodeList: any, node: any): void;
93
- /**
94
- * Parses and then evaluates the given XPath expression in the given
95
- * input context.
96
- * @param select The xPath string.
97
- * @param context The Expression Context.
98
- * @returns A Node Value.
99
- */
100
- xPathEval(select: string, context: ExprContext): NodeValue;
101
- /**
102
- * DGF - extract a tag name suitable for getElementsByTagName
103
- *
104
- * @param nodeTest the node test
105
- * @param ignoreNonElementNodesForNTA if true, the node list returned when
106
- * evaluating "node()" will not contain
107
- * non-element nodes. This can boost
108
- * performance. This is false by default.
109
- */
110
- xPathExtractTagNameFromNodeTest(nodeTest: NodeTest, ignoreNonElementNodesForNTA: any): string;
111
- xPathMatchStack(stack: any[], pattern: any[]): any;
112
- /**
113
- * Finds the best rule for the XPath expression provided.
114
- * @param expression The XPath string expression.
115
- * @param previous The previous matched XPath rule.
116
- * @returns The found rule and the corresponding match.
117
- */
118
- private findXPathRuleForExpression;
119
- /**
120
- * Initialization for `xPathParse`.
121
- * @see xPathParse
122
- */
123
- private xPathParseInit;
124
- /**
125
- * The entry point for the parser.
126
- * @param expression a string that contains an XPath expression.
127
- * @param axis The XPath axis. Used when the match does not start with the parent.
128
- * @returns an expression object that can be evaluated with an
129
- * expression context.
130
- */
131
- xPathParse(expression: string, axis?: string): any;
132
- private findGrammarRuleCandidate;
133
- /**
134
- * DGF xPathReduce is where the magic happens in this parser.
135
- * Check `src\xpath\xpath-grammar-rules.ts` to find the table of
136
- * grammatical rules and precedence numbers, "The productions of the grammar".
137
- *
138
- * The idea here is that we want to take a stack of tokens and apply
139
- * grammatical rules to them, "reducing" them to higher-level
140
- * tokens. Ultimately, any valid XPath should reduce to exactly one
141
- * "Expr" token.
142
- *
143
- * Reduce too early or too late, and you'll have two tokens that can't reduce
144
- * to single Expr. For example, you may hastily reduce a qname that
145
- * should name a function, incorrectly treating it as a tag name.
146
- * Or you may reduce too late, accidentally reducing the last part of the
147
- * XPath into a top-level "Expr" that won't reduce with earlier parts of
148
- * the XPath.
149
- *
150
- * A "candidate" is a grammatical rule candidate, with a given precedence
151
- * number. "ahead" is the upcoming token, which also has a precedence
152
- * number. If the token has a higher precedence number than
153
- * the rule candidate, we'll "shift" the token onto the token stack,
154
- * instead of immediately applying the rule candidate.
155
- *
156
- * Some tokens have left associativity, in which case we shift when they
157
- * have LOWER precedence than the candidate.
158
- * @param stack The actual grammar rule stack.
159
- * @param ahead The grammar rule ahead.
160
- * @return `true` if a grammar rule candidate was applied. `false` otherwise.
161
- * @private
162
- */
163
- private xPathReduce;
164
- /**
165
- * Utility function to sort a list of nodes. Used by xsltSort().
166
- * @param context The Expression Context.
167
- * @param sort TODO
168
- */
169
- xPathSort(context: ExprContext, sort: any[]): void;
170
- xPathSortByKey(v1: any, v2: any): number;
171
- xPathStep(nodes: any[], steps: any[], step: any, input: XNode, context: ExprContext): void;
172
- xPathGrammarPrecedence(frame: any): number;
173
- xPathTokenPrecedence(tag: any): any;
174
- }
1
+ import { ExprContext } from './expr-context';
2
+ import { BinaryExpr, FunctionCallExpr, LiteralExpr, LocationExpr, NumberExpr, PathExpr, PredicateExpr, StepExpr, TokenExpr, UnaryMinusExpr, UnionExpr, VariableExpr } from './expressions';
3
+ import { Expression } from './expressions/expression';
4
+ import { XPathTokenRule } from './xpath-token-rule';
5
+ import { XNode } from '../dom';
6
+ import { NodeTestAny, NodeTestElementOrAttribute, NodeTestNC, NodeTestName, NodeTestText, NodeTestComment, NodeTestPI, NodeTest } from './node-tests';
7
+ import { NodeValue } from './values';
8
+ export declare class XPath {
9
+ xPathParseCache: any;
10
+ xPathRules: any[];
11
+ xPathLog: (message: string) => void;
12
+ lexerCount: number;
13
+ parseCount: number;
14
+ reduceCount: number;
15
+ xPathGrammarRules: ((number | {
16
+ label: string;
17
+ key: any;
18
+ } | (XPathTokenRule | {
19
+ label: string;
20
+ key: any;
21
+ })[] | ((rel: any, slash: any, step: any) => any))[] | (number | {
22
+ label: string;
23
+ key: any;
24
+ } | {
25
+ label: string;
26
+ key: any;
27
+ }[] | ((nodeTest: any, axis?: string) => StepExpr))[] | (number | {
28
+ label: string;
29
+ key: any;
30
+ } | {
31
+ label: string;
32
+ }[] | ((name: any, pareno: any, arg1: any, args: any) => FunctionCallExpr))[] | (number | {
33
+ label: string;
34
+ key: any;
35
+ } | {
36
+ label: string;
37
+ }[] | ((expr: any, predicates: any) => any))[] | (number | boolean | {
38
+ label: string;
39
+ key: any;
40
+ } | (XPathTokenRule | {
41
+ label: string;
42
+ key: any;
43
+ })[] | ((expr1: any, op: any, expr2: any) => BinaryExpr))[])[];
44
+ constructor();
45
+ makeTokenExpr(m: any): TokenExpr;
46
+ passExpr(e: any): any;
47
+ makeLocationExpr1(slash: any, rel: any): any;
48
+ makeLocationExpr2(dslash: any, rel: any): any;
49
+ makeLocationExpr3(): LocationExpr;
50
+ makeLocationExpr4(dslash: any): LocationExpr;
51
+ makeLocationExpr5(step: any): LocationExpr;
52
+ makeLocationExpr6(rel: any, slash: any, step: any): any;
53
+ makeLocationExpr7(rel: any, dslash: any, step: any): any;
54
+ makeStepExpr1(dot: any): StepExpr;
55
+ makeStepExpr2(ddot: any): StepExpr;
56
+ makeStepExpr3(axisname: any, axis: any, nodeTest: any): StepExpr;
57
+ makeStepExpr4(at: any, nodeTest: any): StepExpr;
58
+ makeStepExpr5(nodeTest: any, axis?: string): StepExpr;
59
+ makeStepExpr6(step: any, predicate: any): any;
60
+ makeAbbrevStep(abbrev: any): StepExpr;
61
+ makeNodeTestExpr1(): NodeTestElementOrAttribute;
62
+ makeNodeTestExpr2(ncname: any): NodeTestNC;
63
+ makeNodeTestExpr3(qname: TokenExpr): NodeTestName;
64
+ makeNodeTestExpr4(typeo: any): NodeTestAny | NodeTestComment | NodeTestPI | NodeTestText;
65
+ makeNodeTestExpr5(typeo: any, target: any): NodeTestPI;
66
+ makePredicateExpr(pareno: any, expression: any): PredicateExpr;
67
+ makePrimaryExpr(pareno: any, expression: any): any;
68
+ makeFunctionCallExpr1(name: any): FunctionCallExpr;
69
+ makeFunctionCallExpr2(name: any, pareno: any, arg1: any, args: any): FunctionCallExpr;
70
+ makeArgumentExpr(comma: any, expression: any): any;
71
+ makeUnionExpr(expr1: Expression, pipe: TokenExpr, expr2: Expression): UnionExpr;
72
+ makePathExpr1(filter: any, slash: any, rel: any): PathExpr;
73
+ makePathExpr2(filter: any, dslash: any, rel: any): PathExpr;
74
+ makeFilterExpr(expr: any, predicates: any): any;
75
+ makeUnaryMinusExpr(minus: any, expr: any): UnaryMinusExpr;
76
+ makeBinaryExpr(expr1: any, op: any, expr2: any): BinaryExpr;
77
+ makeLiteralExpr(token: any): LiteralExpr;
78
+ makeNumberExpr(token: any): NumberExpr;
79
+ makeVariableReference(dollar: any, name: any): VariableExpr;
80
+ /**
81
+ * Used before parsing for optimization of common simple cases. See
82
+ * the begin of xPathParse() for which they are.
83
+ * @param expression The XPath expression.
84
+ * @param axis The axis, if required. Default is 'child'.
85
+ * @returns An `Expression` object.
86
+ */
87
+ makeSimpleExpr(expression: string, axis?: string): Expression;
88
+ makeSimpleExpr2(expr: any): LocationExpr;
89
+ stackToString(stack: any[]): string;
90
+ xPathCacheLookup(expr: any): any;
91
+ xPathCollectDescendants(nodeList: XNode[], node: XNode, opt_tagName?: string): void;
92
+ xPathCollectDescendantsReverse(nodeList: any, node: any): void;
93
+ /**
94
+ * Parses and then evaluates the given XPath expression in the given
95
+ * input context.
96
+ * @param select The xPath string.
97
+ * @param context The Expression Context.
98
+ * @returns A Node Value.
99
+ */
100
+ xPathEval(select: string, context: ExprContext): NodeValue;
101
+ /**
102
+ * DGF - extract a tag name suitable for getElementsByTagName
103
+ *
104
+ * @param nodeTest the node test
105
+ * @param ignoreNonElementNodesForNTA if true, the node list returned when
106
+ * evaluating "node()" will not contain
107
+ * non-element nodes. This can boost
108
+ * performance. This is false by default.
109
+ */
110
+ xPathExtractTagNameFromNodeTest(nodeTest: NodeTest, ignoreNonElementNodesForNTA: any): string;
111
+ xPathMatchStack(stack: any[], pattern: any[]): any;
112
+ /**
113
+ * Finds the best rule for the XPath expression provided.
114
+ * @param expression The XPath string expression.
115
+ * @param previous The previous matched XPath rule.
116
+ * @returns The found rule and the corresponding match.
117
+ */
118
+ private findXPathRuleForExpression;
119
+ /**
120
+ * Initialization for `xPathParse`.
121
+ * @see xPathParse
122
+ */
123
+ private xPathParseInit;
124
+ /**
125
+ * The entry point for the parser.
126
+ * @param expression a string that contains an XPath expression.
127
+ * @param axis The XPath axis. Used when the match does not start with the parent.
128
+ * @returns an expression object that can be evaluated with an
129
+ * expression context.
130
+ */
131
+ xPathParse(expression: string, axis?: string): any;
132
+ private findGrammarRuleCandidate;
133
+ /**
134
+ * DGF xPathReduce is where the magic happens in this parser.
135
+ * Check `src\xpath\xpath-grammar-rules.ts` to find the table of
136
+ * grammatical rules and precedence numbers, "The productions of the grammar".
137
+ *
138
+ * The idea here is that we want to take a stack of tokens and apply
139
+ * grammatical rules to them, "reducing" them to higher-level
140
+ * tokens. Ultimately, any valid XPath should reduce to exactly one
141
+ * "Expr" token.
142
+ *
143
+ * Reduce too early or too late, and you'll have two tokens that can't reduce
144
+ * to single Expr. For example, you may hastily reduce a qname that
145
+ * should name a function, incorrectly treating it as a tag name.
146
+ * Or you may reduce too late, accidentally reducing the last part of the
147
+ * XPath into a top-level "Expr" that won't reduce with earlier parts of
148
+ * the XPath.
149
+ *
150
+ * A "candidate" is a grammatical rule candidate, with a given precedence
151
+ * number. "ahead" is the upcoming token, which also has a precedence
152
+ * number. If the token has a higher precedence number than
153
+ * the rule candidate, we'll "shift" the token onto the token stack,
154
+ * instead of immediately applying the rule candidate.
155
+ *
156
+ * Some tokens have left associativity, in which case we shift when they
157
+ * have LOWER precedence than the candidate.
158
+ * @param stack The actual grammar rule stack.
159
+ * @param ahead The grammar rule ahead.
160
+ * @return `true` if a grammar rule candidate was applied. `false` otherwise.
161
+ * @private
162
+ */
163
+ private xPathReduce;
164
+ /**
165
+ * Utility function to sort a list of nodes. Used by xsltSort().
166
+ * @param context The Expression Context.
167
+ * @param sort TODO
168
+ */
169
+ xPathSort(context: ExprContext, sort: any[]): void;
170
+ xPathSortByKey(v1: any, v2: any): number;
171
+ xPathStep(nodes: any[], steps: any[], step: any, input: XNode, context: ExprContext): void;
172
+ xPathGrammarPrecedence(frame: any): number;
173
+ xPathTokenPrecedence(tag: any): any;
174
+ }