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; visual { taScript = liveValueRSyntaxTextArea_bothWays(lvScript); awtCalcEvery(taScript.textArea(), 1.0, -> compileQ.add(r compile)); ret jCenteredSection(sectionTitle, centerAndSouthWithMargin( taScript.visualize(), centerAndEastWithMargin( lblCompileResult = jlabel(), jbutton("Run" := rThread runScript)))); } bool showing() { 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); } } void runScript { //showText_fast_noWrap("Script Error", renderStackTrace(e)); runInQAndWait(compileQ, r compile); var result = compileResult; 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()); } }