Do the macro processing in the compiler
This commit is contained in:
parent
3d8a3d589c
commit
e9f7c47663
@ -35,6 +35,8 @@ from hy.models.float import HyFloat
|
|||||||
from hy.models.list import HyList
|
from hy.models.list import HyList
|
||||||
from hy.models.dict import HyDict
|
from hy.models.dict import HyDict
|
||||||
|
|
||||||
|
from hy.core import process
|
||||||
|
|
||||||
from hy.util import str_type
|
from hy.util import str_type
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
@ -361,6 +363,7 @@ class HyASTCompiler(object):
|
|||||||
|
|
||||||
def compile_atom(self, atom_type, atom):
|
def compile_atom(self, atom_type, atom):
|
||||||
if atom_type in _compile_table:
|
if atom_type in _compile_table:
|
||||||
|
atom = process(atom)
|
||||||
ret = _compile_table[atom_type](self, atom)
|
ret = _compile_table[atom_type](self, atom)
|
||||||
if not isinstance(ret, Result):
|
if not isinstance(ret, Result):
|
||||||
ret = Result() + ret
|
ret = Result() + ret
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
from py_compile import wr_long, MAGIC
|
from py_compile import wr_long, MAGIC
|
||||||
from hy.compiler import hy_compile
|
from hy.compiler import hy_compile
|
||||||
from hy.models import HyObject
|
from hy.models import HyObject
|
||||||
from hy.core import process
|
|
||||||
from hy.lex import tokenize
|
from hy.lex import tokenize
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +47,7 @@ def ast_compile(ast, filename, mode):
|
|||||||
|
|
||||||
def import_buffer_to_hst(buf):
|
def import_buffer_to_hst(buf):
|
||||||
"""Import content from buf and return an Hy AST."""
|
"""Import content from buf and return an Hy AST."""
|
||||||
return process(tokenize(buf + "\n"))
|
return tokenize(buf + "\n")
|
||||||
|
|
||||||
|
|
||||||
def import_file_to_hst(fpath):
|
def import_file_to_hst(fpath):
|
||||||
|
Loading…
Reference in New Issue
Block a user