[System] Fix the CSharpCodeCompiler error parsing regex.
authorJonathan Pryor <jonpryor@vt.edu>
Tue, 24 Sep 2013 21:14:55 +0000 (17:14 -0400)
committerJonathan Pryor <jonpryor@vt.edu>
Tue, 24 Sep 2013 21:14:55 +0000 (17:14 -0400)
Use the same regex as xbuild uses for error parsing; see 7a2d2c24.

external/cecil
external/ikvm
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolTask.cs
mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs

index 89cfb1d4079002394010fd351628ad057c94422f..54e0a50464edbc254b39ea3c885ee91ada730705 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 89cfb1d4079002394010fd351628ad057c94422f
+Subproject commit 54e0a50464edbc254b39ea3c885ee91ada730705
index b21af5015e658c102be86d25ccb02a2f6a895fb5..246083db06aa62f1999ddd0dcffb816b667f1cdc 160000 (submodule)
@@ -1 +1 @@
-Subproject commit b21af5015e658c102be86d25ccb02a2f6a895fb5
+Subproject commit 246083db06aa62f1999ddd0dcffb816b667f1cdc
index 3192344d278790158cbdafc000d361972ada350b..77814aab8621b327e16c0e952105454ac32dd66b 100644 (file)
@@ -464,8 +464,7 @@ namespace Microsoft.Build.Utilities
                        }
                }
 
-               // 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)
index 26039bdd79b3de87fccd138b2345b4f809967f16..62b41de358d512f71d3fdaaa3985845ae2beb990 100644 (file)
@@ -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