// It's rough but should work if you don't make anonymous classes inside the statement or something... // Also won't work with "for" // Return value is index of semicolon/curly brace+1 static int findEndOfStatement(L<S> tok, int i) { int j = i; // Is it a block? if (eq(get(tok, i), "{")) ret findEndOfBlock(tok, i)+1; // It's a regular statement. int n = l(tok); S t; while (j < n && !";".equals(t = tok.get(j))) if ("{".equals(t)) j = findEndOfBlock(tok, j)+1; else j += 2; ret j+1; }
Began life as a copy of #1001046
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002453 |
Snippet name: | findEndOfStatement (broken version, use tok_findEndOfStatement instead) |
Eternal ID of this version: | #1002453/6 |
Text MD5: | 9465e7f4a2388a547dcb275e8d24ea5b |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-04 00:50:17 |
Source code size: | 553 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 850 / 1812 |
Version history: | 5 change(s) |
Referenced in: | [show references] |