// i is index of last token of expression // return value is C token static int tok_findBeginningOfJavaXTerm(L<S> tok, int i) { i |= 1; int level = 0; while (i > 1) { S t = get(tok, i); if (eqOneOf(t, "}", ")")) level++; else if (eqOneOf(t, "{", "(")) level--; if (level == 0) { S prev = get(tok, i-2); printVars_str(+prev, +t); if (eqOneOf(prev, "ret", "return") || isIdentifier(t) && !isIdentifier(prev) && !eq(prev, ".")) { ifdef tok_findBeginningOfJavaXTerm_debug print("Returning " + i + " / " + t); endifdef ret i; } } i -= 2; } ret i; }
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: | #1026294 |
Snippet name: | tok_findBeginningOfJavaXTerm [dev.] |
Eternal ID of this version: | #1026294/12 |
Text MD5: | becc9a0adb2e70828873d915581b5e1e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-28 23:45:07 |
Source code size: | 699 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 246 / 299 |
Version history: | 11 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |