Example #1
0
        /// <summary>
        /// Scans errorString line-wise for filename-line-message patterns (e.g. "myModule(1): Something's wrong here") and add these error locations to the CompilerResults cr.
        /// </summary>
        public static void HandleCompilerOutput(AbstractDProject Project, BuildResult br, string errorString)
        {
            var    reader = new StringReader(errorString);
            string next;

            while ((next = reader.ReadLine()) != null)
            {
                var error = ErrorExtracting.FindError(next, reader);
                if (error != null)
                {
                    if (error.ErrorText != null && error.ErrorText.Length > MaxErrorMsgLength)
                    {
                        error.ErrorText = error.ErrorText.Substring(0, MaxErrorMsgLength) + "...";
                    }

                    // dmd's error filenames may contain mixin location info
                    var m = mixinInlineRegex.Match(error.FileName);
                    if (m.Success)
                    {
                        error.FileName = error.FileName.Substring(0, m.Index);
                        int line;
                        int.TryParse(m.Groups ["line"].Value, out line);
                        error.Line = line;
                    }

                    if (!Path.IsPathRooted(error.FileName))
                    {
                        error.FileName = Project.GetAbsoluteChildPath(error.FileName);
                    }
                    br.Append(error);
                }
            }

            reader.Close();
        }
Example #2
0
        /// <summary>
        /// Scans errorString line-wise for filename-line-message patterns (e.g. "myModule(1): Something's wrong here") and add these error locations to the CompilerResults cr.
        /// </summary>
        public static void HandleCompilerOutput(AbstractDProject Project, BuildResult br, string errorString)
        {
            var    reader = new StringReader(errorString);
            string next;

            while ((next = reader.ReadLine()) != null)
            {
                var error = ErrorExtracting.FindError(next, reader);
                if (error != null)
                {
                    if (!Path.IsPathRooted(error.FileName))
                    {
                        error.FileName = Project.GetAbsoluteChildPath(error.FileName);
                    }
                    br.Append(error);
                }
            }

            reader.Close();
        }