diff options
Diffstat (limited to 'mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs')
-rw-r--r-- | mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs index 26039bdd79..62b41de358 100644 --- a/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs +++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs @@ -395,6 +395,20 @@ namespace Mono.CSharp 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")) @@ -404,8 +418,7 @@ namespace Mono.CSharp 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 |