Search in sources :

Example 11 with FinalResult

use of ast.ErrorMessage.FinalResult in project L42 by ElvisResearchGroup.

the class TestL42SuperSlow method test17.

@Test
public void test17() throws IOException {
    String s = TestHelper.multiLine("", "{reuse L42.is/microBase", "NList:Collections.list(N)", "Util:{()", "  class method N max(NList that){", "    if that.isEmpty() (error S\"Empty lists have no max\")", "    var N candidate=that.top()", "    with ei in that.vals() (", "      if ei>candidate (candidate:=ei)", "      )", "    return candidate", "    }", "  }", "C:{", "  list=NList[2N;0N;2N;0N;1N;3N;2N;0N;2N;0N;2N;0N;2N;0N;]", "  if Util.max(list)==3N (return ExitCode.normal())", "  return ExitCode.failure()", "  }", "}");
    try {
        FinalResult res = L42.runSlow(null, s);
        System.out.println(L42.record.toString());
        if (res.getResult() != 0) {
            System.out.println(res);
            TestHelper.reportError(null);
        }
    } catch (ErrorMessage msg) {
        System.out.println(L42.record.toString());
        msg.printStackTrace();
        TestHelper.reportError(msg);
    }
}
Also used : FinalResult(ast.ErrorMessage.FinalResult) ErrorMessage(ast.ErrorMessage) Test(org.junit.Test)

Example 12 with FinalResult

use of ast.ErrorMessage.FinalResult in project L42 by ElvisResearchGroup.

the class BuildLibs method main.

public static void main(String[] arg) throws IOException {
    L42.setRootPath(Paths.get("dummy"));
    TestHelper.configureForTest();
    try {
        FinalResult res = L42.runSlow(null, TestHelper.multiLine("", //,"{reuse L42.is/nanoBase1"
        "{reuse L42.is/deployMini", "Main:{", //,"    )"
        "  Deploy(", "    fileName:S\"localhost/miniBase.L42\",", "    code:{reuse L42.is/tinyBase1},", //,"    code:{reuse L42.is/nanoBase1},"
        "    node:S\"This0\")", "  return ExitCode.normal()", "  }", "}"));
        System.out.println("------------------------------");
        System.out.println("END: " + res.getErrCode());
    } catch (ErrorMessage msg) {
        //System.out.println(L42.record.toString());
        msg.printStackTrace();
        //Executor.reportError(msg);
        System.out.println(ErrorFormatter.formatError(Program.empty(), msg).getErrorTxt());
    }
}
Also used : FinalResult(ast.ErrorMessage.FinalResult) ErrorMessage(ast.ErrorMessage)

Aggregations

ErrorMessage (ast.ErrorMessage)12 FinalResult (ast.ErrorMessage.FinalResult)12 Test (org.junit.Test)5 Path (java.nio.file.Path)2 ExpCore (ast.ExpCore)1 ClassB (ast.ExpCore.ClassB)1 ParseCancellationException (org.antlr.v4.runtime.misc.ParseCancellationException)1 InjectionOnCore (sugarVisitors.InjectionOnCore)1