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: | 679 / 917 |
Referenced in: | [show references] |