// @copyright@ // This file is part of nzdis-kif package. See the file LICENSE for copyright information // and the terms and conditions for copying, distribution and modification of nzdis-kif package. package nzdis.lang.kif.tool; /**/ import nzdis.lang.kif.node.*; import java.io.*; /** * Utility class for KIF Abstract Syntax Tree back to well-formed * ASCII representation. * *@author Mariusz Nowostawski *@version @version@ $Revision: 1.1 $ */ public class ToAscii { public static String toString(final String kif){ Node ast =null; try { ast = TreeBuilder.getNode( new PushbackReader( new BufferedReader( new StringReader(kif)))); } catch(Exception e) { e.printStackTrace(); return ""; } return toString(ast); } public static String toString(final Node astKIF){ Kif2AsciiWalker walker = new Kif2AsciiWalker(); StringBuffer buf = walker.toAscii(astKIF); return buf.toString(); } }