use of ast.ErrorMessage in project L42 by ElvisResearchGroup.
the class ErrorFormatter method reportPlaceOfMetaError.
private static String reportPlaceOfMetaError(Program p, ErrorMessage msg) {
ErrorMessage.MalformedFinalResult _msg = (ErrorMessage.MalformedFinalResult) msg;
ClassB cb = _msg.getFinalRes();
//String path=_msg.getReason();
String path = reportPlaceOfMetaError(p, cb);
return path + "\n-----\n" + _msg.getReason();
}
use of ast.ErrorMessage in project L42 by ElvisResearchGroup.
the class TestL42SuperSlow method test16.
@Test
public void test16() 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[3N;]", " 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);
}
}
use of ast.ErrorMessage in project L42 by ElvisResearchGroup.
the class TestL42SuperSlow method test14.
@Test
public void test14() throws IOException {
String s = TestHelper.multiLine("", "{reuse L42.is/microBase", "SList:Collections.list(S)", "C:{", //
" l1=SList[S\"a\";S\"b\";]", " l2=SList[S\"c\";]", " with" + //
" s1 in l1.valsCut()" + " s2 in l2.valsCut() (", //
" use Alu check stringDebug(s1.that()) void", " use Alu check stringDebug(s2.that()) void", " )", " return ExitCode.normal()", " }", "}");
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);
}
}
use of ast.ErrorMessage in project L42 by ElvisResearchGroup.
the class TestL42SuperSlow method test18.
@Test
public void test18() throws IOException {
String s = TestHelper.multiLine("", "{reuse L42.is/microBase", "SList:Collections.list(S)", "Util:{()", " class method S max(SList that){", " if that.isEmpty() (error S\"Empty lists have no max\")", " var S candidate=S\"\"", " with ei in that.vals() (", " if ei.size()>candidate.size() (candidate:=ei)", " )", " return candidate", " }", " }", "C:{", " list=SList[S\"a\";S\"bb\";S\"ccc\";S\"dd\";]", " if Util.max(list)!=S\"ccc\" (return ExitCode.failure())", " top=S\"ccc\"(0N)", " if top!=S\"c\" (return ExitCode.failure())", " return ExitCode.normal()", " }", "}");
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);
}
}
use of ast.ErrorMessage in project L42 by ElvisResearchGroup.
the class DeploySimpleLib method testLibCreationGui.
public static void testLibCreationGui() {
try {
FinalResult res = L42.runSlow(null, TestHelper.multiLine("", " {reuse L42.is/deployMini", " Main:Deploy[S\"Top::Exported\", fileName:S\"localhost/GuiLib.L42\"]<{reuse L42.is/templateBNS", " Top:This0::Generalize[]<{reuse L42.is/miniBase", " Exported:{(S id)", "", " GuiPlugin:{'@plugin", " 'L42.is/connected/withHtml", " }", " ", " class method", " S jsEscape(S that) (", " tmp=that.replace(S.doubleQuote(),into:S\"\\\"++S.doubleQuote())", " tmp.replace(S\"\'\",into:S\"\\\'\")", " )", " method", " Void close()", " use GuiPlugin", " check close(wName:this.id().binaryRepr())", " error void", " ", " method", " Void open(S html, N x, N y)", " use GuiPlugin", " check open(", " wName:this.id().binaryRepr()", " html:html.binaryRepr()", " x:x.binaryRepr()", " y:y.binaryRepr()", " )", " error void", " ", " method", " Void set(S that,S id) {", " cmd=S\"$(\'#\"++This0.jsEscape(id)", " ++S\"\').replaceWith(\'\"++This0.jsEscape(that)++S\"\');\"", " x=this.executeJs(cmd)", " Debug(cmd)", " if x!=S\"\" (Debug(x))", " return void", " }", " ", " method", " S executeJs(S that)", " S.#stringParser(use GuiPlugin", " check executeJs(wName:this.id().binaryRepr(),command:that.binaryRepr())", " error void)", " ", " method", " mut Iterator events()", " Iterator(id: this.id(), current:S\"\")", " ", " Iterator:{mut(S id, var S current)", " ", " class method S auxFetchEvent(S id) exception Void {", " Library s=use GuiPlugin", " check eventPending(wName:id.binaryRepr())", " exception void", " catch error x (on Library exception void)", " return S.#stringParser(s)", " }", " ", " mut method", " Void #next() exception Void {", " s=Iterator.auxFetchEvent(id:this.id())", " return this.current(s)", " }", " ", " read method", " Void #checkEnd() void", " ", " read method", " S #inner() (this.current())", "", " read method", " Void #close() void", " }", " '----------------------", " }", " }", " }", " }"));
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());
}
}
Aggregations