}
}
- // Snatched from our codedom code, with some changes to make it compatible with csc
- // (the line+column group is optional is csc)
+ // Keep in sync with mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
const string ErrorRegexPattern = @"
^
(\s*(?<file>[^\(]+) # filename (optional)
args.AppendFormat("\"{0}\" ",source);
return args.ToString();
}
+
+ // Keep in sync with mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolTask.cs
+ const string ErrorRegexPattern = @"
+ ^
+ (\s*(?<file>[^\(]+) # filename (optional)
+ (\((?<line>\d*)(,(?<column>\d*[\+]*))?\))? # line+column (optional)
+ :\s+)?
+ (?<level>\w+) # error|warning
+ \s+
+ (?<number>[^:]*\d) # CS1234
+ :
+ \s*
+ (?<message>.*)$";
+
private static CompilerError CreateErrorFromString(string error_string)
{
if (error_string.StartsWith ("BETA"))
return null;
CompilerError error=new CompilerError();
- Regex reg = new Regex (@"^(\s*(?<file>.*)\((?<line>\d*)(,(?<column>\d*))?\)(:)?\s+)*(?<level>\w+)\s*(?<number>.*):\s(?<message>.*)",
- RegexOptions.Compiled | RegexOptions.ExplicitCapture);
+ Regex reg = new Regex (ErrorRegexPattern, RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.IgnorePatternWhitespace);
Match match=reg.Match(error_string);
if (!match.Success) {
// We had some sort of runtime crash