Remove useless FILTER_VALUE type

This commit is contained in:
Mehdi Abaakouk 2015-08-20 10:13:57 +02:00
parent 41157c6434
commit ece80769c5
2 changed files with 5 additions and 3 deletions

View File

@ -28,9 +28,8 @@ class ExtendedJsonPathLexer(lexer.JsonPathLexer):
"""Custom LALR-lexer for JsonPath"""
literals = lexer.JsonPathLexer.literals + ['?', '@']
tokens = (parser.JsonPathLexer.tokens +
['FILTER_OP', 'FILTER_VALUE', 'SORT_DIRECTION'])
['FILTER_OP', 'SORT_DIRECTION'])
t_FILTER_VALUE = r'\w+'
t_FILTER_OP = r'(==?|<=|>=|!=|<|>)'
def t_SORT_DIRECTION(self, t):
@ -66,7 +65,6 @@ class ExtentedJsonPathParser(parser.JsonPathParser):
def p_expression(self, p):
"""expression : jsonpath
| jsonpath FILTER_OP FILTER_VALUE
| jsonpath FILTER_OP ID
| jsonpath FILTER_OP NUMBER
"""

View File

@ -61,6 +61,10 @@ class TestJsonpath_rw_ext(testscenarios.WithScenarios,
data={'objects': [{'cow': 'moo'},
{'cat': 'neigh'}]},
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"]',
data={'objects': [{'cow': 'moo'},
{'cow': 'neigh'},