8000 Merge pull request #4 from iley/master · jeremydw/python-jsonpath-rw@5c41c53 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 5c41c53

Browse files
committed
Merge pull request kennknowles#4 from iley/master
Fix a bug in error handling functions in lexer.py
2 parents 428f740 + 6a3063f commit 5c41c53

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jsonpath_rw/lexer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def t_singlequote_SINGLEQUOTE(self, t):
7878
return t
7979

8080
def t_singlequote_error(self, t):
81-
raise Exception('Error on line %s, col %s while lexing singlequoted field: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.latest_newline, t.value[0]))
81+
raise Exception('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]))
8282

8383

8484
# Double-quoted strings
@@ -96,7 +96,7 @@ def t_doublequote_DOUBLEQUOTE(self, t):
9696
return t
9797

9898
def t_doublequote_error(self, t):
99-
raise Exception('Error on line %s, col %s while lexing doublequoted field: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.latest_newline, t.value[0]))
99+
raise Exception('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]))
100100

101101

102102
# Back-quoted "magic" operators
@@ -114,7 +114,7 @@ def t_backquote_BACKQUOTE(self, t):
114114
return t
115115

116116
def t_backquote_error(self, t):
117-
raise Exception('Error on line %s, col %s while lexing backquoted operator: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.latest_newline, t.value[0]))
117+
raise Exception('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]))
118118

119119

120120
# Counting lines, handling errors
@@ -124,7 +124,7 @@ def t_newline(self, t):
124124
t.lexer.latest_newline = t.lexpos
125125

126126
def t_error(self, t):
127-
raise Exception('Error on line %s, col %s: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.latest_newline, t.value[0]))
127+
raise Exception('Error on line %s, col %s: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.lexer.latest_newline, t.value[0]))
128128

129129
if __name__ == '__main__':
130130
logging.basicConfig()

0 commit comments

Comments
 (0)
0