1 | static S structureToJava(O o) { |
2 | if (o == null) ret "null"; |
3 | if (o instanceof Bool || o instanceof Number) ret str(o); |
4 | if (o instanceof S) ret quote(o); |
5 | if (o instanceof LinkedHashMap) ret structureToJava_map("litorderedmap", o); |
6 | if (o instanceof HashMap) ret structureToJava_map("litmap", o); |
7 | if (o instanceof TreeMap) ret structureToJava_map("littreemap", o); |
8 | if (o instanceof L) |
9 | ret "ll(" + join(", ", map((L) o, f structureToJava)) + ")"; |
10 | fail("boohoo " + className(o)); |
11 | } |
12 | |
13 | static S structureToJava_map(S type, O o) { |
14 | ret type + "(" + join(", ", mapMapToList((Map) o, func(O a, O b) { structureToJava(a) + ", " + structureToJava(b) })) + ")"; |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1010441 |
Snippet name: | structureToJava - turn certain kinds of objects into Java code |
Eternal ID of this version: | #1010441/8 |
Text MD5: | 5cf2adf540cf5a18d4d489ad1f4f7e7a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-30 14:01:44 |
Source code size: | 682 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 467 / 497 |
Version history: | 7 change(s) |
Referenced in: | [show references] |