8000 Fix a bug in error handling functions in lexer.py by iley · Pull Request #4 · kennknowles/python-jsonpath-rw · GitHub
[go: up one dir, main page]

Skip to content

Fix a bug in error handling functions in lexer.py #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
8 changes: 4 additions & 4 deletions jsonpath_rw/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def t_singlequote_SINGLEQUOTE(self, t):
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
Expand All @@ -96,7 +96,7 @@ def t_doublequote_DOUBLEQUOTE(self, t):
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
Expand All @@ -114,7 +114,7 @@ def t_backquote_BACKQUOTE(self, t):
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
Expand All @@ -124,7 +124,7 @@ def t_newline(self, t):
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()
Expand Down
0