Slightly simplify HyREPL

This commit is contained in:
Kodi Arfer 2017-06-22 16:34:01 -07:00
parent 6db3da779e
commit 850ba03d1f

View File

@ -15,7 +15,7 @@ import astor.codegen
import hy import hy
from hy.lex import LexException, PrematureEndOfInput, tokenize from hy.lex import LexException, PrematureEndOfInput
from hy.lex.parser import hy_symbol_mangle from hy.lex.parser import hy_symbol_mangle
from hy.compiler import HyTypeError from hy.compiler import HyTypeError
from hy.importer import (hy_eval, import_buffer_to_module, from hy.importer import (hy_eval, import_buffer_to_module,
@ -77,12 +77,9 @@ class HyREPL(code.InteractiveConsole):
global SIMPLE_TRACEBACKS global SIMPLE_TRACEBACKS
try: try:
try: try:
tokens = tokenize(source) do = import_buffer_to_hst(source)
except PrematureEndOfInput: except PrematureEndOfInput:
return True return True
do = HyExpression([HySymbol('do')] + tokens)
do.start_line = do.end_line = do.start_column = do.end_column = 1
do.replace(do)
except LexException as e: except LexException as e:
if e.source is None: if e.source is None:
e.source = source e.source = source