use of org.eclipse.titan.designer.parsers.ttcn3parser.Ttcn3FileReparser in project titan.EclipsePlug-ins by eclipse.
the class ProjectSourceSyntacticAnalyzer method updateSyntax.
/**
* The entry point of incremental parsing.
* <p>
* Handles the data storages, calls the module level incremental parser
* on the file, and if everything fails does a full parsing to correct
* possibly invalid states.
*
* @param file
* the edited file
* @param reparser
* the parser doing the incremental parsing.
*/
public void updateSyntax(final IFile file, final TTCN3ReparseUpdater reparser) {
if (uptodateFiles.containsKey(file)) {
Module module = sourceParser.getSemanticAnalyzer().getModulebyFile(file);
sourceParser.getSemanticAnalyzer().reportSemanticOutdating(file);
if (module != null && module_type.TTCN3_MODULE.equals(module.getModuletype())) {
try {
reparser.setUnsupportedConstructs(unsupportedConstructMap);
try {
((TTCN3Module) module).updateSyntax(reparser, sourceParser);
reparser.updateLocation(((TTCN3Module) module).getLocation());
} catch (ReParseException e) {
syntacticallyOutdated = true;
uptodateFiles.remove(file);
sourceParser.getSemanticAnalyzer().reportSemanticOutdating(file);
String oldModuleName = fileMap.get(file);
if (oldModuleName != null) {
sourceParser.getSemanticAnalyzer().removeModule(oldModuleName);
fileMap.remove(file);
}
unsupportedConstructMap.remove(file);
reparser.maxDamage();
ITtcn3FileReparser r = new Ttcn3FileReparser(reparser, file, sourceParser, fileMap, uptodateFiles, highlySyntaxErroneousFiles);
syntacticallyOutdated = r.parse();
}
MarkerHandler.removeAllOnTheFlySyntacticMarkedMarkers(file);
// update the position of the markers located after the damaged region
MarkerHandler.updateMarkers(file, reparser.getFirstLine(), reparser.getLineShift(), reparser.getDamageEnd(), reparser.getShift());
} catch (Exception e) {
// This catch is extremely important, as
// it is supposed to protect the project
// parser, from whatever might go wrong
// inside the analysis.
ErrorReporter.logExceptionStackTrace(e);
}
} else {
reportOutdating(file);
}
} else if (highlySyntaxErroneousFiles.contains(file)) {
reportOutdating(file);
} else {
MarkerHandler.markAllMarkersForRemoval(file);
TemporalParseData temp = fileBasedTTCN3Analysis(file);
postFileBasedGeneralAnalysis(temp);
}
reparser.reportSyntaxErrors();
}
Aggregations