static MultiMap<S, S> findInitializers(S s) { L<S> tok = javaTok(s); Map<Integer, Integer> bracketMap = getBracketMap(tok); new MultiMap<S, S> map; int i = 0; while ((i = findCodeTokens(tok, i+1, "<id>", "=")) >= 0) { S name = tok.get(i); if (eq(get(tok, i+4), "=")) continue; // it's ==, not = if (litlist(">", ".").contains(get(tok, i-2))) continue; // it's -> or . int j = scanToEndOfInitializer(tok, bracketMap, i+4); map.put(name, join(tok.subList(i+4, j))); } ret map; }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002125 |
Snippet name: | findInitializers - finds initializers in C-ish code |
Eternal ID of this version: | #1002125/1 |
Text MD5: | c1a18a81c5c87c5b048d7069d1b2a752 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-20 22:37:59 |
Source code size: | 523 bytes / 14 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 680 / 919 |
Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |