Skip to content

Commit

Permalink
Better error for literal with bad escaping (Issue #287)
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh committed Aug 28, 2019
1 parent 5697820 commit f06a83a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lark/load_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ def _fix_escaping(s):
for n in i:
w += n
if n == '\\':
n2 = next(i)
try:
n2 = next(i)
except StopIteration:
raise ValueError("Literal ended unexpectedly (bad escaping): `%r`" % s)
if n2 == '\\':
w += '\\\\'
elif n2 not in 'uxnftr':
Expand Down

2 comments on commit f06a83a

@bilderbuchi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erezsh just a heads up, this is tagged 0.7.4, but lark.__version__ is still defined as 0.7.3

@erezsh
Copy link
Member Author

@erezsh erezsh commented on f06a83a Sep 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I missed it. Thanks!

Please sign in to comment.