static S snlToText(S s) { ret snlToText(snlToTree(s)); } static S snlToText(Lisp tree) { if (tree == null) ret ""; tree = snlRemoveReferences(tree); if (snlToText_isJuxta(tree)) tree = snlToText_addDots(tree); tree = snlQuestionMarksToBack(tree); S snl = snlFromTree(tree); new StringBuilder buf; L drop = litlist ("[", "]", "<", ">"); for (S t : codeTokensOnly(snlTok(snl))) if (!drop.contains(t)) { if (buf.length() != 0 && !litlist(".", "?").contains(t)) buf.append(" "); buf.append(t); } ret str(buf); } static boolean snlToText_isJuxta(Lisp tree) { ret eq("*", join(asList(new HashSet(codeTokensOnly(javaTok(tree.head)))))); } static Lisp snlToText_addDots(Lisp tree) { Lisp t = new Lisp(tree.head); for (Lisp x : tree) { if (x.isA("<") && !x.get(0).is("?", ".")) x = lisp("<", ".", x); t.add(x); } ret t; }