コード例 #1
0
        /// <summary>
        /// Adds a diagnostic indicating that a directive was encountered at an invalid position
        /// to the specified collection of diagnostics.
        /// </summary>
        /// <param name="collection">The collection to which to add the diagnostic.</param>
        /// <param name="node">The syntax node which is associated with the diagnostic.</param>
        internal static void ReportDirectiveAtInvalidPosition(ref ICollection <DiagnosticInfo> collection,
                                                              UvssDirectiveSyntax node)
        {
            Contract.Require(node, nameof(node));

            var span       = new TextSpan(0, node.Width);
            var diagnostic = new DiagnosticInfo(node, DiagnosticID.DirectiveAtInvalidPosition,
                                                DiagnosticSeverity.Error, span, $"Directives are only valid at the start of a document");

            Report(ref collection, diagnostic);
        }
コード例 #2
0
        /// <summary>
        /// Adds a diagnostic indicating that a directive was encountered at an invalid position
        /// to the specified collection of diagnostics.
        /// </summary>
        /// <param name="collection">The collection to which to add the diagnostic.</param>
        /// <param name="node">The syntax node which is associated with the diagnostic.</param>
        internal static void ReportDirectiveMustBeFirstNonWhiteSpaceOnLine(ref ICollection <DiagnosticInfo> collection,
                                                                           UvssDirectiveSyntax node)
        {
            Contract.Require(node, nameof(node));

            var span       = new TextSpan(0, node.Width);
            var diagnostic = new DiagnosticInfo(node, DiagnosticID.DirectiveMustBeFirstNonWhiteSpaceOnLine,
                                                DiagnosticSeverity.Error, span, $"Directive must appear as the first non-whitespace character on a line");

            Report(ref collection, diagnostic);
        }
コード例 #3
0
        /// <summary>
        /// Adds a diagnostic indicating that a directive is not recognized
        /// to the specified collection of diagnostics.
        /// </summary>
        /// <param name="collection">The collection to which to add the diagnostic.</param>
        /// <param name="node">The syntax node which is associated with the diagnostic.</param>
        internal static void ReportUnknownDirective(ref ICollection <DiagnosticInfo> collection,
                                                    UvssDirectiveSyntax node)
        {
            Contract.Require(node, nameof(node));

            var span       = new TextSpan(0, node.Width);
            var diagnostic = new DiagnosticInfo(node, DiagnosticID.UnknownDirective,
                                                DiagnosticSeverity.Error, span, $"Unrecognized directive");

            Report(ref collection, diagnostic);
        }