Updated with review feedback.
[mono.git] / mcs / ilasm / Main.cs
1 using System;\r
2 using System.IO;\r
3 \r
4 using Mono.ILASM;\r
5 \r
6 \r
7 public class ILAsmTest {\r
8         private ILAsmTest() {}\r
9 \r
10 \r
11         public static int Main (string [] args) {\r
12 \r
13                 if (args.Length != 1) {\r
14                         Console.WriteLine ("Usage : ilasm [filename]");\r
15                         return 1;\r
16                 }\r
17                 \r
18                 StreamReader reader = File.OpenText (args [0]);\r
19                 ILTokenizer scanner = new ILTokenizer (reader);\r
20 \r
21                 bool testScanner = true;\r
22 \r
23                 if (testScanner) {\r
24                         ILToken tok;\r
25                         while ((tok = scanner.NextToken) != ILToken.EOF) {\r
26                                 Console.WriteLine (tok);\r
27                         }\r
28                 } else {\r
29                         ILParser parser = new ILParser (new CodeGen ());\r
30                         parser.yyparse (new ScannerAdapter (scanner), new yydebug.yyDebugSimple ());\r
31 \r
32                         CodeGen cg = parser.CodeGen;\r
33                         int n = cg.ClassCount;\r
34                         cg.Emit ();\r
35                 }\r
36 \r
37                 return 0;\r
38         }\r
39 }\r