Libraryless. Click here for Pure Java version (3560L/21K).
1 | svoid tok_forUnnull(LS tok) {
|
2 | jreplace(tok, "fOr (", "for unnull (");
|
3 | |
4 | int i = -1; |
5 | while ((i = jfind(tok, i+1, "for unnull (")) >= 0) {
|
6 | int argsFrom = i+4; |
7 | int iColon = indexOf(tok, i, ":"); |
8 | int iClosing = tok_findEndOfForExpression(tok, iColon+2); |
9 | ifdef tok_forUnnull_debug |
10 | print("Found for unnull: " + joinSubList(tok, i, iClosing+1));
|
11 | endifdef |
12 | clearTokens(tok, i+2, i+4); |
13 | tokPrepend(tok, iColon+2, "unnullForIteration(");
|
14 | tokPrepend(tok, iClosing, ")"); |
15 | reTok(tok, i+2, iClosing+1); |
16 | ifdef tok_forUnnull_debug |
17 | print("for unnull => " + joinSubList(tok, i, iClosing+1));
|
18 | endifdef |
19 | } |
20 | } |
Began life as a copy of #1013206
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1022527 |
| Snippet name: | tok_forUnnull - now also allows fOr (...) |
| Eternal ID of this version: | #1022527/11 |
| Text MD5: | 0f17dfe664f654a355d3febcc0d705c9 |
| Transpilation MD5: | 821e9a4a8c47d9459d40b4c507dadd95 |
| Author: | stefan |
| Category: | javax / transpiling |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-06-07 03:43:26 |
| Source code size: | 668 bytes / 20 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 662 / 780 |
| Version history: | 10 change(s) |
| Referenced in: | [show references] |