Mercurial > hg > Members > kono > PLparser
view src/plparser/TestScanner.java @ 1:b149a5aa465a
Parser is written
author | kono@ie.u-ryukyu.ac.jp |
---|---|
date | Sat, 28 Aug 2010 17:39:34 +0900 |
parents | src/plparser/Test.java@b0dee5b76b12 |
children | 619472ca4742 |
line wrap: on
line source
package plparser; import java.io.FileNotFoundException; import java.io.FileReader; public class TestScanner { 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(); } } }