// This file is copyrighted and is part of nzdis-oql package. // See the file LICENSE for copyright information and the terms and conditions for copying, distributing and modifications of nzdis-oql package. // @copyright@ package nzdis.lang.oql.app; /**/ import nzdis.lang.oql.node.Node; import nzdis.lang.oql.TreeBuilder; import java.io.FileReader; import java.io.FileNotFoundException; /** * Prints the tree of the given OQL file on standard output. * This is a toy class which demonstrates the use of PrintWalker adapter * for traversing the tree. * *@author Mariusz Nowostawski *@version @version@ $Revision: 1.1 $ */ public class PrintRawTree { public static void main(String[] arguments) { if(arguments.length != 1) { System.out.println("usage:"); System.out.println(" java PrintTree filename"); System.exit(1); } try{ Node ast = TreeBuilder.getNode(new FileReader(arguments[0]), false);//complex tree ast.apply(new PrintWalker()); }catch(Exception ex){ ex.printStackTrace(); return; } } }