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

14
LINES

< > BotCompany Repo | #1023092 // tok_for_single

JavaX fragment (include)

// for single () iterates once when the expression is not null
// and zero times when it is null.
// It was actually used once.
svoid tok_for_single(LS tok) {
  int i = -1;
  while ((i = jfind(tok, i+1, "for single (")) >= 0) {
    int iColon = indexOf(tok, ":", i);
    int iClosing = findEndOfBracketPart(tok, iColon)-1;
    tok.set(iColon, ": singletonUnlessNull(");
    tok.set(iClosing, "))");
    clearTokens(tok, i+2, i+4);
    reTok(tok, i, iClosing+1);
  }
}

Author comment

Began life as a copy of #1023091

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1023092
Snippet name: tok_for_single
Eternal ID of this version: #1023092/2
Text MD5: 7fd130f4d6dee6017369d30f9ba40794
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-21 04:40:40
Source code size: 480 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 313 / 367
Version history: 1 change(s)
Referenced in: [show references]