示例#1
0
 def parse (self, source):
     t= self.parser.parse_source (source, self.info)
     ast1= ast_from_node (None, t, self.info)
     ast2= ast.parse (source)
     self.assertTrue (self.equal (ast1, ast2),
                      "\n%s != \n%s" % (ast.dump (ast1), ast.dump (ast2)))
示例#2
0
def parse(script, file_name=''):
    parser = PythonParser(None)
    info = CompileInfo(file_name, 'exec')
    return ast_from_node(None, parser.parse_source(script, info), info)
示例#3
0
def parse (script, file_name=''):
    parser= PythonParser (None)
    info= CompileInfo (file_name, 'exec')
    return ast_from_node (None, parser.parse_source (script, info), info)
示例#4
0
 def parse(self, source):
     t = self.parser.parse_source(source, self.info)
     ast1 = ast_from_node(None, t, self.info)
     ast2 = ast.parse(source)
     self.assertTrue(self.equal(ast1, ast2),
                     "\n%s != \n%s" % (ast.dump(ast1), ast.dump(ast2)))