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

47
LINES

< > BotCompany Repo | #1034490 // LASCompileResult

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

Transpiled version (47857L) 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";
  }
  
  S errorToString() {
    ret exceptionToStringShorter_dontDropOuterExceptions(compileError);
  }
  
  bool runnable() { ret parsedScript != null; }

  void compile() {  
    compileLog = runResultWithTimestamps(-> {
      if (parser == null)
        parser = makeParser();
      ret parsedScript = parser.parse(script);
    });
      
    if (compileLog.isError()) {
      var e = compileLog.getError();
      print(e);
      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));
  }
}

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
Eternal ID of this version: #1034490/18
Text MD5: e983620255d6fa78b5cf8afd893c3ba8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-13 18:51:24
Source code size: 1365 bytes / 47 lines
Pitched / IR pitched: No / No
Views / Downloads: 77 / 248
Version history: 17 change(s)
Referenced in: [show references]