kodexa 7.5.514404640805__py3-none-any.whl → 8.0.14958192442__py3-none-any.whl
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.
- kodexa/dataclasses/__init__.py +1 -1
- kodexa/model/__init__.py +2 -2
- kodexa/model/objects.py +21 -1
- kodexa/model/utils.py +1 -1
- kodexa/pipeline/pipeline.py +1 -1
- kodexa/platform/client.py +1 -2
- kodexa/platform/kodexa.py +4 -1
- kodexa/platform/manifest.py +447 -0
- kodexa/selectors/__init__.py +1 -1
- kodexa/selectors/ast.py +371 -98
- kodexa/selectors/error.py +29 -0
- kodexa/selectors/kodexa-ast-visitor.py +268 -0
- kodexa/selectors/parser.py +91 -0
- kodexa/selectors/resources/KodexaSelector.interp +99 -0
- kodexa/selectors/resources/KodexaSelector.tokens +56 -0
- kodexa/selectors/resources/KodexaSelectorLexer.interp +119 -0
- kodexa/selectors/resources/KodexaSelectorLexer.py +204 -0
- kodexa/selectors/resources/KodexaSelectorLexer.tokens +56 -0
- kodexa/selectors/resources/KodexaSelectorListener.py +570 -0
- kodexa/selectors/resources/KodexaSelectorParser.py +3246 -0
- kodexa/selectors/resources/KodexaSelectorVisitor.py +323 -0
- kodexa/selectors/visitor.py +265 -0
- kodexa/steps/__init__.py +4 -2
- kodexa/steps/common.py +0 -68
- kodexa/testing/test_utils.py +1 -1
- {kodexa-7.5.514404640805.dist-info → kodexa-8.0.14958192442.dist-info}/METADATA +7 -3
- kodexa-8.0.14958192442.dist-info/RECORD +53 -0
- {kodexa-7.5.514404640805.dist-info → kodexa-8.0.14958192442.dist-info}/WHEEL +1 -1
- kodexa/model/model.py +0 -3259
- kodexa/model/persistence.py +0 -2017
- kodexa/selectors/core.py +0 -124
- kodexa/selectors/lexrules.py +0 -137
- kodexa/selectors/lextab.py +0 -83
- kodexa/selectors/lextab.pyi +0 -1
- kodexa/selectors/parserules.py +0 -414
- kodexa/selectors/parserules.pyi +0 -1
- kodexa/selectors/parsetab.py +0 -4149
- kodexa/selectors/parsetab.pyi +0 -1
- kodexa-7.5.514404640805.dist-info/RECORD +0 -50
- {kodexa-7.5.514404640805.dist-info → kodexa-8.0.14958192442.dist-info}/LICENSE +0 -0
kodexa/selectors/parserules.py
DELETED
@@ -1,414 +0,0 @@
|
|
1
|
-
"""XPath parsing rules.
|
2
|
-
|
3
|
-
To understand how this module works, it is valuable to have a strong
|
4
|
-
understanding of the `ply <http://www.dabeaz.com/ply/>` module.
|
5
|
-
"""
|
6
|
-
|
7
|
-
from __future__ import unicode_literals
|
8
|
-
from kodexa.selectors import ast
|
9
|
-
from kodexa.selectors.lexrules import tokens
|
10
|
-
|
11
|
-
precedence = (
|
12
|
-
("left", "OR_OP"),
|
13
|
-
("left", "AND_OP"),
|
14
|
-
("left", "EQUAL_OP"),
|
15
|
-
("left", "REL_OP"),
|
16
|
-
("left", "PLUS_OP", "MINUS_OP"),
|
17
|
-
("left", "MULT_OP", "DIV_OP", "MOD_OP"),
|
18
|
-
("right", "UMINUS_OP"),
|
19
|
-
("left", "UNION_OP"),
|
20
|
-
("left", "INTERSECT_OP"),
|
21
|
-
)
|
22
|
-
|
23
|
-
|
24
|
-
#
|
25
|
-
# basic expressions
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
def p_expr_boolean(p):
|
30
|
-
"""
|
31
|
-
Expr : Expr OR_OP Expr
|
32
|
-
| Expr AND_OP Expr
|
33
|
-
| Expr EQUAL_OP Expr
|
34
|
-
| Expr REL_OP Expr
|
35
|
-
| Expr PLUS_OP Expr
|
36
|
-
| Expr MINUS_OP Expr
|
37
|
-
| Expr MULT_OP Expr
|
38
|
-
| Expr DIV_OP Expr
|
39
|
-
| Expr MOD_OP Expr
|
40
|
-
| Expr UNION_OP Expr
|
41
|
-
| Expr INTERSECT_OP Expr
|
42
|
-
"""
|
43
|
-
p[0] = ast.BinaryExpression(p[1], p[2], p[3])
|
44
|
-
|
45
|
-
|
46
|
-
def p_expr_unary(p):
|
47
|
-
"""
|
48
|
-
Expr : MINUS_OP Expr %prec UMINUS_OP
|
49
|
-
"""
|
50
|
-
p[0] = ast.UnaryExpression(p[1], p[2])
|
51
|
-
|
52
|
-
|
53
|
-
def p_expr_pipeline(p):
|
54
|
-
"""
|
55
|
-
Expr : Expr PIPELINE_OP Expr
|
56
|
-
"""
|
57
|
-
p[0] = ast.PipelineExpression(p[1], p[2], p[3])
|
58
|
-
|
59
|
-
|
60
|
-
#
|
61
|
-
# path expressions
|
62
|
-
#
|
63
|
-
|
64
|
-
|
65
|
-
def p_path_expr_binary(p):
|
66
|
-
"""
|
67
|
-
Expr : FilterExpr PATH_SEP RelativeLocationPath
|
68
|
-
| FilterExpr ABBREV_PATH_SEP RelativeLocationPath
|
69
|
-
"""
|
70
|
-
p[0] = ast.BinaryExpression(p[1], p[2], p[3])
|
71
|
-
|
72
|
-
|
73
|
-
def p_path_expr_unary(p):
|
74
|
-
"""
|
75
|
-
Expr : RelativeLocationPath
|
76
|
-
| AbsoluteLocationPath
|
77
|
-
| AbbreviatedAbsoluteLocationPath
|
78
|
-
| FilterExpr
|
79
|
-
"""
|
80
|
-
p[0] = p[1]
|
81
|
-
|
82
|
-
|
83
|
-
#
|
84
|
-
# paths
|
85
|
-
#
|
86
|
-
|
87
|
-
|
88
|
-
def p_absolute_location_path_rootonly(p):
|
89
|
-
"""
|
90
|
-
AbsoluteLocationPath : PATH_SEP
|
91
|
-
"""
|
92
|
-
p[0] = ast.AbsolutePath(p[1])
|
93
|
-
|
94
|
-
|
95
|
-
def p_absolute_location_path_subpath(p):
|
96
|
-
"""
|
97
|
-
AbsoluteLocationPath : PATH_SEP RelativeLocationPath
|
98
|
-
"""
|
99
|
-
p[0] = ast.AbsolutePath(p[1], p[2])
|
100
|
-
|
101
|
-
|
102
|
-
def p_abbreviated_absolute_location_path(p):
|
103
|
-
"""
|
104
|
-
AbbreviatedAbsoluteLocationPath : ABBREV_PATH_SEP RelativeLocationPath
|
105
|
-
"""
|
106
|
-
p[0] = ast.AbsolutePath(p[1], p[2])
|
107
|
-
|
108
|
-
|
109
|
-
def p_relative_location_path_simple(p):
|
110
|
-
"""
|
111
|
-
RelativeLocationPath : Step
|
112
|
-
"""
|
113
|
-
p[0] = p[1]
|
114
|
-
|
115
|
-
|
116
|
-
def p_relative_location_path_binary(p):
|
117
|
-
"""
|
118
|
-
RelativeLocationPath : RelativeLocationPath PATH_SEP Step
|
119
|
-
| RelativeLocationPath ABBREV_PATH_SEP Step
|
120
|
-
"""
|
121
|
-
p[0] = ast.BinaryExpression(p[1], p[2], p[3])
|
122
|
-
|
123
|
-
|
124
|
-
#
|
125
|
-
# path steps
|
126
|
-
#
|
127
|
-
|
128
|
-
|
129
|
-
def p_step_nodetest(p):
|
130
|
-
"""
|
131
|
-
Step : NodeTest
|
132
|
-
"""
|
133
|
-
p[0] = ast.Step(None, p[1], [])
|
134
|
-
|
135
|
-
|
136
|
-
def p_step_nodetest_predicates(p):
|
137
|
-
"""
|
138
|
-
Step : NodeTest PredicateList
|
139
|
-
"""
|
140
|
-
p[0] = ast.Step(None, p[1], p[2])
|
141
|
-
|
142
|
-
|
143
|
-
def p_step_axis_nodetest(p):
|
144
|
-
"""
|
145
|
-
Step : AxisSpecifier NodeTest
|
146
|
-
"""
|
147
|
-
p[0] = ast.Step(p[1], p[2], [])
|
148
|
-
|
149
|
-
|
150
|
-
def p_step_axis_nodetest_predicates(p):
|
151
|
-
"""
|
152
|
-
Step : AxisSpecifier NodeTest PredicateList
|
153
|
-
"""
|
154
|
-
p[0] = ast.Step(p[1], p[2], p[3])
|
155
|
-
|
156
|
-
|
157
|
-
def p_step_abbrev(p):
|
158
|
-
"""
|
159
|
-
Step : ABBREV_STEP_SELF
|
160
|
-
| ABBREV_STEP_PARENT
|
161
|
-
"""
|
162
|
-
p[0] = ast.AbbreviatedStep(p[1])
|
163
|
-
|
164
|
-
|
165
|
-
#
|
166
|
-
# axis specifier
|
167
|
-
#
|
168
|
-
|
169
|
-
|
170
|
-
def p_axis_specifier_full(p):
|
171
|
-
"""
|
172
|
-
AxisSpecifier : AXISNAME AXIS_SEP
|
173
|
-
"""
|
174
|
-
p[0] = p[1]
|
175
|
-
|
176
|
-
|
177
|
-
def p_axis_specifier_abbrev(p):
|
178
|
-
"""
|
179
|
-
AxisSpecifier : ABBREV_AXIS_AT
|
180
|
-
"""
|
181
|
-
p[0] = "@"
|
182
|
-
|
183
|
-
|
184
|
-
#
|
185
|
-
# node test
|
186
|
-
#
|
187
|
-
|
188
|
-
|
189
|
-
def p_node_test_name_test(p):
|
190
|
-
"""
|
191
|
-
NodeTest : NameTest
|
192
|
-
"""
|
193
|
-
p[0] = p[1]
|
194
|
-
|
195
|
-
|
196
|
-
def p_node_test_type_simple(p):
|
197
|
-
"""
|
198
|
-
NodeTest : NODETYPE OPEN_PAREN CLOSE_PAREN
|
199
|
-
"""
|
200
|
-
# NOTE: Strictly speaking p[1] must come from a list of recognized
|
201
|
-
# NodeTypes. Since we don't actually do anything with them, we don't
|
202
|
-
# need to recognize them.
|
203
|
-
p[0] = ast.NodeType(p[1])
|
204
|
-
|
205
|
-
|
206
|
-
def p_node_test_type_literal(p):
|
207
|
-
"""
|
208
|
-
NodeTest : NODETYPE OPEN_PAREN LITERAL CLOSE_PAREN
|
209
|
-
"""
|
210
|
-
# NOTE: Technically this only allows 'processing-instruction' for p[1].
|
211
|
-
# We'll go light on that restriction since we don't actually need it for
|
212
|
-
# processing.
|
213
|
-
p[0] = ast.NodeType(p[1], p[3])
|
214
|
-
|
215
|
-
|
216
|
-
#
|
217
|
-
# name test
|
218
|
-
#
|
219
|
-
|
220
|
-
|
221
|
-
def p_name_test_star(p):
|
222
|
-
"""
|
223
|
-
NameTest : STAR_OP
|
224
|
-
"""
|
225
|
-
p[0] = ast.NameTest(None, p[1])
|
226
|
-
|
227
|
-
|
228
|
-
def p_name_test_prefix_star(p):
|
229
|
-
"""
|
230
|
-
NameTest : NCNAME COLON STAR_OP
|
231
|
-
"""
|
232
|
-
p[0] = ast.NameTest(p[1], p[3])
|
233
|
-
|
234
|
-
|
235
|
-
def p_name_test_qname(p):
|
236
|
-
"""
|
237
|
-
NameTest : QName
|
238
|
-
"""
|
239
|
-
qname = p[1]
|
240
|
-
p[0] = ast.NameTest(qname[0], qname[1])
|
241
|
-
|
242
|
-
|
243
|
-
#
|
244
|
-
# qname
|
245
|
-
#
|
246
|
-
|
247
|
-
|
248
|
-
def p_qname_prefixed(p):
|
249
|
-
"""
|
250
|
-
QName : NCNAME COLON NCNAME
|
251
|
-
"""
|
252
|
-
p[0] = (p[1], p[3])
|
253
|
-
|
254
|
-
|
255
|
-
def p_qname_unprefixed(p):
|
256
|
-
"""
|
257
|
-
QName : NCNAME
|
258
|
-
"""
|
259
|
-
p[0] = (None, p[1])
|
260
|
-
|
261
|
-
|
262
|
-
def p_funcqname_prefixed(p):
|
263
|
-
"""
|
264
|
-
FuncQName : NCNAME COLON FUNCNAME
|
265
|
-
"""
|
266
|
-
p[0] = (p[1], p[3])
|
267
|
-
|
268
|
-
|
269
|
-
def p_funcqname_unprefixed(p):
|
270
|
-
"""
|
271
|
-
FuncQName : FUNCNAME
|
272
|
-
"""
|
273
|
-
p[0] = (None, p[1])
|
274
|
-
|
275
|
-
|
276
|
-
#
|
277
|
-
# filter expressions
|
278
|
-
#
|
279
|
-
|
280
|
-
|
281
|
-
def p_filter_expr_simple(p):
|
282
|
-
"""
|
283
|
-
FilterExpr : VariableReference
|
284
|
-
| LITERAL
|
285
|
-
| Number
|
286
|
-
| FunctionCall
|
287
|
-
"""
|
288
|
-
# FIXME: | FunctionCall moved so as not to conflict with NodeTest :
|
289
|
-
# FunctionCall
|
290
|
-
p[0] = p[1]
|
291
|
-
|
292
|
-
|
293
|
-
def p_filter_expr_grouped(p):
|
294
|
-
"""
|
295
|
-
FilterExpr : OPEN_PAREN Expr CLOSE_PAREN
|
296
|
-
"""
|
297
|
-
p[0] = p[2]
|
298
|
-
|
299
|
-
|
300
|
-
def p_filter_expr_predicate(p):
|
301
|
-
"""
|
302
|
-
FilterExpr : FilterExpr Predicate
|
303
|
-
"""
|
304
|
-
if not hasattr(p[1], "append_predicate"):
|
305
|
-
p[1] = ast.PredicatedExpression(p[1])
|
306
|
-
p[1].append_predicate(p[2])
|
307
|
-
p[0] = p[1]
|
308
|
-
|
309
|
-
|
310
|
-
#
|
311
|
-
# predicates
|
312
|
-
#
|
313
|
-
|
314
|
-
|
315
|
-
def p_predicate_list_single(p):
|
316
|
-
"""
|
317
|
-
PredicateList : Predicate
|
318
|
-
"""
|
319
|
-
p[0] = [p[1]]
|
320
|
-
|
321
|
-
|
322
|
-
def p_predicate_list_recursive(p):
|
323
|
-
"""
|
324
|
-
PredicateList : PredicateList Predicate
|
325
|
-
"""
|
326
|
-
p[0] = p[1]
|
327
|
-
p[0].append(p[2])
|
328
|
-
|
329
|
-
|
330
|
-
def p_predicate(p):
|
331
|
-
"""
|
332
|
-
Predicate : OPEN_BRACKET Expr CLOSE_BRACKET
|
333
|
-
"""
|
334
|
-
p[0] = p[2]
|
335
|
-
|
336
|
-
|
337
|
-
#
|
338
|
-
# variable
|
339
|
-
#
|
340
|
-
|
341
|
-
|
342
|
-
def p_variable_reference(p):
|
343
|
-
"""
|
344
|
-
VariableReference : DOLLAR QName
|
345
|
-
"""
|
346
|
-
p[0] = ast.VariableReference(p[2])
|
347
|
-
|
348
|
-
|
349
|
-
#
|
350
|
-
# number
|
351
|
-
#
|
352
|
-
|
353
|
-
|
354
|
-
def p_number(p):
|
355
|
-
"""
|
356
|
-
Number : FLOAT
|
357
|
-
| INTEGER
|
358
|
-
"""
|
359
|
-
p[0] = p[1]
|
360
|
-
|
361
|
-
|
362
|
-
#
|
363
|
-
# funcall
|
364
|
-
#
|
365
|
-
|
366
|
-
|
367
|
-
def p_function_call(p):
|
368
|
-
"""
|
369
|
-
FunctionCall : FuncQName FormalArguments
|
370
|
-
"""
|
371
|
-
# FIXME: This production also matches NodeType() or
|
372
|
-
# processing-instruction("foo"), which are technically NodeTest
|
373
|
-
qname = p[1]
|
374
|
-
p[0] = ast.FunctionCall(qname[0], qname[1], p[2])
|
375
|
-
|
376
|
-
|
377
|
-
def p_formal_arguments_empty(p):
|
378
|
-
"""
|
379
|
-
FormalArguments : OPEN_PAREN CLOSE_PAREN
|
380
|
-
"""
|
381
|
-
p[0] = []
|
382
|
-
|
383
|
-
|
384
|
-
def p_formal_arguments_list(p):
|
385
|
-
"""
|
386
|
-
FormalArguments : OPEN_PAREN ArgumentList CLOSE_PAREN
|
387
|
-
"""
|
388
|
-
p[0] = p[2]
|
389
|
-
|
390
|
-
|
391
|
-
def p_argument_list_single(p):
|
392
|
-
"""
|
393
|
-
ArgumentList : Expr
|
394
|
-
"""
|
395
|
-
p[0] = [p[1]]
|
396
|
-
|
397
|
-
|
398
|
-
def p_argument_list_recursive(p):
|
399
|
-
"""
|
400
|
-
ArgumentList : ArgumentList COMMA Expr
|
401
|
-
"""
|
402
|
-
p[0] = p[1]
|
403
|
-
p[0].append(p[3])
|
404
|
-
|
405
|
-
|
406
|
-
#
|
407
|
-
# error handling
|
408
|
-
#
|
409
|
-
|
410
|
-
|
411
|
-
def p_error(p):
|
412
|
-
# In some cases, p could actually be None.
|
413
|
-
# However, stack trace should have enough information to identify the problem.
|
414
|
-
raise RuntimeError("Syntax error at '%s'" % repr(p))
|
kodexa/selectors/parserules.pyi
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Empty on purpose to stop mypy analyzing the generated file
|