KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JavaParser


1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright (C) 1998-2004 Gerwin Klein <lsf@jflex.de> *
3  * All rights reserved. *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License. See the file *
7  * COPYRIGHT for more information. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License along *
15  * with this program; if not, write to the Free Software Foundation, Inc., *
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
17  * *
18  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

19
20 import java.io.*;
21
22
23 /**
24  * Simple test driver for the java parser. Just runs it on some
25  * input files, gives no useful output.
26  */

27 public class JavaParser {
28
29   public static void main(String JavaDoc argv[]) {
30
31     for (int i = 0; i < argv.length; i++) {
32       try {
33         System.out.println("Parsing ["+argv[i]+"]");
34         Scanner s = new Scanner(new UnicodeEscapes(new FileReader(argv[i])));
35         parser p = new parser(s);
36         p.parse();
37         
38         System.out.println("No errors.");
39       }
40       catch (Exception JavaDoc e) {
41         e.printStackTrace(System.out);
42         System.exit(1);
43       }
44     }
45   }
46
47 }
48
Popular Tags