Libraryless. Click here for Pure Java version (5075L/28K).
1 | // i must point at the (possibly imaginary) opening bracket ("{")
|
2 | // index returned is index of closing bracket + 1 (or l(tok)) |
3 | static int tok_findEndOfBlock(LS tok, int i) {
|
4 | ifclass IContentsIndexedList2 |
5 | if (tok cast IContentsIndexedList2) |
6 | ret tok_findEndOfBlock_IContentsIndexedList2_v2(tok, i); |
7 | endif |
8 | |
9 | int j = i+2, level = 1, n = l(tok); |
10 | while (j < n) {
|
11 | S t = tok.get(j); |
12 | if ("{".equals(t)) ++level;
|
13 | else if ("}".equals(t)) --level;
|
14 | if (level == 0) |
15 | return j+1; |
16 | j += 2; |
17 | } |
18 | ret n; |
19 | } |
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: | #1025221 |
| Snippet name: | tok_findEndOfBlock |
| Eternal ID of this version: | #1025221/4 |
| Text MD5: | c60db24e2a3642abc8c4d2f407a4620f |
| Transpilation MD5: | f33ff841b45eab2277104840d579a848 |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-01 16:08:40 |
| Source code size: | 548 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 669 / 887 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |