Exemple #1
0
 public void ReportSyntaxError(string message, Node node, IronPython.Hosting.Severity serverity)
 {
     this.context.AddError(message, node, serverity);
 }
        /// <summary>
        /// Log Errors/Warnings/Messages when the compiler reports them.
        /// </summary>
        /// <param name="path">Path to the file where the error was found (null/empty if N/A)</param>
        /// <param name="message">Text of the error/warning/message</param>
        /// <param name="startLine">First line of the block containing the error (0 if N/A)</param>
        /// <param name="startColumn">First column of the block containing the error (0 if N/A)</param>
        /// <param name="endLine">Last line of the block containing the error (0 if N/A)</param>
        /// <param name="endColumn">Last column of the block containing the error (0 if N/A)</param>
        /// <param name="errorCode">Code corresponding to the error</param>
        /// <param name="severity">Error/Warning/Message</param>
        public override void AddError(string path, string message, string lineText, IronPython.Hosting.CodeSpan location, int errorCode, IronPython.Hosting.Severity severity)
        {
            if (ProjectDirectory != null && !System.IO.Path.IsPathRooted(path))
            {
                path = System.IO.Path.Combine(ProjectDirectory, path);
            }
            // Based on the type of event (error/warning/message), report the corresponding type of problem to MSBuild
            switch (severity)
            {
            case IronPython.Hosting.Severity.Error:
            {
                buildSucceeded = false;
                taskLogger.LogError(String.Empty, "PY" + errorCode.ToString(), String.Empty, path, location.StartLine, location.StartColumn, location.EndLine, location.EndColumn, message);
                break;
            }

            case IronPython.Hosting.Severity.Warning:
            {
                taskLogger.LogWarning(String.Empty, "PY" + errorCode.ToString(), String.Empty, path, location.StartLine, location.StartColumn, location.EndLine, location.EndColumn, message);
                break;
            }

            case IronPython.Hosting.Severity.Message:
            {
                taskLogger.LogMessage(message);
                break;
            }
            }
        }