if (predefinedModule != null && predefinedModule.exists()) {
keyForCacheAccess.name = name;
keyForCacheAccess.file = predefinedModule;
n = cache.getObj(keyForCacheAccess, this);
if ((n instanceof PredefinedSourceModule)) {
PredefinedSourceModule predefinedSourceModule = (PredefinedSourceModule) n;
if (predefinedSourceModule.isSynched()) {
return n;
}
//otherwise (not PredefinedSourceModule or not synched), just keep going to create
//it as a predefined source module
}
boolean tryToParse = true;
Long lastModified = null;
if (predefinedFilesNotParsedToTimestamp == null) {
predefinedFilesNotParsedToTimestamp = new HashMap<File, Long>();
} else {
Long lastTimeChanged = predefinedFilesNotParsedToTimestamp.get(predefinedModule);
if (lastTimeChanged != null) {
lastModified = predefinedModule.lastModified();
if (lastTimeChanged.equals(lastModified)) {
tryToParse = false;
} else {
predefinedFilesNotParsedToTimestamp.remove(predefinedModule);
}
}
}
if (tryToParse) {
IDocument doc;
try {
doc = FileUtilsFileBuffer.getDocFromFile(predefinedModule);
IGrammarVersionProvider provider = new IGrammarVersionProvider() {
public int getGrammarVersion() throws MisconfigurationException {
return IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_3_0; // Always Python 3.0 here
}
};
Tuple<SimpleNode, Throwable> obj = PyParser.reparseDocument(new PyParser.ParserInfo(doc, provider,
name, predefinedModule));
if (obj.o2 != null) {
if (lastModified == null) {
lastModified = predefinedModule.lastModified();
}
predefinedFilesNotParsedToTimestamp.put(predefinedModule, lastModified);
Log.log("Unable to parse: " + predefinedModule, obj.o2);
} else if (obj.o1 != null) {
n = new PredefinedSourceModule(name, predefinedModule, obj.o1, obj.o2);
doAddSingleModule(keyForCacheAccess, n);
return n;
}
//keep on going
} catch (Throwable e) {