def descr_compile(self, space, filename="<syntax-tree>"): info = pyparse.CompileInfo(filename, self.mode) try: ast = ast_from_node(space, self.tree, info) result = compile_ast(space, ast, info) except error.IndentationError, e: raise OperationError(space.w_IndentationError, e.wrap_info(space))
def _compile_ast(self, node, info): space = self.space try: mod = optimize.optimize_ast(space, node, info) code = codegen.compile_ast(space, mod, info) except parseerror.SyntaxError, e: raise OperationError(space.w_SyntaxError, e.wrap_info(space))
def _compile_ast(self, node, info): space = self.space try: mod = optimize.optimize_ast(space, node, info) code = codegen.compile_ast(space, mod, info) except parseerror.SyntaxError as e: raise OperationError(space.w_SyntaxError, e.wrap_info(space)) return code
def _compile_ast(self, node, info, source=None): space = self.space try: mod = optimize.optimize_ast(space, node, info) code = codegen.compile_ast(space, mod, info) except parseerror.SyntaxError as e: raise OperationError(space.w_SyntaxError, e.find_sourceline_and_wrap_info(space, source)) return code
def descr_compile(self, space, filename="<syntax-tree>"): info = pyparse.CompileInfo(filename, self.mode) try: ast = ast_from_node(space, self.tree, info) result = compile_ast(space, ast, info) except error.IndentationError, e: raise OperationError(space.w_IndentationError, e.wrap_info(space))
def _compile_ast(self, node, info): from pypy.interpreter.astcompiler import optimize from pypy.interpreter.astcompiler.codegen import compile_ast from pypy.interpreter.pyparser.error import SyntaxError space = self.space try: mod = optimize.optimize_ast(space, node, info) code = compile_ast(space, mod, info) except SyntaxError, e: raise OperationError(space.w_SyntaxError, e.wrap_info(space))
def _compile_ast(self, node, info): from pypy.interpreter.astcompiler import optimize from pypy.interpreter.astcompiler.codegen import compile_ast from pypy.interpreter.pyparser.error import SyntaxError space = self.space try: mod = optimize.optimize_ast(space, node, info) code = compile_ast(space, mod, info) except SyntaxError, e: raise OperationError(space.w_SyntaxError, e.wrap_info(space))
def descr_compile(self, space, filename="<syntax-tree>"): info = pyparse.CompileInfo(filename, self.mode) try: ast = ast_from_node(space, self.tree, info, self.recursive_parser) result = compile_ast(space, ast, info) except error.IndentationError as e: raise OperationError(space.w_IndentationError, e.find_sourceline_and_wrap_info(space)) except error.SyntaxError as e: raise OperationError(space.w_SyntaxError, e.find_sourceline_and_wrap_info(space)) return result
def _compile_ast(self, node, info, source=None): from pypy.interpreter.astcompiler.unparse import unparse_annotations space = self.space if info.flags & consts.CO_FUTURE_ANNOTATIONS: node = unparse_annotations(space, node) try: mod = optimize.optimize_ast(space, node, info) code = codegen.compile_ast(space, mod, info) except parseerror.SyntaxError as e: raise OperationError( space.w_SyntaxError, e.find_sourceline_and_wrap_info(space, source)) return code
def compile_with_astcompiler(expr, mode, space): p = pyparse.PythonParser(space) info = pyparse.CompileInfo("<test>", mode) cst = p.parse_source(expr, info) ast = astbuilder.ast_from_node(space, cst, info) return codegen.compile_ast(space, ast, info)
def compile_with_astcompiler(expr, mode, space): p = pyparse.PythonParser(space) info = pyparse.CompileInfo("<test>", mode) cst = p.parse_source(expr, info) ast = astbuilder.ast_from_node(space, cst, info) return codegen.compile_ast(space, ast, info)
def descr_compile(self, space, filename="<syntax-tree>"): info = pyparse.CompileInfo(filename, self.mode) ast = ast_from_node(space, self.tree, info) return space.wrap(compile_ast(space, ast, info))
def descr_compile(self, space, filename="<syntax-tree>"): info = pyparse.CompileInfo(filename, self.mode) ast = ast_from_node(space, self.tree, info) return space.wrap(compile_ast(space, ast, info))