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

13
LINES

< > BotCompany Repo | #1003919 // getBracketMap2

JavaX fragment (include)

1  
static L<int> getBracketMap2(L<S> tok, Map<Integer, Integer> map, S openingBrackets, S closingBrackets) {
2  
  map.clear();
3  
  new L<int> stack;
4  
  for (int i = 1; i < l(tok); i+= 2) {
5  
    S t = tok.get(i);
6  
    if (l(t) == 1)
7  
      if (openingBrackets.contains(t))
8  
        stack.add(i);
9  
      else if (closingBrackets.contains(tok.get(i)))
10  
        map.put(empty(stack) ? 0 : liftLast(stack), i);
11  
  }
12  
  ret stack;
13  
}

Author comment

Began life as a copy of #1002118

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003919
Snippet name: getBracketMap2
Eternal ID of this version: #1003919/1
Text MD5: c9c5413831750a0080247df785431f08
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-30 18:27:25
Source code size: 421 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 512 / 624
Referenced in: [show references]