use of org.python.pydev.parser.grammar_cython.PyParserCython in project Pydev by fabioz.
the class PyParser method createCythonAst.
public static ParseOutput createCythonAst(ParserInfo info) {
ParseOutput parseOutput = null;
if (USE_NEW_CYTHON_PARSER) {
PyParserCython parserCython = new PyParserCython(info);
try {
parseOutput = parserCython.parse();
parseOutput.isCython = true;
} catch (Exception e) {
// If cython is not available, an error is expected.
Log.log(e);
}
}
if (parseOutput == null || parseOutput.ast == null) {
// If we couldn't parse with cython, try to give something even if not really complete.
List<stmtType> classesAndFunctions = FastParser.parseCython(info.document);
Module ast = new Module(classesAndFunctions.toArray(new stmtType[classesAndFunctions.size()]));
parseOutput = new ParseOutput(ast, parseOutput != null ? parseOutput.error : null, ((IDocumentExtension4) info.document).getModificationStamp());
parseOutput.isCython = true;
}
return parseOutput;
}
Aggregations