diff src/plparser/Test.java @ 0:b0dee5b76b12

Scanner worked.
author kono@ie.u-ryukyu.ac.jp
date Sat, 28 Aug 2010 16:07:00 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/plparser/Test.java	Sat Aug 28 16:07:00 2010 +0900
@@ -0,0 +1,47 @@
+package plparser;
+
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+
+public class Test {
+	
+	public static PropertyListScanner<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() {
+		Dictionary<Property> dict = new Dictionary<Property>();
+		scan = new PropertyListScanner<Property>(dict);
+	}
+
+
+	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();
+		}
+	}
+	
+
+}
\ No newline at end of file