Libraryless. Click here for Pure Java version (2089L/14K).
// Return value is C token static int tok_findBeginningOfStatement(L<S> tok, int i) { i |= 1; int level = 0; while (i > 1) { S t = get(tok, i); if (eqOneOf(t, "{", "(")) { if (level-- < 0) break; } else if (eqOneOf(t, "}", ")")) level++; else if (level == 0 && eqGetOneOf(tok, i-2, "}", "{", ";")) break; i -= 2; } ret i; }
Began life as a copy of #1017567
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: | #1025037 |
| Snippet name: | tok_findBeginningOfStatement (probably doesn't always work) |
| Eternal ID of this version: | #1025037/6 |
| Text MD5: | ad5770276ffb46b1d7ab7e5ea6164153 |
| Transpilation MD5: | 3c662bf6450f38ea6e834cf7ce28e1ca |
| Author: | stefan |
| Category: | javax / parsing |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-09-01 20:56:41 |
| Source code size: | 380 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 506 / 669 |
| Version history: | 5 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |