示例#1
0
        /// <summary>
        /// Adds a diagnostic indicating that an easing function is unrecognized
        /// 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 ReportUnrecognizedEasingFunction(ref ICollection <DiagnosticInfo> collection,
                                                              UvssIdentifierBaseSyntax node)
        {
            Contract.Require(node, nameof(node));

            var span       = new TextSpan(0, node.Width);
            var diagnostic = new DiagnosticInfo(node, DiagnosticID.UnrecognizedEasingFunction,
                                                DiagnosticSeverity.Error, span, $"Unrecognized easing function '{node.Text}'");

            Report(ref collection, diagnostic);
        }
示例#2
0
        /// <summary>
        /// Adds a diagnostic indicating that a loop type is unrecognized
        /// 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 ReportUnrecognizedLoopType(ref ICollection <DiagnosticInfo> collection,
                                                        UvssIdentifierBaseSyntax node)
        {
            Contract.Require(node, nameof(node));

            var span       = new TextSpan(0, node.Width);
            var diagnostic = new DiagnosticInfo(node, DiagnosticID.UnrecognizedLoopType,
                                                DiagnosticSeverity.Error, span, $"Unrecognized loop type '{node.Text}' (should be 'none' or 'loop' or 'reverse')");

            Report(ref collection, diagnostic);
        }
        /// <summary>
        /// Parses the value of the specified optional identifier into a <see cref="LoopBehavior"/>
        /// value, if the identifier exists.
        /// </summary>
        private static LoopBehavior ParseOptionalLoopBehavior(UvssIdentifierBaseSyntax identifier)
        {
            if (identifier == null)
            {
                return(LoopBehavior.None);
            }

            var text = identifier.Text;

            switch (text)
            {
            case KnownLoopBehaviors.None:
                return(LoopBehavior.None);

            case KnownLoopBehaviors.Loop:
                return(LoopBehavior.Loop);

            case KnownLoopBehaviors.Reverse:
                return(LoopBehavior.Reverse);

            default:
                throw new UvssException(PresentationStrings.StyleSheetParserError);
            }
        }