use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ABSUnitTestCaseTranslator method validateOutput.
private void validateOutput(Model model, String product) {
Model copy = model.treeCopyNoTransform();
if (product != null) {
try {
copy.flattenForProduct(product);
} catch (Exception e) {
throw new IllegalStateException("Cannot select product " + product, e);
}
}
SemanticConditionList typeerrors = copy.typeCheck();
for (SemanticCondition se : typeerrors) {
System.err.println(se.getHelpMessage());
}
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ModuleDecorator method hasModuleDeclErrors.
/**
* Determines if a module declaration has any errors
*
* @param m
* the module declaration
* @param nature
* the ABS nature
* @return TRUE if the module declaration has errors, FALSE if not or m or
* nature is null
*/
public boolean hasModuleDeclErrors(ModuleDecl m, AbsNature nature) {
synchronized (nature.modelLock) {
if (m != null) {
CompilationUnit cu = m.getCompilationUnit();
EditorPosition pos = UtilityFunctions.getPosition(m);
int startLine = pos.getLinestart();
int endLine = pos.getLineend();
List<ParserError> parserErrors = cu.getParserErrors();
SemanticConditionList list = cu.getModel().getTypeErrors();
if (checkParserErrorRange(startLine, endLine, parserErrors)) {
return true;
} else {
return checkSemanticErrorRange(list, cu, startLine, endLine, nature);
}
}
return false;
}
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class AbsNature method typeCheckModel.
/**
* takes the properties from the project preference store for location type checking and location type precision. Typeckecks
* the current model in the current model builder.
* Note that your model must be sufficiently "complete" and not have any semantic errors .
* @param monitor
* @throws CoreException {@link IResource#deleteMarkers(String, boolean, int)} does not handle exceptions thrown by
* #createMarker(SemanticError) and #createMarker(TypecheckInternalException)
*/
void typeCheckModel(IProgressMonitor monitor) throws CoreException {
getProject().deleteMarkers(TYPECHECK_MARKER_TYPE, true, IResource.DEPTH_INFINITE);
getProject().deleteMarkers(LOCATION_TYPE_INFERENCE_MARKER_TYPE, true, IResource.DEPTH_INFINITE);
boolean dolocationtypecheck = getProjectPreferenceStore().getBoolean(LOCATION_TYPECHECK);
String defaultlocationtype = getProjectPreferenceStore().getString(DEFAULT_LOCATION_TYPE);
String defaultlocationtypeprecision = getProjectPreferenceStore().getString(LOCATION_TYPE_PRECISION);
boolean checkProducts = getProjectPreferenceStore().getBoolean(PRODUCT_TYPECHECK);
try {
addPackagesForTypeChecking();
final SemanticConditionList typeerrors = modelbuilder.typeCheckModel(monitor, dolocationtypecheck, defaultlocationtype, defaultlocationtypeprecision, checkProducts);
createMarkers(typeerrors);
if (dolocationtypecheck) {
createLocationTypeInferenceMarker();
}
} catch (NoModelException e) {
// ignore
return;
} catch (TypecheckInternalException e) {
/* Internal error caught. Log, and turn into an error marker */
Activator.logException(e);
createMarker(e);
return;
}
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class AbsModelManagerImpl method extendedTypechecking.
private void extendedTypechecking() {
if (absNature.getProject() != null) {
IPersistentPreferenceStore projectPreferences = absNature.getProjectPreferenceStore();
IncrementalModelBuilder.flushAll(model);
model.getTypeExt().clearTypeSystemExtensions();
boolean dolocationtypecheck = projectPreferences.getBoolean(LOCATION_TYPECHECK);
if (dolocationtypecheck) {
String defaultlocationtypeprecision = projectPreferences.getString(LOCATION_TYPE_PRECISION);
LocationType defaultLocType = LocationType.createFromName(projectPreferences.getString(DEFAULT_LOCATION_TYPE));
LocationTypeInferrerExtension ltie = new LocationTypeInferrerExtension(model);
ltie.setDefaultType(defaultLocType);
ltie.setLocationTypingPrecision(LocationTypingPrecision.valueOf(defaultlocationtypeprecision));
model.registerTypeSystemExtension(ltie);
}
}
SemanticConditionList typeErrors = model.typeCheck();
updateMarkers(typeErrors);
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class Main method typeCheckProductLine.
private void typeCheckProductLine(Model m) {
// int n = m.getFeatureModelConfigurations().size();
int n = m.getProductList().getNumChild();
if (n == 0)
return;
if (verbose) {
System.out.println("Typechecking Software Product Line (" + n + " products)...");
}
SemanticConditionList errors = m.typeCheckPL();
for (SemanticCondition err : errors) {
System.err.println(err.getHelpMessage());
}
}
Aggregations