1 | // i must point at the (possibly imaginary) opening bracket (any of the 3 types, not type parameters) |
2 | // index returned is index of closing bracket + 1 |
3 | static int findEndOfBracketPart2(List<String> cnc, int i) {
|
4 | int j = i+2, level = 1; |
5 | while (j < cnc.size()) {
|
6 | if (eqOneOf(cnc.get(j), "{", "(", "[")) ++level;
|
7 | else if (eqOneOf(cnc.get(j), "}", ")", "]")) --level; |
8 | if (level == 0) |
9 | return j+1; |
10 | ++j; |
11 | } |
12 | return cnc.size(); |
13 | } |
Began life as a copy of #1001165
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lnbujpyubztb, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1017794 |
| Snippet name: | findEndOfBracketPart2 - with square brackets |
| Eternal ID of this version: | #1017794/3 |
| Text MD5: | ea2280bedc69c69da9191aa301166461 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-09-10 14:49:03 |
| Source code size: | 461 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 617 / 716 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |