Remove useless FILTER_VALUE type
This commit is contained in:
parent
41157c6434
commit
ece80769c5
|
@ -28,9 +28,8 @@ class ExtendedJsonPathLexer(lexer.JsonPathLexer):
|
||||||
"""Custom LALR-lexer for JsonPath"""
|
"""Custom LALR-lexer for JsonPath"""
|
||||||
literals = lexer.JsonPathLexer.literals + ['?', '@']
|
literals = lexer.JsonPathLexer.literals + ['?', '@']
|
||||||
tokens = (parser.JsonPathLexer.tokens +
|
tokens = (parser.JsonPathLexer.tokens +
|
||||||
['FILTER_OP', 'FILTER_VALUE', 'SORT_DIRECTION'])
|
['FILTER_OP', 'SORT_DIRECTION'])
|
||||||
|
|
||||||
t_FILTER_VALUE = r'\w+'
|
|
||||||
t_FILTER_OP = r'(==?|<=|>=|!=|<|>)'
|
t_FILTER_OP = r'(==?|<=|>=|!=|<|>)'
|
||||||
|
|
||||||
def t_SORT_DIRECTION(self, t):
|
def t_SORT_DIRECTION(self, t):
|
||||||
|
@ -66,7 +65,6 @@ class ExtentedJsonPathParser(parser.JsonPathParser):
|
||||||
|
|
||||||
def p_expression(self, p):
|
def p_expression(self, p):
|
||||||
"""expression : jsonpath
|
"""expression : jsonpath
|
||||||
| jsonpath FILTER_OP FILTER_VALUE
|
|
||||||
| jsonpath FILTER_OP ID
|
| jsonpath FILTER_OP ID
|
||||||
| jsonpath FILTER_OP NUMBER
|
| jsonpath FILTER_OP NUMBER
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -61,6 +61,10 @@ class TestJsonpath_rw_ext(testscenarios.WithScenarios,
|
||||||
data={'objects': [{'cow': 'moo'},
|
data={'objects': [{'cow': 'moo'},
|
||||||
{'cat': 'neigh'}]},
|
{'cat': 'neigh'}]},
|
||||||
target=[{'cow': 'moo'}])),
|
target=[{'cow': 'moo'}])),
|
||||||
|
('filter_exists_syntax4', dict(string='objects[?(@."cow!?cat")]',
|
||||||
|
data={'objects': [{'cow!?cat': 'moo'},
|
||||||
|
{'cat': 'neigh'}]},
|
||||||
|
target=[{'cow!?cat': 'moo'}])),
|
||||||
('filter_eq1', dict(string='objects[?cow="moo"]',
|
('filter_eq1', dict(string='objects[?cow="moo"]',
|
||||||
data={'objects': [{'cow': 'moo'},
|
data={'objects': [{'cow': 'moo'},
|
||||||
{'cow': 'neigh'},
|
{'cow': 'neigh'},
|
||||||
|
|
Loading…
Reference in New Issue