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.

sS includeInMainLoaded_magicComment;

static L<S> includeInMainLoaded(LS tok, S text) {
  if (includeInMainLoaded_magicComment == null)
    includeInMainLoaded_magicComment = "/*" + randomID() + "*/";
  int i = lastIndexOfStartingWith(tok, includeInMainLoaded_magicComment);
  if (i > 0) --i; else {
    print("Finding main class");
    L<S> main = findMainClass(tok);
    if (main == null) {
      print(join(tok));
      fail("no main class");
    }
    i = main.lastIndexOf("}");
    i += magicIndexOfSubList(tok, main);
    tok.set(i, "}" + includeInMainLoaded_magicComment);
  }
  tok.set(i, "\n" + text + "\n" + tok.get(i));
  ret includeInMainLoaded_reTok(tok, i, i+1);
}

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: 650 / 1609
Version history: 8 change(s)
Referenced in: [show references]