Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

52
LINES

< > BotCompany Repo | #1034490 // LASCompileResult - this actually invokes the script compiler

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (33154L) is out of date.

sclass LASCompileResult {
  settable S script;
  settable GazelleV_LeftArrowScriptParser parser;
  settable Throwable compileError;
  /*settable broken*/ GazelleV_LeftArrowScript.Script parsedScript;
  RunResultWithTimestamps compileLog;

  toString {
    if (compileError != null) ret errorToString();
    if (parsedScript == null) ret "Not compiled yet";
    ret "Compiled OK" + (compileLog == null ? ""
      : " in " + n2(max(1, compileLog.duration().toMillis())) + " ms";
  }
  
  bool hasError() { ret compileError != null; }
  
  S errorToString() {
    ret exceptionToStringShorter_dontDropOuterExceptions(compileError);
  }
  
  bool runnable() { ret parsedScript != null; }

  void compile() {  
    compileLog = runResultWithTimestamps_dontPrintStackTrace(-> {
      if (parser == null)
        parser = makeParser();
      ret parsedScript = parser.parse(script);
    });
      
    if (compileLog.isError()) {
      var e = compileLog.getError();
      compileError(e);
    }
  }
  
  GazelleV_LeftArrowScript.Script parsedScript aka get() { ret parsedScript; }
  
  GazelleV_LeftArrowScript.Script parsedScriptMandatory() {
    if (compileError != null) fail(compileError);
    ret parsedScript;
  }
  
  swappable GazelleV_LeftArrowScriptParser makeParser() { null; }
  
  LineAndColumn errorLineAndCol() {
    ret parseLineAndColumn(str(compileError));
  }
  
  Timestamp compilationStart() {
    ret compileLog?.started;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034490
Snippet name: LASCompileResult - this actually invokes the script compiler
Eternal ID of this version: #1034490/23
Text MD5: 637dfb1bed58204a07c6b30e5ec0a096
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-09-19 20:03:48
Source code size: 1494 bytes / 52 lines
Pitched / IR pitched: No / No
Views / Downloads: 270 / 528
Version history: 22 change(s)
Referenced in: [show references]