!636 !standard functions !class _javax 19 main { psvm { String snippetID = "#1000592"; boolean run = false; for args { // nifty new syntax provided by #680 if (arg.equals("run")) run = true; else if (isSnippetID(arg)) snippetID = arg; else System.out.println("Ignoring unknown argument " + arg); } print "\nComment interpreter starting." System.out.println("\nWorking on snippet: " + snippetID); String text = loadSnippet(snippetID); List comments = getSnippetComments(snippetID); for (Comment c : comments) { System.out.println(c.user_name + " (" + c.user_id + ") says: " + c.text); if (c.user_id == 1) { Matcher m = Pattern.compile("entire subst (#\\d+)").matcher(c.text); if (m.matches()) { String newSnippetID = m.group(1); System.out.println("Replacing with " + newSnippetID); text = loadSnippet(newSnippetID); } } } System.out.println("Result:\n\n" + text + "\n"); if (run) { print "Running." Class main = compileAndLoadMainClass(text); System.out.println("Calling main method.\n"); call(main, "main", new Object[] {new String[0]}); } } }