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.
- package/constants.d.ts +12 -12
- package/constants.js +16 -16
- package/dom/functions.d.ts +14 -14
- package/dom/functions.js +56 -57
- package/dom/functions.js.map +1 -1
- package/dom/index.d.ts +6 -6
- package/dom/index.js +22 -22
- package/dom/util.d.ts +7 -7
- package/dom/util.js +42 -43
- package/dom/util.js.map +1 -1
- package/dom/xdocument.d.ts +16 -16
- package/dom/xdocument.js +73 -74
- package/dom/xdocument.js.map +1 -1
- package/dom/xml-functions.d.ts +58 -58
- package/dom/xml-functions.js +369 -370
- package/dom/xml-functions.js.map +1 -1
- package/dom/xml-output-options.d.ts +6 -6
- package/dom/xml-output-options.js +2 -2
- package/dom/xml-parser.d.ts +47 -47
- package/dom/xml-parser.js +307 -307
- package/dom/xml-parser.js.map +1 -1
- package/dom/xmltoken.d.ts +12 -12
- package/dom/xmltoken.js +101 -101
- package/dom/xnode.d.ts +73 -73
- package/dom/xnode.js +450 -450
- package/dom/xnode.js.map +1 -1
- package/index.d.ts +4 -4
- package/index.js +12 -12
- package/package.json +7 -7
- package/test-without-jest.d.ts +1 -0
- package/test-without-jest.js +63 -0
- package/test-without-jest.js.map +1 -0
- package/umd/constants.d.ts +12 -12
- package/umd/dom/functions.d.ts +14 -14
- package/umd/dom/index.d.ts +6 -6
- package/umd/dom/util.d.ts +7 -7
- package/umd/dom/xdocument.d.ts +16 -16
- package/umd/dom/xml-functions.d.ts +58 -58
- package/umd/dom/xml-output-options.d.ts +6 -6
- package/umd/dom/xml-parser.d.ts +47 -47
- package/umd/dom/xmltoken.d.ts +12 -12
- package/umd/dom/xnode.d.ts +73 -73
- package/umd/index.d.ts +4 -4
- package/umd/test-without-jest.d.ts +1 -0
- package/umd/xpath/common-function.d.ts +8 -8
- package/umd/xpath/expr-context.d.ts +116 -111
- package/umd/xpath/expressions/binary-expr.d.ts +11 -11
- package/umd/xpath/expressions/expression.d.ts +4 -4
- package/umd/xpath/expressions/filter-expr.d.ts +9 -9
- package/umd/xpath/expressions/function-call-expr.d.ts +12 -12
- package/umd/xpath/expressions/index.d.ts +13 -13
- package/umd/xpath/expressions/literal-expr.d.ts +7 -7
- package/umd/xpath/expressions/location-expr.d.ts +15 -15
- package/umd/xpath/expressions/number-expr.d.ts +7 -7
- package/umd/xpath/expressions/path-expr.d.ts +9 -9
- package/umd/xpath/expressions/predicate-expr.d.ts +8 -8
- package/umd/xpath/expressions/step-expr.d.ts +25 -25
- package/umd/xpath/expressions/token-expr.d.ts +7 -7
- package/umd/xpath/expressions/unary-minus-expr.d.ts +8 -8
- package/umd/xpath/expressions/union-expr.d.ts +9 -9
- package/umd/xpath/expressions/variable-expr.d.ts +7 -7
- package/umd/xpath/functions/index.d.ts +4 -2
- package/umd/xpath/functions/internal-functions.d.ts +2 -2
- package/umd/xpath/functions/non-standard.d.ts +12 -12
- package/umd/xpath/functions/standard-20.d.ts +5 -5
- package/umd/xpath/functions/standard.d.ts +40 -40
- package/umd/xpath/functions/xslt-specific.d.ts +3 -0
- package/umd/xpath/grammar-rule-candidate.d.ts +8 -8
- package/umd/xpath/index.d.ts +3 -3
- package/umd/xpath/match-resolver.d.ts +55 -55
- package/umd/xpath/node-tests/index.d.ts +8 -8
- package/umd/xpath/node-tests/node-test-any.d.ts +6 -6
- package/umd/xpath/node-tests/node-test-comment.d.ts +6 -6
- package/umd/xpath/node-tests/node-test-element-or-attribute.d.ts +6 -6
- package/umd/xpath/node-tests/node-test-name.d.ts +10 -10
- package/umd/xpath/node-tests/node-test-nc.d.ts +9 -9
- package/umd/xpath/node-tests/node-test-pi.d.ts +8 -8
- package/umd/xpath/node-tests/node-test-text.d.ts +6 -6
- package/umd/xpath/node-tests/node-test.d.ts +5 -5
- package/umd/xpath/tokens.d.ts +62 -62
- package/umd/xpath/values/boolean-value.d.ts +11 -11
- package/umd/xpath/values/index.d.ts +5 -5
- package/umd/xpath/values/node-set-value.d.ts +11 -11
- package/umd/xpath/values/node-value.d.ts +7 -7
- package/umd/xpath/values/number-value.d.ts +11 -11
- package/umd/xpath/values/string-value.d.ts +11 -11
- package/umd/xpath/xpath-grammar-rules.d.ts +68 -68
- package/umd/xpath/xpath-token-rule.d.ts +7 -7
- package/umd/xpath/xpath.d.ts +174 -174
- package/umd/xpathdebug.d.ts +2 -2
- package/umd/xslt/index.d.ts +3 -3
- package/umd/xslt/xslt-decimal-format-settings.d.ts +28 -28
- package/umd/xslt/xslt-options.d.ts +7 -7
- package/umd/xslt/xslt-parameter.d.ts +5 -5
- package/umd/xslt/xslt.d.ts +260 -207
- package/umd/xslt-processor.js +1 -15
- package/umd/xslt-processor.js.map +1 -1
- package/xpath/common-function.d.ts +8 -8
- package/xpath/common-function.js +31 -32
- package/xpath/common-function.js.map +1 -1
- package/xpath/expr-context.d.ts +116 -111
- package/xpath/expr-context.js +190 -189
- package/xpath/expr-context.js.map +1 -1
- package/xpath/expressions/binary-expr.d.ts +11 -11
- package/xpath/expressions/binary-expr.js +165 -165
- package/xpath/expressions/binary-expr.js.map +1 -1
- package/xpath/expressions/expression.d.ts +4 -4
- package/xpath/expressions/expression.js +9 -9
- package/xpath/expressions/filter-expr.d.ts +9 -9
- package/xpath/expressions/filter-expr.js +52 -52
- package/xpath/expressions/filter-expr.js.map +1 -1
- package/xpath/expressions/function-call-expr.d.ts +12 -12
- package/xpath/expressions/function-call-expr.js +96 -95
- package/xpath/expressions/function-call-expr.js.map +1 -1
- package/xpath/expressions/index.d.ts +13 -13
- package/xpath/expressions/index.js +29 -29
- package/xpath/expressions/literal-expr.d.ts +7 -7
- package/xpath/expressions/literal-expr.js +33 -33
- package/xpath/expressions/literal-expr.js.map +1 -1
- package/xpath/expressions/location-expr.d.ts +15 -15
- package/xpath/expressions/location-expr.js +98 -98
- package/xpath/expressions/location-expr.js.map +1 -1
- package/xpath/expressions/number-expr.d.ts +7 -7
- package/xpath/expressions/number-expr.js +33 -33
- package/xpath/expressions/number-expr.js.map +1 -1
- package/xpath/expressions/path-expr.d.ts +9 -9
- package/xpath/expressions/path-expr.js +51 -51
- package/xpath/expressions/path-expr.js.map +1 -1
- package/xpath/expressions/predicate-expr.d.ts +8 -8
- package/xpath/expressions/predicate-expr.js +40 -40
- package/xpath/expressions/predicate-expr.js.map +1 -1
- package/xpath/expressions/step-expr.d.ts +25 -25
- package/xpath/expressions/step-expr.js +280 -280
- package/xpath/expressions/step-expr.js.map +1 -1
- package/xpath/expressions/token-expr.d.ts +7 -7
- package/xpath/expressions/token-expr.js +33 -33
- package/xpath/expressions/token-expr.js.map +1 -1
- package/xpath/expressions/unary-minus-expr.d.ts +8 -8
- package/xpath/expressions/unary-minus-expr.js +33 -33
- package/xpath/expressions/unary-minus-expr.js.map +1 -1
- package/xpath/expressions/union-expr.d.ts +9 -9
- package/xpath/expressions/union-expr.js +50 -50
- package/xpath/expressions/union-expr.js.map +1 -1
- package/xpath/expressions/variable-expr.d.ts +7 -7
- package/xpath/expressions/variable-expr.js +32 -32
- package/xpath/expressions/variable-expr.js.map +1 -1
- package/xpath/functions/index.d.ts +4 -2
- package/xpath/functions/index.js +20 -18
- package/xpath/functions/index.js.map +1 -1
- package/xpath/functions/internal-functions.d.ts +2 -2
- package/xpath/functions/internal-functions.js +21 -22
- package/xpath/functions/internal-functions.js.map +1 -1
- package/xpath/functions/non-standard.d.ts +12 -12
- package/xpath/functions/non-standard.js +44 -45
- package/xpath/functions/non-standard.js.map +1 -1
- package/xpath/functions/standard-20.d.ts +5 -5
- package/xpath/functions/standard-20.js +25 -26
- package/xpath/functions/standard-20.js.map +1 -1
- package/xpath/functions/standard.d.ts +40 -40
- package/xpath/functions/standard.js +441 -442
- package/xpath/functions/standard.js.map +1 -1
- package/xpath/functions/xslt-specific.d.ts +3 -0
- package/xpath/functions/xslt-specific.js +14 -0
- package/xpath/functions/xslt-specific.js.map +1 -0
- package/xpath/grammar-rule-candidate.d.ts +8 -8
- package/xpath/grammar-rule-candidate.js +2 -2
- package/xpath/index.d.ts +3 -3
- package/xpath/index.js +19 -19
- package/xpath/match-resolver.d.ts +55 -55
- package/xpath/match-resolver.js +136 -136
- package/xpath/match-resolver.js.map +1 -1
- package/xpath/node-tests/index.d.ts +8 -8
- package/xpath/node-tests/index.js +17 -17
- package/xpath/node-tests/node-test-any.d.ts +6 -6
- package/xpath/node-tests/node-test-any.js +14 -14
- package/xpath/node-tests/node-test-comment.d.ts +6 -6
- package/xpath/node-tests/node-test-comment.js +14 -14
- package/xpath/node-tests/node-test-element-or-attribute.d.ts +6 -6
- package/xpath/node-tests/node-test-element-or-attribute.js +15 -15
- package/xpath/node-tests/node-test-name.d.ts +10 -10
- package/xpath/node-tests/node-test-name.js +38 -38
- package/xpath/node-tests/node-test-name.js.map +1 -1
- package/xpath/node-tests/node-test-nc.d.ts +9 -9
- package/xpath/node-tests/node-test-nc.js +16 -16
- package/xpath/node-tests/node-test-pi.d.ts +8 -8
- package/xpath/node-tests/node-test-pi.js +16 -16
- package/xpath/node-tests/node-test-text.d.ts +6 -6
- package/xpath/node-tests/node-test-text.js +14 -14
- package/xpath/node-tests/node-test.d.ts +5 -5
- package/xpath/node-tests/node-test.js +2 -2
- package/xpath/tokens.d.ts +62 -62
- package/xpath/tokens.js +300 -300
- package/xpath/values/boolean-value.d.ts +11 -11
- package/xpath/values/boolean-value.js +23 -23
- package/xpath/values/index.d.ts +5 -5
- package/xpath/values/index.js +46 -46
- package/xpath/values/node-set-value.d.ts +11 -11
- package/xpath/values/node-set-value.js +27 -27
- package/xpath/values/node-set-value.js.map +1 -1
- package/xpath/values/node-value.d.ts +7 -7
- package/xpath/values/node-value.js +2 -2
- package/xpath/values/number-value.d.ts +11 -11
- package/xpath/values/number-value.js +23 -23
- package/xpath/values/string-value.d.ts +11 -11
- package/xpath/values/string-value.js +23 -23
- package/xpath/xpath-grammar-rules.d.ts +68 -68
- package/xpath/xpath-grammar-rules.js +74 -74
- package/xpath/xpath-token-rule.d.ts +7 -7
- package/xpath/xpath-token-rule.js +2 -2
- package/xpath/xpath.d.ts +174 -174
- package/xpath/xpath.js +911 -911
- package/xpath/xpath.js.map +1 -1
- package/xpathdebug.d.ts +2 -2
- package/xpathdebug.js +187 -187
- package/xpathdebug.js.map +1 -1
- package/xslt/index.d.ts +3 -3
- package/xslt/index.js +19 -19
- package/xslt/xslt-decimal-format-settings.d.ts +28 -28
- package/xslt/xslt-decimal-format-settings.js +2 -2
- package/xslt/xslt-options.d.ts +7 -7
- package/xslt/xslt-options.js +2 -2
- package/xslt/xslt-parameter.d.ts +5 -5
- package/xslt/xslt-parameter.js +2 -2
- package/xslt/xslt.d.ts +260 -207
- package/xslt/xslt.js +1290 -1126
- 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
|
+
}
|