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

22
LINES

< > BotCompany Repo | #1020763 // tok_compactModules

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

Libraryless. Click here for Pure Java version (4068L/24K).

svoid tok_compactModules(LS tok) {
  S latestID = #1031187;
  
  // cm means "latest version of compact module"
  jreplace(tok, "cm *", "cmodule2 $2", (_tok, nIdx) -> {
    S t = _tok.get(nIdx+3);
    ret eqOneOf(t, ">", "{") || isIdentifier(t);
  });
  
  for (S kw : ll("cprint", "cprint2")) {
    jreplace(tok, kw + " {", kw + " " + stefansOS_defaultModuleClassName() + " {");
    jreplace(tok, kw + " <id> {", "cmodule2 $2 > DynPrintLog {");
  }
  
  if (jreplace_multi(tok, ll("cmodule", "compact module"), "module")) {
    print("compact modules");
    includeInMainLoaded(tok, "!include once " + latestID + "\n");
  }
  
  if (jreplace_multi(tok, ll("cmodule2 <id>", "cmodule2 >", "cmodule2 {"), "module $2"))
    includeInMainLoaded(tok, "!include once " + latestID + "\n");
}

Author comment

Began life as a copy of #1018678

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1020763
Snippet name: tok_compactModules
Eternal ID of this version: #1020763/22
Text MD5: 7e7c8df0b8780afc9b08e212e98d6112
Transpilation MD5: 67632f9502a7ed0c93a77a03fea38880
Author: stefan
Category: javax / dynamic modules
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-30 02:11:10
Source code size: 807 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 397 / 683
Version history: 21 change(s)
Referenced in: [show references]