You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jsonpath_rw/lexer.py
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,9 @@
6
6
7
7
logger=logging.getLogger(__name__)
8
8
9
+
classJsonPathLexerError(Exception):
10
+
pass
11
+
9
12
classJsonPathLexer(object):
10
13
'''
11
14
A Lexical analyzer for JsonPath.
@@ -14,7 +17,7 @@ class JsonPathLexer(object):
14
17
def__init__(self, debug=False):
15
18
self.debug=debug
16
19
ifself.__doc__==None:
17
-
raiseException('Docstrings have been removed! By design of PLY, jsonpath-rw requires docstrings. You must not use PYTHONOPTIMIZE=2 or python -OO.')
20
+
raiseJsonPathLexerError('Docstrings have been removed! By design of PLY, jsonpath-rw requires docstrings. You must not use PYTHONOPTIMIZE=2 or python -OO.')
raiseException('Error on line %s, col %s while lexing singlequoted field: Unexpected character: %s '% (t.lexer.lineno, t.lexpos-t.lexer.latest_newline, t.value[0]))
84
+
raiseJsonPathLexerError('Error on line %s, col %s while lexing singlequoted field: Unexpected character: %s '% (t.lexer.lineno, t.lexpos-t.lexer.latest_newline, t.value[0]))
raiseException('Error on line %s, col %s while lexing doublequoted field: Unexpected character: %s '% (t.lexer.lineno, t.lexpos-t.lexer.latest_newline, t.value[0]))
102
+
raiseJsonPathLexerError('Error on line %s, col %s while lexing doublequoted field: Unexpected character: %s '% (t.lexer.lineno, t.lexpos-t.lexer.latest_newline, t.value[0]))
raiseException('Error on line %s, col %s while lexing backquoted operator: Unexpected character: %s '% (t.lexer.lineno, t.lexpos-t.lexer.latest_newline, t.value[0]))
120
+
raiseJsonPathLexerError('Error on line %s, col %s while lexing backquoted operator: Unexpected character: %s '% (t.lexer.lineno, t.lexpos-t.lexer.latest_newline, t.value[0]))
118
121
119
122
120
123
# Counting lines, handling errors
@@ -124,7 +127,7 @@ def t_newline(self, t):
124
127
t.lexer.latest_newline=t.lexpos
125
128
126
129
deft_error(self, t):
127
-
raiseException('Error on line %s, col %s: Unexpected character: %s '% (t.lexer.lineno, t.lexpos-t.lexer.latest_newline, t.value[0]))
130
+
raiseJsonPathLexerError('Error on line %s, col %s: Unexpected character: %s '% (t.lexer.lineno, t.lexpos-t.lexer.latest_newline, t.value[0]))
0 commit comments