summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Strukov <iley@iley.ru>2013-06-21 15:37:25 +0400
committerIlya Strukov <iley@iley.ru>2013-06-21 15:37:25 +0400
commit6a3063f3c183b623ef8bf4c7ba3d8b781d7ceca5 (patch)
treefe116656fc592a9126473bb6f84f030fec79bb2e
parent428f7408b300cc6277a161de1827a89347f598bc (diff)
downloadjsonpath-rw-6a3063f3c183b623ef8bf4c7ba3d8b781d7ceca5.tar.gz
lexer: fix a bug in error handling code
-rw-r--r--jsonpath_rw/lexer.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/jsonpath_rw/lexer.py b/jsonpath_rw/lexer.py
index 40ae898..e88baae 100644
--- a/jsonpath_rw/lexer.py
+++ b/jsonpath_rw/lexer.py
@@ -78,7 +78,7 @@ class JsonPathLexer(object):
return t
def t_singlequote_error(self, t):
- 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]))
+ 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]))
# Double-quoted strings
@@ -96,7 +96,7 @@ class JsonPathLexer(object):
return t
def t_doublequote_error(self, t):
- 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]))
+ 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]))
# Back-quoted "magic" operators
@@ -114,7 +114,7 @@ class JsonPathLexer(object):
return t
def t_backquote_error(self, t):
- 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]))
+ 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]))
# Counting lines, handling errors
@@ -124,7 +124,7 @@ class JsonPathLexer(object):
t.lexer.latest_newline = t.lexpos
def t_error(self, t):
- raise Exception('Error on line %s, col %s: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.latest_newline, t.value[0]))
+ raise Exception('Error on line %s, col %s: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.lexer.latest_newline, t.value[0]))
if __name__ == '__main__':
logging.basicConfig()