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

15
LINES

< > BotCompany Repo | #1017508 // tok_dropAllCurlyBrackets (makes copy)

JavaX fragment (include)

1  
static S tok_dropAllCurlyBrackets(S s) {
2  
  ret join(tok_dropAllCurlyBrackets(javaTok(s)));
3  
}
4  
5  
static L<S> tok_dropAllCurlyBrackets(L<S> tok) {
6  
  new L<S> out;
7  
  for (int i = 0; i < l(tok); i++) {
8  
    S t = tok.get(i);
9  
    if (eqOneOf(t, "{", "}"))
10  
      tokAppend(out, l(out)-1, tok.get(++i)); // merge N tokens
11  
    else
12  
      out.add(t);
13  
  }
14  
  ret out;
15  
}

Author comment

Began life as a copy of #1008895

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017508
Snippet name: tok_dropAllCurlyBrackets (makes copy)
Eternal ID of this version: #1017508/3
Text MD5: 7a7747afe75028997de093883cd448b4
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-24 12:44:05
Source code size: 369 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 403 / 430
Version history: 2 change(s)
Referenced in: [show references]