Libraryless. Click here for Pure Java version (2089L/14K).
1 | // Return value is C token |
2 | static int tok_findBeginningOfStatement(L<S> tok, int i) { |
3 | i |= 1; |
4 | int level = 0; |
5 | |
6 | while (i > 1) { |
7 | S t = get(tok, i); |
8 | if (eqOneOf(t, "{", "(")) { if (level-- < 0) break; } |
9 | else if (eqOneOf(t, "}", ")")) level++; |
10 | else if (level == 0 && eqGetOneOf(tok, i-2, "}", "{", ";")) |
11 | break; |
12 | i -= 2; |
13 | } |
14 | |
15 | ret i; |
16 | } |
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: | 286 / 410 |
Version history: | 5 change(s) |
Referenced in: | [show references] |