Libraryless. Click here for Pure Java version (5075L/28K).
// i must point at the (possibly imaginary) opening bracket ("{") // index returned is index of closing bracket + 1 (or l(tok)) static int tok_findEndOfBlock(LS tok, int i) { ifclass IContentsIndexedList2 if (tok cast IContentsIndexedList2) ret tok_findEndOfBlock_IContentsIndexedList2_v2(tok, i); endif int j = i+2, level = 1, n = l(tok); while (j < n) { S t = tok.get(j); if ("{".equals(t)) ++level; else if ("}".equals(t)) --level; if (level == 0) return j+1; j += 2; } ret n; }
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: | 251 / 332 |
Version history: | 3 change(s) |
Referenced in: | [show references] |