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

20
LINES

< > BotCompany Repo | #1002769 // includeInMainLoaded - now reToks

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

Transpiled version (2955L) is out of date.

1  
sS includeInMainLoaded_magicComment;
2  
3  
static L<S> includeInMainLoaded(LS tok, S text) {
4  
  if (includeInMainLoaded_magicComment == null)
5  
    includeInMainLoaded_magicComment = "/*" + randomID() + "*/";
6  
  int i = lastIndexOfStartingWith(tok, includeInMainLoaded_magicComment);
7  
  if (i > 0) --i; else {
8  
    print("Finding main class");
9  
    L<S> main = findMainClass(tok);
10  
    if (main == null) {
11  
      print(join(tok));
12  
      fail("no main class");
13  
    }
14  
    i = main.lastIndexOf("}");
15  
    i += magicIndexOfSubList(tok, main);
16  
    tok.set(i, "}" + includeInMainLoaded_magicComment);
17  
  }
18  
  tok.set(i, "\n" + text + "\n" + tok.get(i));
19  
  ret includeInMainLoaded_reTok(tok, i, i+1);
20  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002769
Snippet name: includeInMainLoaded - now reToks
Eternal ID of this version: #1002769/9
Text MD5: 90280f142b566ceca14b09c18000c290
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-18 21:13:32
Source code size: 697 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 654 / 1616
Version history: 8 change(s)
Referenced in: [show references]