Warning: session_start(): open(/var/lib/php/sessions/sess_gjk9a4345377715r3qc2evsh7c, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass JLeftArrowScriptIDE is Swingable {
settable SimpleLiveValue lvScript = stringLiveValue();
S sectionTitle = "Left arrow script";
transient CompileResult compileResult;
transient RSyntaxTextAreaWithSearch taScript;
transient new Q compileQ;
transient JLabel lblCompileResult;
transient JButton btnRun;
visual {
taScript = liveValueRSyntaxTextArea_bothWays(lvScript);
awtCalcEvery(taScript.textArea(), 1.0, -> compileQ.add(r compile));
ret jCenteredSection(sectionTitle,
centerAndSouthWithMargin(
taScript.visualize(),
centerAndEastWithMargin(
lblCompileResult = jlabel(),
btnRun = jbutton("Run" := rThread runScript))));
}
bool visible() { ret isShowing(lblCompileResult); }
void compile {
var script = lvScript!;
var result = compileResult;
if (result == null || !eq(result.script, script)) {
try {
result = new CompileResult;
result.script = script;
result.parser = new GazelleV_LeftArrowScriptParser;
modifyParser(result.parser);
result.parsedScript = result.parser.parse(result.script);
print(result.parsedScript);
} catch print e {
result.compileError = e;
}
compileResult = result;
setText(lblCompileResult, compileResult);
}
}
CompileResult freshCompileResult() {
runInQAndWait(compileQ, r compile);
ret compileResult;
}
GazelleV_LeftArrowScript.Script parsedScript() {
ret freshCompileResult().parsedScript;
}
swappable void runButtonAction {
runScript();
}
void runScript {
//showText_fast_noWrap("Script Error", renderStackTrace(e));
var result = freshCompileResult();
if (result.parsedScript != null)
result.result = okOrError(-> result.parsedScript!);
}
class CompileResult {
S script;
GazelleV_LeftArrowScriptParser parser;
Throwable compileError;
GazelleV_LeftArrowScript.Script parsedScript;
OKOrError result;
toString {
ret compileError != null ? exceptionToStringShorter(compileError) : "Compiled OK";
}
}
swappable void modifyParser(GazelleV_LeftArrowScriptParser parser) {
parser.allowTheWorld(mc());
}
void showRuntimeError(Throwable e) {
setText(lblCompileResult, exceptionToStringShorter(e));
}
}