import hiro.yoshioka.ast.sql.oracle.util.WolfParserFactory;
import hiro.yoshioka.ast.sql.util.ParserFactory;
import hiro.yoshioka.ast.sql.util.ParserUtil;

import java.util.Iterator;

public class ParseTest {

	public static final ParserUtil parse(ParserFactory f, String sql)
			throws Exception {
		ParserUtil fUtil = f.createParserUtil(sql);

		fUtil.enable_tracing();
		if (!fUtil.parse()) {
			for (Iterator ite = fUtil.getExpectedTokens(); ite.hasNext();) {
				System.out.println("kitai[" + ite.next() + "]");
			}
		}
		return fUtil;
	}

	public static void main(String[] args) {
		try {

			ParserFactory f = new WolfParserFactory();
			String sql = "DROP TABLE HOGE";
			ParserUtil util = parse(f, sql);
			util.dumpNodes();
		} catch (Throwable e) {
			e.printStackTrace();
		}

	}

}
