Search in sources :

Example 1 with Editor

use of com.dat3m.ui.editor.Editor in project Dat3M by hernanponcedeleon.

the class Dat3M method runTest.

private void runTest() {
    UiOptions options = optionsPane.getOptions();
    testResult = null;
    try {
        Editor programEditor = editorsPane.getEditor(EditorCode.PROGRAM);
        Program program = new ProgramParser().parse(programEditor.getEditorPane().getText(), programEditor.getLoadedFormat());
        try {
            Wmm targetModel = new ParserCat().parse(editorsPane.getEditor(EditorCode.TARGET_MM).getEditorPane().getText());
            testResult = new ReachabilityResult(program, targetModel, options);
        } catch (Exception e) {
            String msg = e.getMessage() == null ? "Memory model cannot be parsed" : e.getMessage();
            showError(msg, "Target memory model error");
        }
    } catch (Exception e) {
        String msg = e.getMessage() == null ? "Program cannot be parsed" : e.getMessage();
        Throwable cause = e.getCause();
        if (cause instanceof InputMismatchException) {
            Token token = ((InputMismatchException) cause).getOffendingToken();
            msg = "Problem with \"" + token.getText() + "\" at line " + token.getLine();
        }
        showError(msg, "Program error");
    }
}
Also used : ReachabilityResult(com.dat3m.ui.result.ReachabilityResult) Program(com.dat3m.dartagnan.program.Program) ProgramParser(com.dat3m.dartagnan.parsers.program.ProgramParser) Wmm(com.dat3m.dartagnan.wmm.Wmm) UiOptions(com.dat3m.ui.utils.UiOptions) Token(org.antlr.v4.runtime.Token) ParserCat(com.dat3m.dartagnan.parsers.cat.ParserCat) Editor(com.dat3m.ui.editor.Editor) InputMismatchException(org.antlr.v4.runtime.InputMismatchException) InputMismatchException(org.antlr.v4.runtime.InputMismatchException)

Aggregations

ParserCat (com.dat3m.dartagnan.parsers.cat.ParserCat)1 ProgramParser (com.dat3m.dartagnan.parsers.program.ProgramParser)1 Program (com.dat3m.dartagnan.program.Program)1 Wmm (com.dat3m.dartagnan.wmm.Wmm)1 Editor (com.dat3m.ui.editor.Editor)1 ReachabilityResult (com.dat3m.ui.result.ReachabilityResult)1 UiOptions (com.dat3m.ui.utils.UiOptions)1 InputMismatchException (org.antlr.v4.runtime.InputMismatchException)1 Token (org.antlr.v4.runtime.Token)1