Skip to content

Commit c75fd6b

Browse files
author
whitequark
committedMay 27, 2015
Replace builtin ast with pythonparser.ast.
1 parent f30d671 commit c75fd6b

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed
 

‎artiq/py2llvm/ast_body.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ast
1+
from pythonparser import ast
22

33
import llvmlite.ir as ll
44

‎artiq/py2llvm/fractions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import inspect
2-
import ast
2+
from pythonparser import parse, ast
33

44
import llvmlite.ir as ll
55

@@ -18,7 +18,7 @@ def _gcd(a, b):
1818

1919

2020
def init_module(module):
21-
func_def = ast.parse(inspect.getsource(_gcd)).body[0]
21+
func_def = parse(inspect.getsource(_gcd)).body[0]
2222
function, _ = module.compile_function(func_def,
2323
{"a": VInt(64), "b": VInt(64)})
2424
function.linkage = "internal"

‎artiq/py2llvm/infer_types.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import ast
1+
import pythonparser.algorithm
2+
from pythonparser import ast
23
from copy import deepcopy
34

45
from artiq.py2llvm.ast_body import Visitor
56
from artiq.py2llvm import base_types
67

78

8-
class _TypeScanner(ast.NodeVisitor):
9+
class _TypeScanner(pythonparser.algorithm.Visitor):
910
def __init__(self, env, ns):
1011
self.exprv = Visitor(env, ns)
1112

‎artiq/test/py2llvm.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
import ast
2+
from pythonparser import parse, ast
33
import inspect
44
from fractions import Fraction
55
from ctypes import CFUNCTYPE, c_int, c_int32, c_int64, c_double
@@ -43,7 +43,7 @@ def _base_types(choice):
4343

4444
def _build_function_types(f):
4545
return infer_function_types(
46-
None, ast.parse(inspect.getsource(f)),
46+
None, parse(inspect.getsource(f)),
4747
dict())
4848

4949

@@ -111,7 +111,7 @@ class CompiledFunction:
111111
def __init__(self, function, param_types):
112112
module = Module()
113113

114-
func_def = ast.parse(inspect.getsource(function)).body[0]
114+
func_def = parse(inspect.getsource(function)).body[0]
115115
function, retval = module.compile_function(func_def, param_types)
116116
argvals = [param_types[arg.arg] for arg in func_def.args.args]
117117

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
requirements = [
77
"sphinx", "sphinx-argparse", "pyserial", "numpy", "scipy",
88
"python-dateutil", "prettytable", "h5py", "pydaqmx", "pyelftools",
9-
"quamash", "pyqtgraph"
9+
"quamash", "pyqtgraph", "pythonparser"
1010
]
1111

1212
scripts = [

0 commit comments

Comments
 (0)
Please sign in to comment.