Search in sources :

Example 16 with ErrorMessage

use of ast.ErrorMessage 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 17 with ErrorMessage

use of ast.ErrorMessage 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)17 FinalResult (ast.ErrorMessage.FinalResult)12 Test (org.junit.Test)5 ExpCore (ast.ExpCore)4 Position (ast.Ast.Position)3 ClassB (ast.ExpCore.ClassB)3 ArrayList (java.util.ArrayList)3 ParseCancellationException (org.antlr.v4.runtime.misc.ParseCancellationException)3 InjectionOnCore (sugarVisitors.InjectionOnCore)3 Expression (ast.Expression)2 ClassB (ast.Expression.ClassB)2 ClassReuse (ast.Expression.ClassReuse)2 CloneVisitor (coreVisitors.CloneVisitor)2 Path (java.nio.file.Path)2 Ast (ast.Ast)1 Path (ast.Ast.Path)1 Kind (ast.ErrorMessage.UserLevelError.Kind)1 Member (ast.ExpCore.ClassB.Member)1 NestedClass (ast.ExpCore.ClassB.NestedClass)1