Mercurial > hg > Members > kono > PLparser
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b0dee5b76b12 |
---|---|
1 package plparser; | |
2 | |
3 | |
4 import java.io.FileNotFoundException; | |
5 import java.io.FileReader; | |
6 | |
7 public class Test { | |
8 | |
9 public static PropertyListScanner<Property> scan; | |
10 | |
11 public static void main(String arg[]) { | |
12 initScanner(); | |
13 if (arg.length==0) { | |
14 arg = new String[1]; | |
15 arg[0] = "data/alias_article.plist"; | |
16 } | |
17 for(String file: arg) { | |
18 try { | |
19 scan(new FileReader(file)); | |
20 } catch (FileNotFoundException e) { | |
21 scan(file); | |
22 } | |
23 } | |
24 } | |
25 | |
26 public static void initScanner() { | |
27 Dictionary<Property> dict = new Dictionary<Property>(); | |
28 scan = new PropertyListScanner<Property>(dict); | |
29 } | |
30 | |
31 | |
32 public static void scan(String exp) { | |
33 for(Token<Property> t : scan.scanToken(exp)) { | |
34 System.out.print(t+" "); | |
35 } | |
36 System.out.println(); | |
37 } | |
38 | |
39 public static void scan(FileReader file) { | |
40 for(Token<Property> t : scan.scanToken(file)) { | |
41 System.out.print(t+" "); | |
42 System.out.println(); | |
43 } | |
44 } | |
45 | |
46 | |
47 } |