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

13
LINES

< > BotCompany Repo | #1026115 // tok_dropRoundOrCurlyBrackets

JavaX fragment (include)

sS tok_dropRoundOrCurlyBrackets(S s) {
  ret join(tok_dropRoundOrCurlyBrackets(javaTok(s)));
}

static LS tok_dropRoundOrCurlyBrackets(LS tok) {
  for (int i = 1; i < l(tok); i+= 2) {
    while (eqGetOneOf(tok, i, "(", ")", "{", "}")) {
      tokAppend(tok, i-1, tok.get(i+1));
      removeSubList(tok, i, i+2);
    }
  }
  ret tok;
}

Author comment

Began life as a copy of #1025589

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1026115
Snippet name: tok_dropRoundOrCurlyBrackets
Eternal ID of this version: #1026115/1
Text MD5: ca5686d632e4b0927ddfe267f85c179f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-25 14:30:19
Source code size: 346 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 176 / 214
Referenced in: [show references]