hy/bin/hy2py
Konrad Hinsen 269da19d76 Make macros module-specific.
A macro is available in the module where it was defined and
in any module that does a require of the defining module.
Only macros defined in hy.core are globally available.
Fixes #181
2013-05-16 15:34:14 +02:00

26 lines
513 B
Python
Executable File

#!/usr/bin/env python
from __future__ import print_function
from hy.importer import (import_file_to_ast, import_file_to_module,
import_file_to_hst)
import astor.codegen
import sys
import ast
module_name = "<STDIN>"
hst = import_file_to_hst(sys.argv[1])
print(hst)
print("")
print("")
_ast = import_file_to_ast(sys.argv[1], module_name)
print("")
print("")
print(ast.dump(_ast))
print("")
print("")
print(astor.codegen.to_source(_ast))
import_file_to_module(module_name, sys.argv[1])