2006-08-13 Miguel de Icaza <miguel@novell.com>
[mono.git] / mcs / mbas / CompilerOptions.cs
1 //
2 // CompilerOptions.cs: The compiler command line options processor.
3 //
4 // Author: Rafael Teixeira (rafaelteixeirabr@hotmail.com)
5 // Based on mcs by : Miguel de Icaza (miguel@gnu.org)
6 //
7 // Licensed under the terms of the GNU GPL
8 //
9 // (C) 2002, 2003, 2004 Rafael Teixeira
10 //
11
12 namespace Mono.MonoBASIC {
13
14         using System;
15         using System.Collections;
16         using System.Reflection;
17         using System.Reflection.Emit;
18         using System.Text;
19
20         using Mono.GetOptions;
21         using Mono.GetOptions.Useful;
22
23         public enum OptionCompare {
24                 Binary, Text
25         };
26
27         /// <summary>
28         ///    The compiler command line options processor.
29         /// </summary>
30         public class CompilerOptions : CommonCompilerOptions {
31         
32                 public override string [] AssembliesToReferenceSoftly {
33                         get {
34                                 //
35                                 // For now the "default config" is hardcoded into the compiler
36                                 // we can move this outside later
37                                 //
38                                 return new string [] {
39                                         "System",
40                                         "System.Data",
41                                         "System.Xml",
42                                         "Microsoft.VisualBasic" 
43 #if EXTRA_DEFAULT_REFS
44                                         //
45                                         // Is it worth pre-loading all this stuff?
46                                         //
47                                         ,
48                                         "Accessibility",
49                                         "System.Configuration.Install",
50                                         "System.Design",
51                                         "System.DirectoryServices",
52                                         "System.Drawing.Design",
53                                         "System.Drawing",
54                                         "System.EnterpriseServices",
55                                         "System.Management",
56                                         "System.Messaging",
57                                         "System.Runtime.Remoting",
58                                         "System.Runtime.Serialization.Formatters.Soap",
59                                         "System.Security",
60                                         "System.ServiceProcess",
61                                         "System.Web",
62                                         "System.Web.RegularExpressions",
63                                         "System.Web.Services" ,
64                                         "System.Windows.Forms"
65 #endif
66                                 };
67                         } 
68                 }
69
70                 public CompilerOptions(string [] args, ErrorReporter ReportError) : base(args, ReportError) {}
71                 
72                 protected override void InitializeOtherDefaults() 
73                 { 
74                         DefineSymbol = "__MonoBASIC__";
75                         ImportNamespaces = "Microsoft.VisualBasic";
76                 }
77                 
78                 // TODO: remove next lines when the compler has matured enough
79                 public override string AdditionalBannerInfo { get { return "--------\nTHIS IS AN ALPHA SOFTWARE.\n--------"; } }
80
81                 // Temporary options
82                 //------------------------------------------------------------------
83                 [Option("[IGNORED] Only parses the source file (for debugging the tokenizer)", "parse", SecondLevelHelp = true)]
84                 public bool OnlyParse = false;
85
86                 [Option("[IGNORED] Only tokenizes source files", "tokenize", SecondLevelHelp = true)]
87                 public bool Tokenize = false;
88
89                 [Option("Shows stack trace at Error location", "stacktrace", SecondLevelHelp = true)]
90                 public bool Stacktrace = false;
91                 
92                 [Option("Makes errors fatal", "fatal", SecondLevelHelp = true)]
93                 public bool MakeErrorsFatal = false;
94                 
95                 // redefining some inherited options
96                 //------------------------------------------------------------------
97                 [Option("About the MonoBASIC compiler", "about")]
98                 public override WhatToDoNext DoAbout() { return base.DoAbout(); }
99
100                 [KillOption]
101                 public override WhatToDoNext DoUsage() { return WhatToDoNext.GoAhead; }
102
103                 // language options
104                 //------------------------------------------------------------------
105
106                 [Option("Require explicit declaration of variables", "optionexplicit", VBCStyleBoolean = true)]
107                 public bool OptionExplicit = false;
108
109                 [Option("Enforce strict language semantics", "optionstrict", VBCStyleBoolean = true)]
110                 public bool OptionStrict = false;
111                 
112                 [Option("Specifies binary-style string comparisons. This is the default", "optioncompare:binary")]
113                 public bool OptionCompareBinary = true; 
114
115                 [Option("Specifies text-style string comparisons.", "optioncompare:text")]
116                 public bool OptionCompareText { set { OptionCompareBinary = false; } }
117                 
118         }
119 }