static void Usage ()
{
Console.WriteLine (
- "Mono C# compiler, (C) 2001 - 2007 Novell, Inc.\n" +
+ "Mono C# compiler, (C) 2001 - 2008 Novell, Inc.\n" +
"mcs [options] source-files\n" +
" --about About the Mono C# compiler\n" +
" -addmodule:M1[,Mn] Adds the module to the generated assembly\n" +
" -checked[+|-] Sets default aritmetic overflow context\n" +
" -codepage:ID Sets code page to the one in ID (number, utf8, reset)\n" +
- " -clscheck[+|-] Disables CLS Compliance verifications" + Environment.NewLine +
+ " -clscheck[+|-] Disables CLS Compliance verifications\n" +
" -define:S1[;S2] Defines one or more conditional symbols (short: -d)\n" +
" -debug[+|-], -g Generate debugging information\n" +
" -delaysign[+|-] Only insert the public key into the assembly (no signing)\n" +
" -help Lists all compiler options (short: -?)\n" +
" -keycontainer:NAME The key pair container used to sign the output assembly\n" +
" -keyfile:FILE The key file used to strongname the ouput assembly\n" +
- " -langversion:TEXT Specifies language version modes: ISO-1 or Default\n" +
+ " -langversion:TEXT Specifies language version modes: ISO-1, ISO-2, or Default\n" +
" -lib:PATH1[,PATHn] Specifies the location of referenced assemblies\n" +
" -main:CLASS Specifies the class with the Main method (short: -m)\n" +
" -noconfig[+|-] Disables implicit references to assemblies\n" +
static void About ()
{
Console.WriteLine (
- "The Mono C# compiler is (C) 2001-2007, Novell, Inc.\n\n" +
+ "The Mono C# compiler is (C) 2001-2008, Novell, Inc.\n\n" +
"The compiler source code is released under the terms of the GNU GPL\n\n" +
"For more information on Mono, visit the project Web site\n" +
public static int Main (string[] args)
{
RootContext.Version = LanguageVersion.Default;
+
Location.InEmacs = Environment.GetEnvironmentVariable ("EMACS") == "t";
bool ok = MainDriver (args);
//
string [] default_config = {
"System",
+#if NET_2_1
+ "agclr",
+ "System.Core",
+ "System.Silverlight",
+ "System.Xml.Core",
+#else
"System.Xml"
+#endif
#if false
//
// Is it worth pre-loading all this stuff?
Report.Error (1900, "Warning level must be in the range 0-4");
return;
}
- RootContext.WarningLevel = level;
+ Report.WarningLevel = level;
}
- static void SetupV2 ()
- {
- RootContext.Version = LanguageVersion.Default;
- defines.Add ("__V2__");
- }
-
static void Version ()
{
string version = Assembly.GetExecutingAssembly ().GetName ().Version.ToString ();
Console.WriteLine ("Mono C# compiler version {0}", version);
Environment.Exit (0);
}
-
- //
- // This is to test the tokenizer internal parser that is used to deambiguate
- // '(' type identifier from '(' type others so that we are able to parse
- // without introducing reduce/reduce conflicts in the grammar.
- //
- static void LambdaTypeParseTest (string fname)
- {
- bool fail = false;
-
- using (FileStream fs = File.OpenRead (fname)){
- StreamReader r = new StreamReader (fs, encoding);
- string line;
-
- while ((line = r.ReadLine ())!= null){
- if (line [0] == '!')
- continue;
- bool must_pass = line [0] == '+';
- StringReader test = new StringReader (line.Substring (1));
- SeekableStreamReader reader = new SeekableStreamReader (test);
- SourceFile file = new SourceFile (fname, fname, 0);
-
- Tokenizer lexer = new Tokenizer (reader, file, defines);
- bool res = lexer.parse_lambda_parameters ();
-
- Console.WriteLine ("{3} ({1}=={2}): {0}", line.Substring (1), res, must_pass, res == must_pass);
- if (res != must_pass)
- fail = true;
- }
- }
- Console.WriteLine ("fail={0}", fail);
- Environment.Exit (fail ? 1 : 0);
- }
//
// Currently handles the Unix-like command line options, but will be
Report.Warning (-29, 1, "Compatibility: Use -noconfig option instead of --noconfig");
load_default_config = false;
return true;
-
- case "--typetest":
- if ((i + 1) >= args.Length){
- Report.Error (5, "--typetest requires a filename argument");
- Environment.Exit (1);
- }
- LambdaTypeParseTest (args [++i]);
- return true;
}
return false;
RootContext.StrongNameDelaySign = false;
return true;
- case "/v2":
- case "/2":
- Console.WriteLine ("The compiler option -2 is obsolete. Please use /langversion instead");
- SetupV2 ();
- return true;
-
case "/langversion":
switch (value.ToLower (CultureInfo.InvariantCulture)) {
- case "iso-1":
- RootContext.Version = LanguageVersion.ISO_1;
- return true;
-
- case "default":
- SetupV2 ();
- return true;
+ case "iso-1":
+ RootContext.Version = LanguageVersion.ISO_1;
+ return true;
+
+ case "default":
+ RootContext.Version = LanguageVersion.Default;
+#if GMCS_SOURCE
+ defines.Add ("__V2__");
+#endif
+ return true;
#if GMCS_SOURCE
- case "linq":
- RootContext.Version = LanguageVersion.LINQ;
- Tokenizer.InitializeLinqKeywords ();
- return true;
+ case "iso-2":
+ RootContext.Version = LanguageVersion.ISO_2;
+ return true;
+
+ case "linq":
+ Report.Warning (-30, 1, "Deprecated: The `linq' option is no longer required and should not be used");
+ return true;
#endif
}
- Report.Error (1617, "Invalid option `{0}' for /langversion. It must be either `ISO-1' or `Default'", value);
+ Report.Error (1617, "Invalid option `{0}' for /langversion. It must be either `ISO-1', `ISO-2' or `Default'", value);
return true;
case "/codepage":