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

39
LINES

< > BotCompany Repo | #1001150 // Compiler Bot (loves to compile)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (862L/7K/22K).

1  
!747
2  
3  
m {
4  
  p {
5  
    makeAndroid("Compiler bot!");
6  
  }
7  
  
8  
  static synchronized S answer(S s) {
9  
    new Matches m;
10  
    if (match3("Please compile this JavaX snippet: *", s, m)) {
11  
      S snippetID = unquote(m.m[0]);
12  
      S transpiledSrc = getServerTranspiled(snippetID);
13  
      int i = transpiledSrc.indexOf('\n');
14  
      String libs = transpiledSrc.substring(0, Math.max(0, i));
15  
      transpiledSrc = transpiledSrc.substring(i+1);
16  
      return compile(transpiledSrc);
17  
    }
18  
    
19  
    if (match3("Please compile this Java text: *", s, m)) {
20  
      String src = unquote(m.m[0]);
21  
      return compile(src);
22  
    }
23  
    return null;
24  
  }
25  
  
26  
  static S compile(S src) {
27  
    Class j = getJavaX();
28  
    File srcDir = cast call(j, "TempDirMaker_make");
29  
    saveTextFile(new File(srcDir, "main.java"), src);
30  
    File classesDir = cast call(j, "TempDirMaker_make");
31  
    new L<File> libraries;
32  
    try {
33  
      call(j, "compileJava", srcDir, libraries, classesDir);
34  
    } catch (Exception e) {
35  
      return "Compile Error. " + getOpt(j, "javaCompilerOutput");
36  
    }
37  
    return "ok, " + quote(classesDir.getAbsolutePath());
38  
  }
39  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001150
Snippet name: Compiler Bot (loves to compile)
Eternal ID of this version: #1001150/1
Text MD5: e5f6adf4584592c2d1be9b7e4766fa00
Transpilation MD5: 59df4c20e3ed318dc0ac239cc88f6a71
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-09-24 20:56:30
Source code size: 1147 bytes / 39 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 544 / 587
Referenced in: [show references]