コード例 #1
0
ファイル: pyparser.py プロジェクト: sota/pypy-old
 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))
コード例 #2
0
ファイル: pycompiler.py プロジェクト: Qointum/pypy
 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))
コード例 #3
0
ファイル: pycompiler.py プロジェクト: mozillazg/pypy
 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
コード例 #4
0
 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
コード例 #5
0
ファイル: pyparser.py プロジェクト: Darriall/pypy
 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))
コード例 #6
0
ファイル: pycompiler.py プロジェクト: xx312022850/pypy
 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))
コード例 #7
0
ファイル: pycompiler.py プロジェクト: alkorzt/pypy
 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))
コード例 #8
0
 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
コード例 #9
0
 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
コード例 #10
0
ファイル: test_compiler.py プロジェクト: charred/pypy
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)
コード例 #11
0
ファイル: test_compiler.py プロジェクト: stjordanis/pypy
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)
コード例 #12
0
ファイル: pyparser.py プロジェクト: alkorzt/pypy
 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))
コード例 #13
0
ファイル: pyparser.py プロジェクト: xx312022850/pypy
 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))