sclass JLeftArrowMiniIDE is Swingable { settable new SimpleLiveValue lvScript; transient RSyntaxTextAreaWithSearch taScript; transient new Q compileQ; transient JLabel lblCompileResult; visual { taScript = liveValueRSyntaxTextArea_bothWays(lvScript); awtCalcEvery(taScript.textArea(), 1.0, -> compileQ.add(r compile)); ret jCenteredSection("Left-arrow style script", centerAndSouthWithMargin( taScript.visualize(), centerAndEastWithMargin( lblCompileResult = jlabel(), jbutton("Run" := rThread runScript)))); } 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); } } void runScript { //showText_fast_noWrap("Script Error", renderStackTrace(e)); dm_runInQAndWait(r compileNewScript); var result = newScriptCompileResult; 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 modifyParser(GazelleV_LeftArrowScriptParser parser) { result.parser.allowTheWorld(mc()); } }