2013-03-06 00:16:04 +01:00
|
|
|
#!/usr/bin/env python
|
2013-04-09 21:23:50 +02:00
|
|
|
from __future__ import print_function
|
2013-03-06 00:16:04 +01:00
|
|
|
|
2013-03-09 00:18:43 +01:00
|
|
|
from hy.importer import (import_file_to_ast, import_file_to_module,
|
|
|
|
import_file_to_hst)
|
2013-04-10 22:52:28 +02:00
|
|
|
|
2013-04-28 02:52:37 +02:00
|
|
|
import astor.codegen
|
2013-03-06 00:16:04 +01:00
|
|
|
import sys
|
|
|
|
|
2013-05-16 15:34:14 +02:00
|
|
|
module_name = "<STDIN>"
|
2013-03-09 00:18:43 +01:00
|
|
|
|
|
|
|
hst = import_file_to_hst(sys.argv[1])
|
2014-01-02 04:10:31 +01:00
|
|
|
print(str(hst).encode("utf-8"))
|
2013-04-09 21:23:50 +02:00
|
|
|
print("")
|
|
|
|
print("")
|
2013-05-16 15:34:14 +02:00
|
|
|
_ast = import_file_to_ast(sys.argv[1], module_name)
|
2013-04-09 21:23:50 +02:00
|
|
|
print("")
|
|
|
|
print("")
|
2014-01-04 01:57:05 +01:00
|
|
|
print(astor.dump(_ast).encode("utf-8"))
|
2013-04-09 21:23:50 +02:00
|
|
|
print("")
|
|
|
|
print("")
|
2014-01-02 04:10:31 +01:00
|
|
|
print(astor.codegen.to_source(_ast).encode("utf-8"))
|
2013-03-09 05:41:04 +01:00
|
|
|
|
2013-05-16 15:34:14 +02:00
|
|
|
import_file_to_module(module_name, sys.argv[1])
|