public int VerboseParserFlag;
public int FatalCounter;
public bool Stacktrace;
+ public bool BreakOnInternalError;
#endregion
public bool ShowFullPaths;
UnknownOption
}
- static readonly char[] argument_value_separator = new char[] { ';', ',' };
- static readonly char[] numeric_value_separator = new char[] { ';', ',', ' ' };
+ static readonly char[] argument_value_separator = { ';', ',' };
+ static readonly char[] numeric_value_separator = { ';', ',', ' ' };
readonly TextWriter output;
readonly Report report;
public CompilerSettings ParseArguments (string[] args)
{
CompilerSettings settings = new CompilerSettings ();
+ if (!ParseArguments (settings, args))
+ return null;
+
+ return settings;
+ }
+
+ public bool ParseArguments (CompilerSettings settings, string[] args)
+ {
+ if (settings == null)
+ throw new ArgumentNullException ("settings");
+
List<string> response_file_list = null;
bool parsing_options = true;
stop_argument = false;
if (response_file_list.Contains (response_file)) {
report.Error (1515, "Response file `{0}' specified multiple times", response_file);
- return null;
+ return false;
}
response_file_list.Add (response_file);
extra_args = LoadArgs (response_file);
if (extra_args == null) {
report.Error (2011, "Unable to open response file: " + response_file);
- return null;
+ return false;
}
args = AddArgs (args, extra_args);
continue;
case ParseResult.Stop:
stop_argument = true;
- return settings;
+ return true;
case ParseResult.UnknownOption:
if (UnknownOptionHandler != null) {
var ret = UnknownOptionHandler (args, i);
}
Error_WrongOption (arg);
- return null;
+ return false;
case ParseResult.Stop:
stop_argument = true;
- return settings;
+ return true;
}
}
}
ProcessSourceFiles (arg, false, settings.SourceFiles);
}
- if (report.Errors > 0)
- return null;
-
- return settings;
+ return report.Errors == 0;
}
void ProcessSourceFiles (string spec, bool recurse, List<SourceFile> sourceFiles)
return;
}
- string[] files = null;
+ string[] files;
try {
files = Directory.GetFiles (path, pattern);
} catch (System.IO.DirectoryNotFoundException) {
public bool ProcessWarningsList (string text, Action<int> action)
{
bool valid = true;
- foreach (string wid in text.Split (numeric_value_separator)) {
+ foreach (string wid in text.Split (numeric_value_separator, StringSplitOptions.RemoveEmptyEntries)) {
int id;
if (!int.TryParse (wid, NumberStyles.AllowLeadingWhite, CultureInfo.InvariantCulture, out id)) {
report.Error (1904, "`{0}' is not a valid warning number", wid);
" --stacktrace Shows stack trace at error location\n" +
" --timestamp Displays time stamps of various compiler events\n" +
" -v Verbose parsing (for debugging the parser)\n" +
- " --mcs-debug X Sets MCS debugging level to X\n");
+ " --mcs-debug X Sets MCS debugging level to X\n" +
+ " --break-on-ice Breaks compilation on internal compiler error");
}
//
settings.WarningsAreErrors = true;
parser_settings.WarningsAreErrors = true;
} else {
- if (!ProcessWarningsList (value, v => settings.AddWarningAsError (v)))
+ if (!ProcessWarningsList (value, settings.AddWarningAsError))
return ParseResult.Error;
}
return ParseResult.Success;
if (value.Length == 0) {
settings.WarningsAreErrors = false;
} else {
- if (!ProcessWarningsList (value, v => settings.AddWarningOnly (v)))
+ if (!ProcessWarningsList (value, settings.AddWarningOnly))
return ParseResult.Error;
}
return ParseResult.Success;
return ParseResult.Error;
}
- if (!ProcessWarningsList (value, v => settings.SetIgnoreWarning (v)))
+ if (!ProcessWarningsList (value, settings.SetIgnoreWarning))
return ParseResult.Error;
return ParseResult.Success;
settings.WriteMetadataOnly = true;
return ParseResult.Success;
+ case "--break-on-ice":
+ settings.BreakOnInternalError = true;
+ return ParseResult.Success;
+
default:
if (arg.StartsWith ("--fatal", StringComparison.Ordinal)){
int fatal = 1;