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

15
LINES

< > BotCompany Repo | #1008803 // xtok_joinBrackets2

JavaX fragment (include)

1  
static L xtok_joinBrackets2(L tok) {
2  
  new L t;
3  
  Map<Int, Int> map = getBracketMap(tok);
4  
  for (int i = 0; i < l(tok); i++) {
5  
    Int dest = map.get(i);
6  
    if (dest != null && !(i == 1 && dest == 5 && l(tok) == 7)) {
7  
      t.addAll(subList(tok, i, i+2)); // bracket plus N
8  
      t.add(cncAddFirstAndLast(subList(tok, i+2, dest-1)));
9  
      t.addAll(subList(tok, dest-1, dest+1)); // N plus bracket
10  
      i = dest;
11  
    } else
12  
      t.add(tok.get(i));
13  
  }
14  
  ret t;
15  
}

Author comment

Began life as a copy of #1008799

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008803
Snippet name: xtok_joinBrackets2
Eternal ID of this version: #1008803/8
Text MD5: dcf0ddda67dd622ab5efbe5ed041616e
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-09 02:39:37
Source code size: 479 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 557 / 602
Version history: 7 change(s)
Referenced in: [show references]