view src/plparser/TestScanner.java @ 11:79d492bce828

clean up
author one
date Thu, 02 Sep 2010 11:55:56 +0900
parents 29e309b2f624
children
line wrap: on
line source

package plparser;


import java.io.FileNotFoundException;
import java.io.FileReader;

public class TestScanner {
	
	public static PLScanner<Property> scan;

	public static void main(String arg[]) {
		initScanner();
		if (arg.length==0) {
			arg = new String[1];
			arg[0] = "data/alias_article.plist";
		}
		for(String file: arg) {
			try {
				scan(new FileReader(file));
			} catch (FileNotFoundException e) {
				scan(file);
			}
		}
	}
	
	public static void initScanner() {
		 // scan = new PropertyListScanner<Property>();
		// scan = new PropertyListStreamTokenizer<Property>();
		// scan = new PropertyListStreamScanner<Property>();
		scan = new PropertyListCharTokenizer<Property>();
	}


	public static void scan(String exp) {
		for(Token<Property> t : scan.scanToken(exp)) {
			System.out.print(t+" ");
		}
		System.out.println();
	}
	
	public static void scan(FileReader file) {
		for(Token<Property> t : scan.scanToken(file)) {
			System.out.print(t+" ");
			System.out.println();
		}
	}
	

}