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

11
LINES

< > BotCompany Repo | #1026407 // tok_swappableFunctions v1 [simple demo case only]

JavaX fragment (include)

svoid tok_swappableFunctions(LS tok) {
  int i;
  while ((i = jfind(tok, "swappable <id> <id>() {")) >= 0) {
    S returnType = tok.get(i+2), name = tok.get(i+4);
    S base = name + "_base";
    int iCurly = indexOf(tok, i, "{");
    replaceTokens_reTok(tok, i, iCurly+1, "transient IF0<\*returnType*/> \*name*/;\n" + 
      "\*returnType*/ \*name*/() { ret \*name*/ != null ? \*name*/! : \*base*/(); }\n" +
      "\*returnType*/ \*base*/() {");
  }
}

Author comment

Began life as a copy of #1026384

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

-
Snippet ID: #1026407
Snippet name: tok_swappableFunctions v1 [simple demo case only]
Eternal ID of this version: #1026407/1
Text MD5: 1526f05b51c9d705ee40b8a2f1c77ff5
Author: stefan
Category: javax / linux
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-03 00:05:31
Source code size: 462 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 235 / 228
Referenced in: