Transpiled version (117L) is out of date.
!636 // auto-import !standard functions !multi-line strings !quicknew public class main { static String prelude = [[ public class main { public static void main(String[] args) throws Exception { System.out.println(calc()); } public static Object calc() throws Exception { ]]; static String postlude = [[ } } ]]; public static void main(String[] args) throws IOException { String code = loadTextFile("input/main.java", null); if (code == null) throw new RuntimeException("Nothing to do (no input/main.java)"); code = prelude + code + postlude; code = moveImportsUp(code); saveTextFile("output/main.java", code); } static String moveImportsUp(String s) { List<String> l = toLines(s); new List<String> x; Pattern p = Pattern.compile("^\\s*import\\s"); for (ListIterator<String> i = l.listIterator(); i.hasNext(); ) { String line = i.next(); if (p.matcher(line).find()) { x.add(line); i.remove(); } } x.addAll(l); return fromLines(x); } }
Began life as a copy of #609
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, hxnwyiuffukg, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000368 |
Snippet name: | !simplejava |
Eternal ID of this version: | #1000368/1 |
Text MD5: | 6cc1692b2baaaff2fb6b415f9f9c0f30 |
Author: | stefan |
Category: | |
Type: | JavaX translator |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-15 00:57:01 |
Source code size: | 1130 bytes / 44 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 798 / 932 |
Referenced in: | [show references] |