Beispiel #1
0
        /// <summary>
        /// Detokenizes the argument components from a parse tree.
        /// </summary>
        /// <param name="tree">
        /// The parse tree.
        /// </param>
        /// <returns>
        /// A collection of <see cref="IMarkupExtensionArgumentInfo"/> representing the arguments in the parse tree.
        /// </returns>
        private static IEnumerable <IMarkupExtensionArgumentInfo> DetokenizeArguments(ParseTree tree)
        {
            var positionalArguments = MarkupExtensionParser.ExtractPositionalArguments(tree);
            var namedArguments      = MarkupExtensionParser.ExtractNamedArguments(tree);

            var arguments = positionalArguments
                            .Concat(namedArguments)
                            .Select(
                item =>
                new MarkupExtensionArgumentInfo(
                    item.Item1 != null ? (string)item.Item1.Value : null,
                    item.Item1 != null ? (MarkupExtensionTokenDetails)item.Item1.Details : null,
                    item.Item2.Value is ParseTree ? MarkupExtensionParser.Detokenize((ParseTree)item.Item2.Value) : item.Item2.Value,
                    (MarkupExtensionTokenDetails)item.Item2.Details))
                            .ToArray();

            if (arguments.Length == 1 && arguments[0].IsEmpty)
            {
                arguments = new MarkupExtensionArgumentInfo[] { };
            }

            return(arguments);
        }
 /// <summary>
 /// Determines whether the specified <see cref="MarkupExtensionArgumentInfo"/> is equal to the current
 /// <see cref="MarkupExtensionArgumentInfo"/>.
 /// </summary>
 /// <returns>
 /// A value indicating whether <paramref name="other"/> is equal to the current
 /// <see cref="MarkupExtensionArgumentInfo"/>.
 /// </returns>
 /// <param name="other">
 /// The <see cref="MarkupExtensionArgumentInfo"/> to compare with the current
 /// <see cref="MarkupExtensionArgumentInfo"/>.
 /// </param>
 protected bool Equals(MarkupExtensionArgumentInfo other) =>
 string.Equals(this.MemberNameValue, other.MemberNameValue) &&
 object.Equals(this.StringValue, other.StringValue) &&
 this.StringDetails.IsQuoted == other.StringDetails.IsQuoted;