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

13
LINES

< > BotCompany Repo | #1025589 // tok_dropRoundBrackets - but not the contents of brackets

JavaX fragment (include)

1  
sS tok_dropRoundBrackets(S s) {
2  
  ret join(tok_dropRoundBrackets(javaTok(s)));
3  
}
4  
5  
static LS tok_dropRoundBrackets(LS tok) {
6  
  for (int i = 1; i < l(tok); i+= 2) {
7  
    while (eqGetOneOf(tok, i, "(", ")")) {
8  
      tokAppend(tok, i-1, tok.get(i+1));
9  
      removeSubList(tok, i, i+2);
10  
    }
11  
  }
12  
  ret tok;
13  
}

Author comment

Began life as a copy of #1020926

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: #1025589
Snippet name: tok_dropRoundBrackets - but not the contents of brackets
Eternal ID of this version: #1025589/2
Text MD5: a9f76a96c348b6682796f3548dbf9347
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-05 18:03:22
Source code size: 315 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 303 / 338
Version history: 1 change(s)
Referenced in: [show references]