예제 #1
0
        internal void ProcessErrors()
        {
            var isErrroSection = true;

            // only dotnet has a distinctive error message that separates "info"
            // and "error" section. It is particularly important to process only
            // the "error" section as dotnet compiler prints the same errors in
            // both of these sections.
            if (CSExecutor.options.compilerEngine == null || CSExecutor.options.compilerEngine == Directives.compiler_dotnet)
            {
                isErrroSection = false;
            }

            // Build succeeded.
            foreach (var line in Output)
            {
                if (!isErrroSection)
                {
                    // MSBUILD : error MSB1001: Unknown switch.
                    if (line.StartsWith("Build FAILED.") || line.StartsWith("Build succeeded."))
                    {
                        isErrroSection = true;
                    }

                    if (line.Contains("): error ") || line.StartsWith("error CS") || line.StartsWith("vbc : error BC") || line.Contains("MSBUILD : error "))
                    {
                        var error = CompilerError.Parser(line);
                        if (error != null)
                        {
                            Errors.Add(error);
                        }
                    }
                }
                else
                {
                    if (line.IsNotEmpty())
                    {
                        var error = CompilerError.Parser(line);
                        if (error != null)
                        {
                            Errors.Add(error);
                        }
                    }
                }
            }
        }