Skip to content

Commit 58613ba

Browse files
markborkumdmlb2000
authored andcommitted
Subscriptable JSONPaths (#12)
* Implement JSONPath Copy files from https://github.com/markborkum/pacifica-jsonpath@jsonpath2 and merge conflicts. * Fix some Flake8 warnings * Initial pre-commit run Signed-off-by: David Brown <dmlb2000@gmail.com> * Test parse_str method. * Operator callables should be static Flake8 warned that the operator callables were globals. In a previous commit, the operator callables were refactored into method-locals in the operator's constructor. This is sufficient to resolve the flake8 warnings, but introduces a bug: since callables are created per instance, they have different memory locations, and hence, are not compatible with the `Node`-level definition of `__eq__`, which naively compares each `__dict__` of each operand. The fix is to refactor the operator callables into static methods. * pre-commit fixes * add some bookstore examples for testing Signed-off-by: David Brown <dmlb2000@gmail.com> * pre-commit fixes Signed-off-by: David Brown <dmlb2000@gmail.com> * Rollback modification to grammar * Fix bookstore tests In previous implementations of JSONPath, the current value is implicitly cast to array or object if the next node is an array index subscript or object index subscript. This introduces ambiguity: "is the index subscript referring to the current value, or a child value of the current value?" The solution is to use the wildcard "*" to refer to the child values explicitly. * add more testing to increase coverage Signed-off-by: David Brown <dmlb2000@gmail.com> * pre-commit fix Signed-off-by: David Brown <dmlb2000@gmail.com> * more testing coverage * Improve slice notation Aim for feature parity with equivalent in Python programming language * Tests to increase coverage * pre-commit fixes * fix pre-commit * try some more non-sense tests * add array to test * Python 3.5 doesn't seem to be working great * Add coverage pragmas * More coverage tests * try getting pre-commit and testing right * subscriptable JSONPaths * Resolve flake8 E902, F401, F601 warnings * Resolve pep257 warnings * Resolve pep257 warning * Resolve autopep8 warnings * Resolve pylint warnings * Resolve flake8 F821 warning * Resolve pylint warnings * Resolve autopep8 warnings * Resolve pylint warnings (hopefuly...) * Array index subscript for integers only * Rename variable * Golf down __jsonpath__ implementation * Rename subscript: "path" to "node"
1 parent a1938e2 commit 58613ba

File tree

10 files changed

+626
-292
lines changed

10 files changed

+626
-292
lines changed

jsonpath2/expressions/operator.py

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
"""The operator expression module."""
44
import json
5-
from typing import Callable, Generator, List
5+
from typing import Callable, Generator, List, Union
66
from jsonpath2.expression import Expression
77
from jsonpath2.node import Node
88

@@ -22,33 +22,61 @@ def evaluate(self, root_value: object, current_value: object) -> bool: # pragma
2222
class BinaryOperatorExpression(OperatorExpression):
2323
"""Binary operator expression."""
2424

25-
def __init__(self, token: str, callback: Callable[[object, object], bool], left_node: Node, right_value: object):
25+
def __init__(self, token: str, callback: Callable[[object, object], bool],
26+
left_node_or_value: Union[Node, object], right_node_or_value: Union[Node, object]):
2627
"""Constructor save the left right and token."""
2728
super(BinaryOperatorExpression, self).__init__()
2829
self.token = token
2930
self.callback = callback
30-
self.left_node = left_node
31-
self.right_value = right_value
31+
self.left_node_or_value = left_node_or_value
32+
self.right_node_or_value = right_node_or_value
3233

3334
def __jsonpath__(self) -> Generator[str, None, None]:
3435
"""Return the string json path of this expression."""
35-
for left_node_token in self.left_node.__jsonpath__():
36-
yield left_node_token
36+
if isinstance(self.left_node_or_value, Node):
37+
for left_node_token in self.left_node_or_value.__jsonpath__():
38+
yield left_node_token
39+
else:
40+
yield json.dumps(self.left_node_or_value)
41+
3742
yield ' '
3843
yield self.token
3944
yield ' '
40-
yield json.dumps(self.right_value)
45+
46+
if isinstance(self.right_node_or_value, Node):
47+
for right_node_token in self.right_node_or_value.__jsonpath__():
48+
yield right_node_token
49+
else:
50+
yield json.dumps(self.right_node_or_value)
4151

4252
def evaluate(self, root_value: object, current_value: object) -> bool:
4353
"""Evaluate the left and right values given the token."""
44-
return any(
45-
map(
46-
lambda left_node_match_data: self.callback(
47-
left_node_match_data.current_value,
48-
self.right_value
49-
),
50-
self.left_node.match(root_value, current_value)
54+
if isinstance(self.left_node_or_value, Node):
55+
left_values = (
56+
left_node_match_data.current_value
57+
for left_node_match_data
58+
in self.left_node_or_value.match(root_value, current_value)
5159
)
60+
else:
61+
left_values = [
62+
self.left_node_or_value,
63+
]
64+
65+
if isinstance(self.right_node_or_value, Node):
66+
right_values = (
67+
right_node_match_data.current_value
68+
for right_node_match_data
69+
in self.right_node_or_value.match(root_value, current_value)
70+
)
71+
else:
72+
right_values = [
73+
self.right_node_or_value,
74+
]
75+
76+
return any(
77+
self.callback(left_value, right_value)
78+
for left_value in left_values
79+
for right_value in right_values
5280
)
5381

5482

jsonpath2/expressions/some.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
#!/usr/bin/python
22
# -*- coding: utf-8 -*-
33
"""Some expression module."""
4-
from typing import Generator
4+
import json
5+
from typing import Generator, Union
56
from jsonpath2.expression import Expression
67
from jsonpath2.node import Node
78

89

910
class SomeExpression(Expression):
1011
"""The some expression class."""
1112

12-
def __init__(self, next_node: Node):
13+
def __init__(self, next_node_or_value: Union[Node, object]):
1314
"""Save the next node."""
1415
super(SomeExpression, self).__init__()
15-
self.next_node = next_node
16+
self.next_node_or_value = next_node_or_value
1617

1718
def __jsonpath__(self) -> Generator[str, None, None]:
1819
"""Return the next nodes jsonpath."""
19-
return self.next_node.__jsonpath__()
20+
if isinstance(self.next_node_or_value, Node):
21+
return self.next_node_or_value.__jsonpath__()
22+
return [json.dumps(self.next_node_or_value)]
2023

2124
def evaluate(self, root_value: object, current_value: object) -> bool:
2225
"""Evaluate the next node."""
23-
for _next_node_match_data in self.next_node.match(root_value, current_value):
24-
return True
25-
return False
26+
if isinstance(self.next_node_or_value, Node):
27+
for _next_node_match_data in self.next_node_or_value.match(root_value, current_value):
28+
return True
29+
return False
30+
return bool(self.next_node_or_value)

jsonpath2/parser/JSONPath.g4

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ jsonpath
3434
: ROOT_VALUE subscript? EOF
3535
;
3636

37+
jsonpath_
38+
: ( ROOT_VALUE | CURRENT_VALUE ) subscript?
39+
;
40+
41+
jsonpath__
42+
: jsonpath_
43+
| value
44+
;
45+
46+
3747
subscript
3848
: RECURSIVE_DESCENT ( subscriptableBareword | subscriptables ) subscript?
3949
| SUBSCRIPT subscriptableBareword subscript?
@@ -55,6 +65,7 @@ subscriptable
5565
| sliceable
5666
| WILDCARD_SUBSCRIPT
5767
| QUESTION PAREN_LEFT expression PAREN_RIGHT
68+
| jsonpath_
5869
;
5970

6071
sliceable
@@ -76,7 +87,7 @@ orExpression
7687
notExpression
7788
: NOT notExpression
7889
| PAREN_LEFT expression PAREN_RIGHT
79-
| ( ROOT_VALUE | CURRENT_VALUE ) subscript? ( ( EQ | NE | LT | LE | GT | GE ) value )?
90+
| jsonpath__ ( ( EQ | NE | LT | LE | GT | GE ) jsonpath__ )?
8091
;
8192

8293

jsonpath2/parser/JSONPath.interp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ WS
6666

6767
rule names:
6868
jsonpath
69+
jsonpath_
70+
jsonpath__
6971
subscript
7072
subscriptables
7173
subscriptableBareword
@@ -83,4 +85,4 @@ value
8385

8486

8587
atn:
86-
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 32, 169, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 3, 2, 3, 2, 5, 2, 35, 10, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 5, 3, 42, 10, 3, 3, 3, 5, 3, 45, 10, 3, 3, 3, 3, 3, 3, 3, 5, 3, 50, 10, 3, 3, 3, 3, 3, 5, 3, 54, 10, 3, 5, 3, 56, 10, 3, 3, 4, 3, 4, 3, 4, 3, 4, 7, 4, 62, 10, 4, 12, 4, 14, 4, 65, 11, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 75, 10, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 84, 10, 6, 3, 7, 3, 7, 3, 7, 5, 7, 89, 10, 7, 3, 7, 3, 7, 3, 7, 5, 7, 94, 10, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 5, 9, 101, 10, 9, 3, 10, 3, 10, 3, 10, 5, 10, 106, 10, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 5, 11, 116, 10, 11, 3, 11, 3, 11, 5, 11, 120, 10, 11, 5, 11, 122, 10, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 7, 13, 130, 10, 13, 12, 13, 14, 13, 133, 11, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 139, 10, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 149, 10, 15, 12, 15, 14, 15, 152, 11, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, 158, 10, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 5, 16, 167, 10, 16, 3, 16, 2, 2, 17, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 2, 5, 4, 2, 7, 7, 29, 29, 4, 2, 3, 3, 5, 5, 3, 2, 9, 14, 2, 184, 2, 32, 3, 2, 2, 2, 4, 55, 3, 2, 2, 2, 6, 57, 3, 2, 2, 2, 8, 68, 3, 2, 2, 2, 10, 83, 3, 2, 2, 2, 12, 85, 3, 2, 2, 2, 14, 95, 3, 2, 2, 2, 16, 97, 3, 2, 2, 2, 18, 102, 3, 2, 2, 2, 20, 121, 3, 2, 2, 2, 22, 123, 3, 2, 2, 2, 24, 138, 3, 2, 2, 2, 26, 140, 3, 2, 2, 2, 28, 157, 3, 2, 2, 2, 30, 166, 3, 2, 2, 2, 32, 34, 7, 5, 2, 2, 33, 35, 5, 4, 3, 2, 34, 33, 3, 2, 2, 2, 34, 35, 3, 2, 2, 2, 35, 36, 3, 2, 2, 2, 36, 37, 7, 2, 2, 3, 37, 3, 3, 2, 2, 2, 38, 41, 7, 4, 2, 2, 39, 42, 5, 8, 5, 2, 40, 42, 5, 6, 4, 2, 41, 39, 3, 2, 2, 2, 41, 40, 3, 2, 2, 2, 42, 44, 3, 2, 2, 2, 43, 45, 5, 4, 3, 2, 44, 43, 3, 2, 2, 2, 44, 45, 3, 2, 2, 2, 45, 56, 3, 2, 2, 2, 46, 47, 7, 6, 2, 2, 47, 49, 5, 8, 5, 2, 48, 50, 5, 4, 3, 2, 49, 48, 3, 2, 2, 2, 49, 50, 3, 2, 2, 2, 50, 56, 3, 2, 2, 2, 51, 53, 5, 6, 4, 2, 52, 54, 5, 4, 3, 2, 53, 52, 3, 2, 2, 2, 53, 54, 3, 2, 2, 2, 54, 56, 3, 2, 2, 2, 55, 38, 3, 2, 2, 2, 55, 46, 3, 2, 2, 2, 55, 51, 3, 2, 2, 2, 56, 5, 3, 2, 2, 2, 57, 58, 7, 22, 2, 2, 58, 63, 5, 10, 6, 2, 59, 60, 7, 25, 2, 2, 60, 62, 5, 10, 6, 2, 61, 59, 3, 2, 2, 2, 62, 65, 3, 2, 2, 2, 63, 61, 3, 2, 2, 2, 63, 64, 3, 2, 2, 2, 64, 66, 3, 2, 2, 2, 65, 63, 3, 2, 2, 2, 66, 67, 7, 23, 2, 2, 67, 7, 3, 2, 2, 2, 68, 69, 9, 2, 2, 2, 69, 9, 3, 2, 2, 2, 70, 84, 7, 30, 2, 2, 71, 72, 7, 31, 2, 2, 72, 74, 6, 6, 2, 2, 73, 75, 5, 12, 7, 2, 74, 73, 3, 2, 2, 2, 74, 75, 3, 2, 2, 2, 75, 84, 3, 2, 2, 2, 76, 84, 5, 12, 7, 2, 77, 84, 7, 7, 2, 2, 78, 79, 7, 28, 2, 2, 79, 80, 7, 26, 2, 2, 80, 81, 5, 14, 8, 2, 81, 82, 7, 27, 2, 2, 82, 84, 3, 2, 2, 2, 83, 70, 3, 2, 2, 2, 83, 71, 3, 2, 2, 2, 83, 76, 3, 2, 2, 2, 83, 77, 3, 2, 2, 2, 83, 78, 3, 2, 2, 2, 84, 11, 3, 2, 2, 2, 85, 88, 7, 24, 2, 2, 86, 87, 7, 31, 2, 2, 87, 89, 6, 7, 3, 2, 88, 86, 3, 2, 2, 2, 88, 89, 3, 2, 2, 2, 89, 93, 3, 2, 2, 2, 90, 91, 7, 24, 2, 2, 91, 92, 7, 31, 2, 2, 92, 94, 6, 7, 4, 2, 93, 90, 3, 2, 2, 2, 93, 94, 3, 2, 2, 2, 94, 13, 3, 2, 2, 2, 95, 96, 5, 16, 9, 2, 96, 15, 3, 2, 2, 2, 97, 100, 5, 18, 10, 2, 98, 99, 7, 8, 2, 2, 99, 101, 5, 16, 9, 2, 100, 98, 3, 2, 2, 2, 100, 101, 3, 2, 2, 2, 101, 17, 3, 2, 2, 2, 102, 105, 5, 20, 11, 2, 103, 104, 7, 16, 2, 2, 104, 106, 5, 18, 10, 2, 105, 103, 3, 2, 2, 2, 105, 106, 3, 2, 2, 2, 106, 19, 3, 2, 2, 2, 107, 108, 7, 15, 2, 2, 108, 122, 5, 20, 11, 2, 109, 110, 7, 26, 2, 2, 110, 111, 5, 14, 8, 2, 111, 112, 7, 27, 2, 2, 112, 122, 3, 2, 2, 2, 113, 115, 9, 3, 2, 2, 114, 116, 5, 4, 3, 2, 115, 114, 3, 2, 2, 2, 115, 116, 3, 2, 2, 2, 116, 119, 3, 2, 2, 2, 117, 118, 9, 4, 2, 2, 118, 120, 5, 30, 16, 2, 119, 117, 3, 2, 2, 2, 119, 120, 3, 2, 2, 2, 120, 122, 3, 2, 2, 2, 121, 107, 3, 2, 2, 2, 121, 109, 3, 2, 2, 2, 121, 113, 3, 2, 2, 2, 122, 21, 3, 2, 2, 2, 123, 124, 5, 30, 16, 2, 124, 23, 3, 2, 2, 2, 125, 126, 7, 20, 2, 2, 126, 131, 5, 26, 14, 2, 127, 128, 7, 25, 2, 2, 128, 130, 5, 26, 14, 2, 129, 127, 3, 2, 2, 2, 130, 133, 3, 2, 2, 2, 131, 129, 3, 2, 2, 2, 131, 132, 3, 2, 2, 2, 132, 134, 3, 2, 2, 2, 133, 131, 3, 2, 2, 2, 134, 135, 7, 21, 2, 2, 135, 139, 3, 2, 2, 2, 136, 137, 7, 20, 2, 2, 137, 139, 7, 21, 2, 2, 138, 125, 3, 2, 2, 2, 138, 136, 3, 2, 2, 2, 139, 25, 3, 2, 2, 2, 140, 141, 7, 30, 2, 2, 141, 142, 7, 24, 2, 2, 142, 143, 5, 30, 16, 2, 143, 27, 3, 2, 2, 2, 144, 145, 7, 22, 2, 2, 145, 150, 5, 30, 16, 2, 146, 147, 7, 25, 2, 2, 147, 149, 5, 30, 16, 2, 148, 146, 3, 2, 2, 2, 149, 152, 3, 2, 2, 2, 150, 148, 3, 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 153, 3, 2, 2, 2, 152, 150, 3, 2, 2, 2, 153, 154, 7, 23, 2, 2, 154, 158, 3, 2, 2, 2, 155, 156, 7, 22, 2, 2, 156, 158, 7, 23, 2, 2, 157, 144, 3, 2, 2, 2, 157, 155, 3, 2, 2, 2, 158, 29, 3, 2, 2, 2, 159, 167, 7, 30, 2, 2, 160, 167, 7, 31, 2, 2, 161, 167, 5, 24, 13, 2, 162, 167, 5, 28, 15, 2, 163, 167, 7, 17, 2, 2, 164, 167, 7, 18, 2, 2, 165, 167, 7, 19, 2, 2, 166, 159, 3, 2, 2, 2, 166, 160, 3, 2, 2, 2, 166, 161, 3, 2, 2, 2, 166, 162, 3, 2, 2, 2, 166, 163, 3, 2, 2, 2, 166, 164, 3, 2, 2, 2, 166, 165, 3, 2, 2, 2, 167, 31, 3, 2, 2, 2, 23, 34, 41, 44, 49, 53, 55, 63, 74, 83, 88, 93, 100, 105, 115, 119, 121, 131, 138, 150, 157, 166]
88+
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 32, 179, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 3, 2, 3, 2, 5, 2, 39, 10, 2, 3, 2, 3, 2, 3, 3, 3, 3, 5, 3, 45, 10, 3, 3, 4, 3, 4, 5, 4, 49, 10, 4, 3, 5, 3, 5, 3, 5, 5, 5, 54, 10, 5, 3, 5, 5, 5, 57, 10, 5, 3, 5, 3, 5, 3, 5, 5, 5, 62, 10, 5, 3, 5, 3, 5, 5, 5, 66, 10, 5, 5, 5, 68, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 7, 6, 74, 10, 6, 12, 6, 14, 6, 77, 11, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 87, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 97, 10, 8, 3, 9, 3, 9, 3, 9, 5, 9, 102, 10, 9, 3, 9, 3, 9, 3, 9, 5, 9, 107, 10, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 5, 11, 114, 10, 11, 3, 12, 3, 12, 3, 12, 5, 12, 119, 10, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 130, 10, 13, 5, 13, 132, 10, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 140, 10, 15, 12, 15, 14, 15, 143, 11, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, 149, 10, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 7, 17, 159, 10, 17, 12, 17, 14, 17, 162, 11, 17, 3, 17, 3, 17, 3, 17, 3, 17, 5, 17, 168, 10, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 5, 18, 177, 10, 18, 3, 18, 2, 2, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 2, 5, 4, 2, 3, 3, 5, 5, 4, 2, 7, 7, 29, 29, 3, 2, 9, 14, 2, 194, 2, 36, 3, 2, 2, 2, 4, 42, 3, 2, 2, 2, 6, 48, 3, 2, 2, 2, 8, 67, 3, 2, 2, 2, 10, 69, 3, 2, 2, 2, 12, 80, 3, 2, 2, 2, 14, 96, 3, 2, 2, 2, 16, 98, 3, 2, 2, 2, 18, 108, 3, 2, 2, 2, 20, 110, 3, 2, 2, 2, 22, 115, 3, 2, 2, 2, 24, 131, 3, 2, 2, 2, 26, 133, 3, 2, 2, 2, 28, 148, 3, 2, 2, 2, 30, 150, 3, 2, 2, 2, 32, 167, 3, 2, 2, 2, 34, 176, 3, 2, 2, 2, 36, 38, 7, 5, 2, 2, 37, 39, 5, 8, 5, 2, 38, 37, 3, 2, 2, 2, 38, 39, 3, 2, 2, 2, 39, 40, 3, 2, 2, 2, 40, 41, 7, 2, 2, 3, 41, 3, 3, 2, 2, 2, 42, 44, 9, 2, 2, 2, 43, 45, 5, 8, 5, 2, 44, 43, 3, 2, 2, 2, 44, 45, 3, 2, 2, 2, 45, 5, 3, 2, 2, 2, 46, 49, 5, 4, 3, 2, 47, 49, 5, 34, 18, 2, 48, 46, 3, 2, 2, 2, 48, 47, 3, 2, 2, 2, 49, 7, 3, 2, 2, 2, 50, 53, 7, 4, 2, 2, 51, 54, 5, 12, 7, 2, 52, 54, 5, 10, 6, 2, 53, 51, 3, 2, 2, 2, 53, 52, 3, 2, 2, 2, 54, 56, 3, 2, 2, 2, 55, 57, 5, 8, 5, 2, 56, 55, 3, 2, 2, 2, 56, 57, 3, 2, 2, 2, 57, 68, 3, 2, 2, 2, 58, 59, 7, 6, 2, 2, 59, 61, 5, 12, 7, 2, 60, 62, 5, 8, 5, 2, 61, 60, 3, 2, 2, 2, 61, 62, 3, 2, 2, 2, 62, 68, 3, 2, 2, 2, 63, 65, 5, 10, 6, 2, 64, 66, 5, 8, 5, 2, 65, 64, 3, 2, 2, 2, 65, 66, 3, 2, 2, 2, 66, 68, 3, 2, 2, 2, 67, 50, 3, 2, 2, 2, 67, 58, 3, 2, 2, 2, 67, 63, 3, 2, 2, 2, 68, 9, 3, 2, 2, 2, 69, 70, 7, 22, 2, 2, 70, 75, 5, 14, 8, 2, 71, 72, 7, 25, 2, 2, 72, 74, 5, 14, 8, 2, 73, 71, 3, 2, 2, 2, 74, 77, 3, 2, 2, 2, 75, 73, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 76, 78, 3, 2, 2, 2, 77, 75, 3, 2, 2, 2, 78, 79, 7, 23, 2, 2, 79, 11, 3, 2, 2, 2, 80, 81, 9, 3, 2, 2, 81, 13, 3, 2, 2, 2, 82, 97, 7, 30, 2, 2, 83, 84, 7, 31, 2, 2, 84, 86, 6, 8, 2, 2, 85, 87, 5, 16, 9, 2, 86, 85, 3, 2, 2, 2, 86, 87, 3, 2, 2, 2, 87, 97, 3, 2, 2, 2, 88, 97, 5, 16, 9, 2, 89, 97, 7, 7, 2, 2, 90, 91, 7, 28, 2, 2, 91, 92, 7, 26, 2, 2, 92, 93, 5, 18, 10, 2, 93, 94, 7, 27, 2, 2, 94, 97, 3, 2, 2, 2, 95, 97, 5, 4, 3, 2, 96, 82, 3, 2, 2, 2, 96, 83, 3, 2, 2, 2, 96, 88, 3, 2, 2, 2, 96, 89, 3, 2, 2, 2, 96, 90, 3, 2, 2, 2, 96, 95, 3, 2, 2, 2, 97, 15, 3, 2, 2, 2, 98, 101, 7, 24, 2, 2, 99, 100, 7, 31, 2, 2, 100, 102, 6, 9, 3, 2, 101, 99, 3, 2, 2, 2, 101, 102, 3, 2, 2, 2, 102, 106, 3, 2, 2, 2, 103, 104, 7, 24, 2, 2, 104, 105, 7, 31, 2, 2, 105, 107, 6, 9, 4, 2, 106, 103, 3, 2, 2, 2, 106, 107, 3, 2, 2, 2, 107, 17, 3, 2, 2, 2, 108, 109, 5, 20, 11, 2, 109, 19, 3, 2, 2, 2, 110, 113, 5, 22, 12, 2, 111, 112, 7, 8, 2, 2, 112, 114, 5, 20, 11, 2, 113, 111, 3, 2, 2, 2, 113, 114, 3, 2, 2, 2, 114, 21, 3, 2, 2, 2, 115, 118, 5, 24, 13, 2, 116, 117, 7, 16, 2, 2, 117, 119, 5, 22, 12, 2, 118, 116, 3, 2, 2, 2, 118, 119, 3, 2, 2, 2, 119, 23, 3, 2, 2, 2, 120, 121, 7, 15, 2, 2, 121, 132, 5, 24, 13, 2, 122, 123, 7, 26, 2, 2, 123, 124, 5, 18, 10, 2, 124, 125, 7, 27, 2, 2, 125, 132, 3, 2, 2, 2, 126, 129, 5, 6, 4, 2, 127, 128, 9, 4, 2, 2, 128, 130, 5, 6, 4, 2, 129, 127, 3, 2, 2, 2, 129, 130, 3, 2, 2, 2, 130, 132, 3, 2, 2, 2, 131, 120, 3, 2, 2, 2, 131, 122, 3, 2, 2, 2, 131, 126, 3, 2, 2, 2, 132, 25, 3, 2, 2, 2, 133, 134, 5, 34, 18, 2, 134, 27, 3, 2, 2, 2, 135, 136, 7, 20, 2, 2, 136, 141, 5, 30, 16, 2, 137, 138, 7, 25, 2, 2, 138, 140, 5, 30, 16, 2, 139, 137, 3, 2, 2, 2, 140, 143, 3, 2, 2, 2, 141, 139, 3, 2, 2, 2, 141, 142, 3, 2, 2, 2, 142, 144, 3, 2, 2, 2, 143, 141, 3, 2, 2, 2, 144, 145, 7, 21, 2, 2, 145, 149, 3, 2, 2, 2, 146, 147, 7, 20, 2, 2, 147, 149, 7, 21, 2, 2, 148, 135, 3, 2, 2, 2, 148, 146, 3, 2, 2, 2, 149, 29, 3, 2, 2, 2, 150, 151, 7, 30, 2, 2, 151, 152, 7, 24, 2, 2, 152, 153, 5, 34, 18, 2, 153, 31, 3, 2, 2, 2, 154, 155, 7, 22, 2, 2, 155, 160, 5, 34, 18, 2, 156, 157, 7, 25, 2, 2, 157, 159, 5, 34, 18, 2, 158, 156, 3, 2, 2, 2, 159, 162, 3, 2, 2, 2, 160, 158, 3, 2, 2, 2, 160, 161, 3, 2, 2, 2, 161, 163, 3, 2, 2, 2, 162, 160, 3, 2, 2, 2, 163, 164, 7, 23, 2, 2, 164, 168, 3, 2, 2, 2, 165, 166, 7, 22, 2, 2, 166, 168, 7, 23, 2, 2, 167, 154, 3, 2, 2, 2, 167, 165, 3, 2, 2, 2, 168, 33, 3, 2, 2, 2, 169, 177, 7, 30, 2, 2, 170, 177, 7, 31, 2, 2, 171, 177, 5, 28, 15, 2, 172, 177, 5, 32, 17, 2, 173, 177, 7, 17, 2, 2, 174, 177, 7, 18, 2, 2, 175, 177, 7, 19, 2, 2, 176, 169, 3, 2, 2, 2, 176, 170, 3, 2, 2, 2, 176, 171, 3, 2, 2, 2, 176, 172, 3, 2, 2, 2, 176, 173, 3, 2, 2, 2, 176, 174, 3, 2, 2, 2, 176, 175, 3, 2, 2, 2, 177, 35, 3, 2, 2, 2, 24, 38, 44, 48, 53, 56, 61, 65, 67, 75, 86, 96, 101, 106, 113, 118, 129, 131, 141, 148, 160, 167, 176]

jsonpath2/parser/JSONPathListener.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ def exitJsonpath(self, ctx:JSONPathParser.JsonpathContext):
1717
pass
1818

1919

20+
# Enter a parse tree produced by JSONPathParser#jsonpath_.
21+
def enterJsonpath_(self, ctx:JSONPathParser.Jsonpath_Context):
22+
pass
23+
24+
# Exit a parse tree produced by JSONPathParser#jsonpath_.
25+
def exitJsonpath_(self, ctx:JSONPathParser.Jsonpath_Context):
26+
pass
27+
28+
29+
# Enter a parse tree produced by JSONPathParser#jsonpath__.
30+
def enterJsonpath__(self, ctx:JSONPathParser.Jsonpath__Context):
31+
pass
32+
33+
# Exit a parse tree produced by JSONPathParser#jsonpath__.
34+
def exitJsonpath__(self, ctx:JSONPathParser.Jsonpath__Context):
35+
pass
36+
37+
2038
# Enter a parse tree produced by JSONPathParser#subscript.
2139
def enterSubscript(self, ctx:JSONPathParser.SubscriptContext):
2240
pass

0 commit comments

Comments
 (0)