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

16
LINES

< > BotCompany Repo | #1018678 // tok_moduleClassDecls

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

Libraryless. Click here for Pure Java version (5899L/33K).

svoid tok_moduleClassDecls(L<S> tok) {
  jreplace(tok, "module <id> implements", "module $2 extends DynModule implements");
  jreplace(tok, "module <id> {", "module $2 extends DynModule {");
  jreplace(tok, "module {", "module " + stefansOS_defaultModuleClassName() + " {");
  jreplace(tok, "module > <id>", "module " + stefansOS_defaultModuleClassName() + " > $3");
  int i = -1;
  while ((i = jfind(tok, i+1, "module <id>",
    // check for interference with other productions
    (_tok, nIdx) -> !eqGetOneOf(_tok, nIdx+3, "instanceof", "default", "aka"))) >= 0) {
    int j = findEndOfBlock(tok, indexOf(tok, "{", i))-1;
    S name = tok.get(i+2);
    tok.set(i, "sclass");
    tokAppend(tok, j, "\nsbool _moduleClass_" + name + " = true;"); // just a marker to quickly find module classes
    reTok(tok, j, j+1);
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018678
Snippet name: tok_moduleClassDecls
Eternal ID of this version: #1018678/16
Text MD5: e532f09641c2a57509c17fa0fda07561
Transpilation MD5: e99f6d41c38b7051508003057839a1ed
Author: stefan
Category: javax / dynamic modules
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-06 18:10:33
Source code size: 839 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 441 / 550
Version history: 15 change(s)
Referenced in: [show references]