Explicitly set missing source on LexExceptions

This fixes the following code:

    (import [hy.lex [tokenize]])
    (tokenize "(foo))")
This commit is contained in:
Gregor Best 2015-07-28 16:46:26 +02:00
parent d95bfbaa8e
commit 0ba620fc73

View File

@ -35,3 +35,7 @@ def tokenize(buf):
pos = e.getsourcepos()
raise LexException("Could not identify the next token.",
pos.lineno, pos.colno)
except LexException as e:
if e.source is None:
e.source = buf
raise