/// <summary> /// Parses the python code and returns an ICompilationUnit. /// </summary> public ICompilationUnit Parse(IProjectContent projectContent, string fileName, string fileContent) { if (fileContent != null) { try { PythonAst ast = CreateAst(fileName, fileContent); PythonAstWalker walker = new PythonAstWalker(projectContent, fileName); walker.Walk(ast); return(walker.CompilationUnit); } catch (InvalidCastException) { // Ignore. } } DefaultCompilationUnit compilationUnit = new DefaultCompilationUnit(projectContent); compilationUnit.FileName = fileName; return(compilationUnit); }
/// <summary> /// Parses the python code and returns an ICompilationUnit. /// </summary> public ICompilationUnit Parse(IProjectContent projectContent, string fileName, string fileContent) { if (fileContent != null) { try { PythonAst ast = CreateAst(fileName, fileContent); PythonAstWalker walker = new PythonAstWalker(projectContent, fileName); walker.Walk(ast); return walker.CompilationUnit; } catch (InvalidCastException) { // Ignore. } } DefaultCompilationUnit compilationUnit = new DefaultCompilationUnit(projectContent); compilationUnit.FileName = fileName; return compilationUnit; }