Search in sources :

Example 6 with SemanticCondition

use of abs.frontend.analyser.SemanticCondition in project abstools by abstools.

the class FrontendTest method assertTypeErrors.

protected void assertTypeErrors(String absCode, ErrorMessage expected) {
    SemanticCondition e = assertTypeErrors(absCode, EXPECT_TYPE_ERROR, WITH_STD_LIB);
    assertEquals(expected, e.msg);
}
Also used : SemanticCondition(abs.frontend.analyser.SemanticCondition)

Example 7 with SemanticCondition

use of abs.frontend.analyser.SemanticCondition in project abstools by abstools.

the class FrontendTest method assertWarnings.

protected void assertWarnings(String absCode, ErrorMessage expected) {
    SemanticCondition e = assertTypeErrors(absCode, EXPECT_WARNING, WITH_STD_LIB);
    assertEquals(expected, e.msg);
}
Also used : SemanticCondition(abs.frontend.analyser.SemanticCondition)

Example 8 with SemanticCondition

use of abs.frontend.analyser.SemanticCondition 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());
    }
}
Also used : SemanticConditionList(abs.frontend.analyser.SemanticConditionList) SemanticCondition(abs.frontend.analyser.SemanticCondition) Model(abs.frontend.ast.Model) FileNotFoundException(java.io.FileNotFoundException)

Example 9 with SemanticCondition

use of abs.frontend.analyser.SemanticCondition in project abstools by abstools.

the class TypeCheckerException method getMessage.

private static String getMessage(SemanticConditionList typeErrors) {
    StringBuffer result = new StringBuffer("Project contains parse errors: ");
    for (SemanticCondition error : typeErrors) {
        // TODO: newline doesn't work ):
        result.append('\n');
        result.append(error.getFileName());
        result.append(':');
        result.append(error.getLine());
        result.append(':');
        result.append(error.getColumn());
        result.append(' ');
        result.append(error.getMessage());
    }
    return result.toString();
}
Also used : SemanticCondition(abs.frontend.analyser.SemanticCondition)

Example 10 with SemanticCondition

use of abs.frontend.analyser.SemanticCondition 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());
    }
}
Also used : SemanticConditionList(abs.frontend.analyser.SemanticConditionList) SemanticCondition(abs.frontend.analyser.SemanticCondition) Constraint(choco.kernel.model.constraints.Constraint)

Aggregations

SemanticCondition (abs.frontend.analyser.SemanticCondition)11 SemanticConditionList (abs.frontend.analyser.SemanticConditionList)7 Model (abs.frontend.ast.Model)3 CompilationUnit (abs.frontend.ast.CompilationUnit)1 Main (abs.frontend.parser.Main)1 ParserError (abs.frontend.parser.ParserError)1 Constraint (choco.kernel.model.constraints.Constraint)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 PrintStream (java.io.PrintStream)1 Test (org.junit.Test)1